build.gradleβ’2.41 kB
plugins {
id 'com.github.johnrengelman.shadow' version '8.1.1'
id 'java'
}
group = 'jadx.plugins'
version = '1.2'
repositories {
mavenCentral()
}
dependencies {
implementation 'org.json:json:20231013'
compileOnly("io.github.skylot:jadx-core:1.5.1")
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17) // Also supported older Java versions
}
}
jar {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
archiveBaseName = 'jadx-mcp-plugin'
manifest {
attributes(
'Jadx-Plugin': 'true',
'Jadx-Plugin-Class': 'com.mobilehackinglab.jadxplugin.McpPlugin',
'Jadx-Plugin-Version': '1.2.0',
'Jadx-Plugin-Id': 'jadx-mcp-plugin',
'Jadx-Plugin-Description': 'Exposes Jadx info over HTTP',
'Jadx-Plugin-Author': 'Mobile Hacking Lab'
)
}
// This ensures all dependencies are included
from {
configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
}
// Exclude problematic files from dependencies
exclude 'META-INF/*.SF', 'META-INF/*.DSA', 'META-INF/*.RSA', 'META-INF/MANIFEST.MF'
}
shadowJar {
archiveBaseName = 'jadx-mcp-plugin'
archiveVersion = '1.2.0'
mergeServiceFiles()
}
// Installs the plugin JAR into Jadx
tasks.register("installPlugin", Exec) {
group = "plugin"
description = "Installs the jadx-mcp plugin."
dependsOn jar
doFirst {
def pluginJar = layout.buildDirectory.file("libs/jadx-mcp-plugin-${project.version}.jar").get().asFile.absolutePath
commandLine "sh", "-c", """
jadx plugins --uninstall jadx-mcp >/dev/null
jadx plugins --install-jar \"${pluginJar}\"
"""
}
}
// Uninstalls the plugin from Jadx
tasks.register("uninstallPlugin", Exec) {
group = "plugin"
description = "Uninstalls the jadx-mcp plugin."
commandLine "sh", "-c", "jadx plugins --uninstall jadx-mcp"
}
// Enables the plugin after it's installed
tasks.register("enablePlugin", Exec) {
group = "plugin"
description = "Enables the jadx-mcp plugin."
commandLine "sh", "-c", "jadx plugins --enable jadx-mcp"
}
// Disables the plugin
tasks.register("disablePlugin", Exec) {
group = "plugin"
description = "Disables the jadx-mcp plugin."
commandLine "sh", "-c", "jadx plugins --disable jadx-mcp"
}