chore: update dependencies
This commit is contained in:
+3
-3
@@ -1,10 +1,10 @@
|
||||
//file:noinspection UnnecessaryQualifiedReference
|
||||
|
||||
plugins {
|
||||
id 'com.github.ben-manes.versions' version '0.45.0'
|
||||
id 'com.github.ben-manes.versions' version '0.46.0'
|
||||
id 'com.diffplug.spotless' version '6.13.0'
|
||||
|
||||
id 'org.jetbrains.kotlin.jvm' version '1.7.20'
|
||||
id 'org.jetbrains.kotlin.jvm' version '1.8.10'
|
||||
}
|
||||
|
||||
ext.jadxVersion = System.getenv('JADX_VERSION') ?: "dev"
|
||||
@@ -42,7 +42,7 @@ allprojects {
|
||||
|
||||
testImplementation 'ch.qos.logback:logback-classic:1.3.5'
|
||||
testImplementation 'org.hamcrest:hamcrest-library:2.2'
|
||||
testImplementation 'org.mockito:mockito-core:4.10.0'
|
||||
testImplementation 'org.mockito:mockito-core:4.11.0'
|
||||
testImplementation 'org.assertj:assertj-core:3.24.2'
|
||||
|
||||
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.9.2'
|
||||
|
||||
@@ -15,12 +15,12 @@ dependencies {
|
||||
// jadx-script autocomplete support
|
||||
implementation(project(":jadx-plugins::jadx-script:jadx-script-ide"))
|
||||
implementation(project(":jadx-plugins::jadx-script:jadx-script-runtime"))
|
||||
implementation 'org.jetbrains.kotlin:kotlin-scripting-common:1.7.20'
|
||||
implementation 'com.fifesoft:autocomplete:3.3.0'
|
||||
implementation 'org.jetbrains.kotlin:kotlin-scripting-common:1.8.10'
|
||||
implementation 'com.fifesoft:autocomplete:3.3.1'
|
||||
|
||||
// use KtLint for format and check jadx scripts
|
||||
implementation 'com.pinterest.ktlint:ktlint-core:0.47.1'
|
||||
implementation 'com.pinterest.ktlint:ktlint-ruleset-standard:0.47.1'
|
||||
implementation 'com.pinterest.ktlint:ktlint-core:0.48.2'
|
||||
implementation 'com.pinterest.ktlint:ktlint-ruleset-standard:0.48.2'
|
||||
|
||||
implementation 'com.beust:jcommander:1.82'
|
||||
implementation 'ch.qos.logback:logback-classic:1.3.5'
|
||||
|
||||
@@ -17,7 +17,7 @@ object KtLintUtils {
|
||||
|
||||
val configOverride = lazy {
|
||||
EditorConfigOverride.from(
|
||||
indentStyleProperty to PropertyType.IndentStyleValue.tab
|
||||
indentStyleProperty to PropertyType.IndentStyleValue.tab,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ object KtLintUtils {
|
||||
if (!corrected) {
|
||||
LOG.warn("Lint error: {}", e)
|
||||
}
|
||||
}
|
||||
},
|
||||
)
|
||||
return KtLint.format(params)
|
||||
}
|
||||
@@ -49,7 +49,7 @@ object KtLintUtils {
|
||||
if (!corrected) {
|
||||
errors.add(e)
|
||||
}
|
||||
}
|
||||
},
|
||||
)
|
||||
KtLint.lint(params)
|
||||
return errors
|
||||
|
||||
@@ -4,7 +4,7 @@ dependencies {
|
||||
implementation("org.jetbrains.kotlin:kotlin-stdlib-common")
|
||||
implementation("org.jetbrains.kotlin:kotlin-script-runtime")
|
||||
|
||||
implementation("io.github.microutils:kotlin-logging-jvm:3.0.2")
|
||||
implementation("io.github.microutils:kotlin-logging-jvm:3.0.5")
|
||||
|
||||
// script context support in IDE is poor, use stubs and manual imports for now
|
||||
// kotlinScriptDef(project(":jadx-plugins:jadx-script:jadx-script-runtime"))
|
||||
|
||||
@@ -8,5 +8,5 @@ dependencies {
|
||||
implementation(project(":jadx-plugins:jadx-script:jadx-script-plugin"))
|
||||
|
||||
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4")
|
||||
implementation("io.github.microutils:kotlin-logging-jvm:3.0.2")
|
||||
implementation("io.github.microutils:kotlin-logging-jvm:3.0.5")
|
||||
}
|
||||
|
||||
@@ -19,13 +19,13 @@ const val AUTO_COMPLETE_INSERT_STR = "ABCDEF" // defined at KJvmReplCompleter.IN
|
||||
|
||||
data class ScriptCompletionResult(
|
||||
val completions: List<SourceCodeCompletionVariant>,
|
||||
val reports: List<ScriptDiagnostic>
|
||||
val reports: List<ScriptDiagnostic>,
|
||||
)
|
||||
|
||||
data class ScriptAnalyzeResult(
|
||||
val issues: List<ScriptDiagnostic>,
|
||||
val renderType: String?,
|
||||
val reports: List<ScriptDiagnostic>
|
||||
val reports: List<ScriptDiagnostic>,
|
||||
)
|
||||
|
||||
class ScriptCompiler(private val scriptName: String) {
|
||||
@@ -36,7 +36,7 @@ class ScriptCompiler(private val scriptName: String) {
|
||||
val result = complete(code.toScriptSource(scriptName), cursor)
|
||||
return ScriptCompletionResult(
|
||||
completions = result.valueOrNull()?.toList() ?: emptyList(),
|
||||
reports = result.reports
|
||||
reports = result.reports,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ class ScriptCompiler(private val scriptName: String) {
|
||||
return ScriptAnalyzeResult(
|
||||
issues = analyzerResult?.get(ReplAnalyzerResult.analysisDiagnostics)?.toList() ?: emptyList(),
|
||||
renderType = analyzerResult?.get(ReplAnalyzerResult.renderedResultType),
|
||||
reports = result.reports
|
||||
reports = result.reports,
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -11,5 +11,5 @@ dependencies {
|
||||
|
||||
implementation(project(":jadx-plugins:jadx-script:jadx-script-runtime"))
|
||||
|
||||
implementation("io.github.microutils:kotlin-logging-jvm:3.0.2")
|
||||
implementation("io.github.microutils:kotlin-logging-jvm:3.0.5")
|
||||
}
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ import java.io.File
|
||||
data class ScriptStateData(
|
||||
val scriptFile: File,
|
||||
val scriptData: JadxScriptData,
|
||||
var error: Boolean = false
|
||||
var error: Boolean = false,
|
||||
)
|
||||
|
||||
class ScriptStates {
|
||||
|
||||
@@ -14,7 +14,7 @@ dependencies {
|
||||
implementation(kotlin("scripting-dependencies-maven"))
|
||||
|
||||
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4")
|
||||
implementation("io.github.microutils:kotlin-logging-jvm:3.0.2")
|
||||
implementation("io.github.microutils:kotlin-logging-jvm:3.0.5")
|
||||
|
||||
runtimeOnly(project(":jadx-plugins:jadx-dex-input"))
|
||||
runtimeOnly(project(":jadx-plugins:jadx-smali-input"))
|
||||
|
||||
+3
-3
@@ -32,10 +32,10 @@ const val JADX_SCRIPT_LOG_PREFIX = "JadxScript:"
|
||||
|
||||
@KotlinScript(
|
||||
fileExtension = "jadx.kts",
|
||||
compilationConfiguration = JadxScriptConfiguration::class
|
||||
compilationConfiguration = JadxScriptConfiguration::class,
|
||||
)
|
||||
abstract class JadxScriptTemplate(
|
||||
private val scriptData: JadxScriptData
|
||||
private val scriptData: JadxScriptData,
|
||||
) {
|
||||
val scriptName = scriptData.scriptName
|
||||
val log = KotlinLogging.logger("$JADX_SCRIPT_LOG_PREFIX$scriptName")
|
||||
@@ -56,7 +56,7 @@ object JadxScriptConfiguration : ScriptCompilationConfiguration({
|
||||
|
||||
jvm {
|
||||
dependenciesFromCurrentContext(
|
||||
wholeClasspath = true
|
||||
wholeClasspath = true,
|
||||
)
|
||||
}
|
||||
ide {
|
||||
|
||||
+2
-2
@@ -23,7 +23,7 @@ class JadxScriptData(
|
||||
val jadxInstance: JadxDecompiler,
|
||||
val pluginContext: JadxPluginContext,
|
||||
val options: JadxScriptAllOptions,
|
||||
val scriptFile: File
|
||||
val scriptFile: File,
|
||||
) {
|
||||
val afterLoad: MutableList<() -> Unit> = ArrayList()
|
||||
|
||||
@@ -32,7 +32,7 @@ class JadxScriptData(
|
||||
|
||||
class JadxScriptInstance(
|
||||
private val scriptData: JadxScriptData,
|
||||
val log: KLogger
|
||||
val log: KLogger,
|
||||
) {
|
||||
private val decompiler = scriptData.jadxInstance
|
||||
|
||||
|
||||
+2
-2
@@ -6,7 +6,7 @@ import jadx.plugins.script.runtime.JadxScriptInstance
|
||||
|
||||
class Gui(
|
||||
private val jadx: JadxScriptInstance,
|
||||
private val guiContext: JadxGuiContext?
|
||||
private val guiContext: JadxGuiContext?,
|
||||
) {
|
||||
|
||||
fun isAvailable() = guiContext != null
|
||||
@@ -27,7 +27,7 @@ class Gui(
|
||||
name: String,
|
||||
enabled: (ICodeNodeRef) -> Boolean = { _ -> true },
|
||||
keyBinding: String? = null,
|
||||
action: (ICodeNodeRef) -> Unit
|
||||
action: (ICodeNodeRef) -> Unit,
|
||||
) {
|
||||
context().addPopupMenuAction(name, enabled, keyBinding, action)
|
||||
}
|
||||
|
||||
+4
-4
@@ -20,7 +20,7 @@ class JadxScriptAllOptions : JadxPluginOptions {
|
||||
class ScriptOption<T>(
|
||||
val name: String,
|
||||
val id: String,
|
||||
private val getter: () -> T
|
||||
private val getter: () -> T,
|
||||
) {
|
||||
private var validate: ((T) -> Boolean)? = null
|
||||
|
||||
@@ -43,7 +43,7 @@ class ScriptOption<T>(
|
||||
|
||||
class JadxScriptOptions(
|
||||
private val jadx: JadxScriptInstance,
|
||||
private val options: JadxScriptAllOptions
|
||||
private val options: JadxScriptAllOptions,
|
||||
) {
|
||||
fun <T> register(
|
||||
name: String,
|
||||
@@ -51,7 +51,7 @@ class JadxScriptOptions(
|
||||
values: List<String>,
|
||||
defaultValue: String,
|
||||
type: OptionType = OptionType.STRING,
|
||||
convert: (String?) -> T
|
||||
convert: (String?) -> T,
|
||||
): ScriptOption<T> {
|
||||
val id = "jadx-script.${jadx.scriptName}.$name"
|
||||
options.descriptions.add(JadxOptionDescription(id, desc, defaultValue, values, type))
|
||||
@@ -62,7 +62,7 @@ class JadxScriptOptions(
|
||||
name: String,
|
||||
desc: String = "",
|
||||
values: List<String> = emptyList(),
|
||||
defaultValue: String = ""
|
||||
defaultValue: String = "",
|
||||
): ScriptOption<String> {
|
||||
return register(name, desc, values, defaultValue) { value ->
|
||||
if (value == null) {
|
||||
|
||||
+26
-26
@@ -16,37 +16,37 @@ class Rename(private val jadx: JadxScriptInstance) {
|
||||
jadx.addPass(object : ScriptOrderedPreparePass(
|
||||
jadx,
|
||||
"RenameAll",
|
||||
runBefore = listOf("RenameVisitor")
|
||||
runBefore = listOf("RenameVisitor"),
|
||||
) {
|
||||
override fun init(root: RootNode) {
|
||||
for (pkgNode in root.packages) {
|
||||
rename(makeNewName, pkgNode, pkgNode.pkgInfo.name)
|
||||
override fun init(root: RootNode) {
|
||||
for (pkgNode in root.packages) {
|
||||
rename(makeNewName, pkgNode, pkgNode.pkgInfo.name)
|
||||
}
|
||||
for (cls in root.classes) {
|
||||
rename(makeNewName, cls, cls.name)
|
||||
for (mth in cls.methods) {
|
||||
if (!mth.isConstructor) {
|
||||
rename(makeNewName, mth, mth.name)
|
||||
}
|
||||
}
|
||||
for (cls in root.classes) {
|
||||
rename(makeNewName, cls, cls.name)
|
||||
for (mth in cls.methods) {
|
||||
if (!mth.isConstructor) {
|
||||
rename(makeNewName, mth, mth.name)
|
||||
}
|
||||
}
|
||||
for (fld in cls.fields) {
|
||||
rename(makeNewName, fld, fld.name)
|
||||
}
|
||||
for (fld in cls.fields) {
|
||||
rename(makeNewName, fld, fld.name)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private inline fun <T : IDexNode> rename(
|
||||
makeNewName: (String, IDexNode) -> String?,
|
||||
node: T,
|
||||
name: String
|
||||
) {
|
||||
if (node is IAttributeNode && node.contains(AFlag.DONT_RENAME)) {
|
||||
return
|
||||
}
|
||||
makeNewName.invoke(name, node)?.let {
|
||||
node.rename(it)
|
||||
}
|
||||
private inline fun <T : IDexNode> rename(
|
||||
makeNewName: (String, IDexNode) -> String?,
|
||||
node: T,
|
||||
name: String,
|
||||
) {
|
||||
if (node is IAttributeNode && node.contains(AFlag.DONT_RENAME)) {
|
||||
return
|
||||
}
|
||||
})
|
||||
makeNewName.invoke(name, node)?.let {
|
||||
node.rename(it)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
+19
-19
@@ -12,14 +12,14 @@ class Stages(private val jadx: JadxScriptInstance) {
|
||||
jadx.addPass(object : ScriptOrderedDecompilePass(
|
||||
jadx,
|
||||
"StageRawInsns",
|
||||
runAfter = listOf("start")
|
||||
runAfter = listOf("start"),
|
||||
) {
|
||||
override fun visit(mth: MethodNode) {
|
||||
mth.instructions?.let {
|
||||
block.invoke(mth, it)
|
||||
}
|
||||
override fun visit(mth: MethodNode) {
|
||||
mth.instructions?.let {
|
||||
block.invoke(mth, it)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
fun mthEarlyBlocks(block: (MethodNode, List<BlockNode>) -> Unit) {
|
||||
@@ -28,32 +28,32 @@ class Stages(private val jadx: JadxScriptInstance) {
|
||||
|
||||
fun mthBlocks(
|
||||
beforePass: String = "RegionMakerVisitor",
|
||||
block: (MethodNode, List<BlockNode>) -> Unit
|
||||
block: (MethodNode, List<BlockNode>) -> Unit,
|
||||
) {
|
||||
jadx.addPass(object : ScriptOrderedDecompilePass(
|
||||
jadx,
|
||||
"StageMthBlocks",
|
||||
runBefore = listOf(beforePass)
|
||||
runBefore = listOf(beforePass),
|
||||
) {
|
||||
override fun visit(mth: MethodNode) {
|
||||
mth.basicBlocks?.let {
|
||||
block.invoke(mth, it)
|
||||
}
|
||||
override fun visit(mth: MethodNode) {
|
||||
mth.basicBlocks?.let {
|
||||
block.invoke(mth, it)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
fun mthRegions(block: (MethodNode, Region) -> Unit) {
|
||||
jadx.addPass(object : ScriptOrderedDecompilePass(
|
||||
jadx,
|
||||
"StageMthRegions",
|
||||
runBefore = listOf("PrepareForCodeGen")
|
||||
runBefore = listOf("PrepareForCodeGen"),
|
||||
) {
|
||||
override fun visit(mth: MethodNode) {
|
||||
mth.region?.let {
|
||||
block.invoke(mth, it)
|
||||
}
|
||||
override fun visit(mth: MethodNode) {
|
||||
mth.region?.let {
|
||||
block.invoke(mth, it)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
+5
-5
@@ -17,14 +17,14 @@ private fun buildSimplePassInfo(jadx: JadxScriptInstance, name: String) =
|
||||
|
||||
abstract class ScriptPreparePass(
|
||||
private val jadx: JadxScriptInstance,
|
||||
private val name: String
|
||||
private val name: String,
|
||||
) : JadxPreparePass {
|
||||
override fun getInfo() = buildSimplePassInfo(jadx, name)
|
||||
}
|
||||
|
||||
abstract class ScriptDecompilePass(
|
||||
private val jadx: JadxScriptInstance,
|
||||
private val name: String
|
||||
private val name: String,
|
||||
) : JadxDecompilePass {
|
||||
override fun getInfo() = buildSimplePassInfo(jadx, name)
|
||||
|
||||
@@ -43,7 +43,7 @@ abstract class ScriptOrderedPass(
|
||||
private val jadx: JadxScriptInstance,
|
||||
private val name: String,
|
||||
private val runAfter: List<String> = listOf(),
|
||||
private val runBefore: List<String> = listOf()
|
||||
private val runBefore: List<String> = listOf(),
|
||||
) : JadxPass {
|
||||
override fun getInfo(): OrderedJadxPassInfo {
|
||||
val scriptName = buildScriptName(jadx, name)
|
||||
@@ -55,14 +55,14 @@ abstract class ScriptOrderedPreparePass(
|
||||
jadx: JadxScriptInstance,
|
||||
name: String,
|
||||
runAfter: List<String> = listOf(),
|
||||
runBefore: List<String> = listOf()
|
||||
runBefore: List<String> = listOf(),
|
||||
) : ScriptOrderedPass(jadx, name, runAfter, runBefore), JadxPreparePass
|
||||
|
||||
abstract class ScriptOrderedDecompilePass(
|
||||
jadx: JadxScriptInstance,
|
||||
name: String,
|
||||
runAfter: List<String> = listOf(),
|
||||
runBefore: List<String> = listOf()
|
||||
runBefore: List<String> = listOf(),
|
||||
) : ScriptOrderedPass(jadx, name, runAfter, runBefore), JadxDecompilePass {
|
||||
|
||||
override fun init(root: RootNode) {
|
||||
|
||||
Reference in New Issue
Block a user