Compare commits

...

3 Commits

Author SHA1 Message Date
semantic-release-bot
2432fde6bf chore(release): 7.1.0-dev.2 [skip ci]
# [7.1.0-dev.2](https://github.com/revanced/revanced-patcher/compare/v7.1.0-dev.1...v7.1.0-dev.2) (2023-05-05)

### Features

* add overload to get instruction as type ([49c173d](49c173dc14))
2023-05-05 21:38:29 +00:00
oSumAtrIX
49c173dc14 feat: add overload to get instruction as type 2023-05-05 23:36:30 +02:00
oSumAtrIX
d83e9372bb chore: update gradle and dependencies 2023-04-30 05:27:22 +02:00
6 changed files with 22 additions and 8 deletions

View File

@@ -1,3 +1,10 @@
# [7.1.0-dev.2](https://github.com/revanced/revanced-patcher/compare/v7.1.0-dev.1...v7.1.0-dev.2) (2023-05-05)
### Features
* add overload to get instruction as type ([49c173d](https://github.com/revanced/revanced-patcher/commit/49c173dc14137ddd198a611e9882dc71300831ee))
# [7.1.0-dev.1](https://github.com/revanced/revanced-patcher/compare/v7.0.0...v7.1.0-dev.1) (2023-04-30) # [7.1.0-dev.1](https://github.com/revanced/revanced-patcher/compare/v7.0.0...v7.1.0-dev.1) (2023-04-30)

View File

@@ -1,6 +1,5 @@
plugins { plugins {
kotlin("jvm") version "1.8.10" kotlin("jvm") version "1.8.10"
java
`maven-publish` `maven-publish`
} }
@@ -26,8 +25,8 @@ dependencies {
implementation("app.revanced:multidexlib2:2.5.3-a3836654") implementation("app.revanced:multidexlib2:2.5.3-a3836654")
implementation("app.revanced:apktool-lib:2.7.0") implementation("app.revanced:apktool-lib:2.7.0")
implementation("org.jetbrains.kotlin:kotlin-reflect:1.8.10") implementation("org.jetbrains.kotlin:kotlin-reflect:1.8.20-RC")
testImplementation("org.jetbrains.kotlin:kotlin-test:1.8.10") testImplementation("org.jetbrains.kotlin:kotlin-test:1.8.20-RC")
} }
tasks { tasks {

View File

@@ -1,2 +1,2 @@
kotlin.code.style = official kotlin.code.style = official
version = 7.1.0-dev.1 version = 7.1.0-dev.2

View File

@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.1-all.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-all.zip
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

View File

@@ -101,12 +101,20 @@ fun MutableMethod.removeInstruction(index: Int) = this.implementation!!.removeIn
fun MutableMethod.label(index: Int) = this.implementation!!.newLabelForIndex(index) fun MutableMethod.label(index: Int) = this.implementation!!.newLabelForIndex(index)
/** /**
* Get the instruction at the given index in the method's implementation. * Get an instruction at the given index in the method's implementation.
* @param index The index to get the instruction at. * @param index The index to get the instruction at.
* @return The instruction. * @return The instruction.
*/ */
fun MutableMethod.instruction(index: Int): BuilderInstruction = this.implementation!!.instructions[index] fun MutableMethod.instruction(index: Int): BuilderInstruction = this.implementation!!.instructions[index]
/**
* Get an instruction at the given index in the method's implementation.
* @param index The index to get the instruction at.
* @param T The type of instruction to return.
* @return The instruction.
*/
fun <T> MutableMethod.instruction(index: Int): T = instruction(index) as T
/** /**
* Add smali instructions to the method. * Add smali instructions to the method.
* @param index The index to insert the instructions at. * @param index The index to insert the instructions at.

View File

@@ -44,7 +44,7 @@ internal class InlineSmaliCompilerTest {
""" """
) )
val insn = method.instruction(insnIndex) as BuilderInstruction21t val insn = method.instruction<BuilderInstruction21t>(insnIndex)
assertEquals(targetIndex, insn.target.location.index) assertEquals(targetIndex, insn.target.location.index)
} }
@@ -73,7 +73,7 @@ internal class InlineSmaliCompilerTest {
) )
) )
val insn = method.instruction(insnIndex) as BuilderInstruction21t val insn = method.instruction<BuilderInstruction21t>(insnIndex)
assertTrue(insn.target.isPlaced, "Label was not placed") assertTrue(insn.target.isPlaced, "Label was not placed")
assertEquals(labelIndex, insn.target.location.index) assertEquals(labelIndex, insn.target.location.index)
} }