build: migrate to kotlin dsl in gradle scripts, update gradle and deps

This commit is contained in:
Skylot 2023-07-07 22:55:45 +01:00
parent 3e4c6a9c51
commit d076c4e73d
No known key found for this signature in database
GPG Key ID: 1E23F5B52567AA39
32 changed files with 623 additions and 595 deletions

View File

@ -1,183 +0,0 @@
//file:noinspection UnnecessaryQualifiedReference
plugins {
id 'com.github.ben-manes.versions' version '0.47.0'
id 'se.patrikerdes.use-latest-versions' version '0.2.18'
id 'com.diffplug.spotless' version '6.19.0'
}
ext.jadxVersion = System.getenv('JADX_VERSION') ?: "dev"
version = jadxVersion
println("jadx version: ${jadxVersion}")
allprojects {
apply plugin: 'java'
apply plugin: 'checkstyle'
apply plugin: 'com.diffplug.spotless'
apply plugin: 'com.github.ben-manes.versions'
apply plugin: 'se.patrikerdes.use-latest-versions'
version = jadxVersion
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
compileJava {
options.encoding = "UTF-8"
}
jar {
manifest {
mainAttributes('jadx-version': jadxVersion)
}
}
dependencies {
implementation 'org.slf4j:slf4j-api:2.0.7'
compileOnly 'org.jetbrains:annotations:24.0.1'
testImplementation 'ch.qos.logback:logback-classic:1.4.8'
testImplementation 'org.hamcrest:hamcrest-library:2.2'
testImplementation 'org.mockito:mockito-core:5.4.0'
testImplementation 'org.assertj:assertj-core:3.24.2'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.9.3'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.9.3'
testCompileOnly 'org.jetbrains:annotations:24.0.1'
}
test {
useJUnitPlatform()
maxParallelForks = Runtime.runtime.availableProcessors()
}
repositories {
mavenLocal()
mavenCentral()
google()
}
spotless {
java {
importOrderFile "$rootDir/config/code-formatter/eclipse.importorder"
eclipse().configFile "$rootDir/config/code-formatter/eclipse.xml"
removeUnusedImports()
lineEndings(com.diffplug.spotless.LineEnding.UNIX)
encoding("UTF-8")
trimTrailingWhitespace()
endWithNewline()
}
kotlin {
ktlint()
.setUseExperimental(false)
.editorConfigOverride([indent_style: "tab"])
lineEndings(com.diffplug.spotless.LineEnding.UNIX)
encoding("UTF-8")
trimTrailingWhitespace()
endWithNewline()
}
format 'misc', {
target '**/*.gradle', '**/*.xml', '**/.gitignore', '**/.properties'
targetExclude ".gradle/**", ".idea/**", "*/build/**"
lineEndings(com.diffplug.spotless.LineEnding.UNIX)
encoding("UTF-8")
trimTrailingWhitespace()
endWithNewline()
}
}
dependencyUpdates {
resolutionStrategy {
componentSelection { rules ->
rules.all { ComponentSelection selection ->
boolean rejected = ['alpha', 'beta', 'dev', 'rc', 'cr', 'm', 'atlassian'].any { qualifier ->
selection.candidate.version ==~ /(?i).*[.-]${qualifier}[.\d-]*/
}
if (rejected) {
selection.reject('Release candidate')
}
}
}
}
}
}
task copyArtifacts(type: Copy) {
from(tasks.getByPath(":jadx-cli:installShadowDist")) {
exclude '**/*.jar'
filter { line ->
line.replaceAll('jadx-cli-(.*)-all.jar', 'jadx-$1-all.jar')
.replace('-jar "\\"$CLASSPATH\\""', '-cp "\\"$CLASSPATH\\"" jadx.cli.JadxCLI')
.replace('-jar "%CLASSPATH%"', '-cp "%CLASSPATH%" jadx.cli.JadxCLI')
}
}
from(tasks.getByPath(":jadx-gui:installShadowDist")) {
exclude '**/*.jar'
filter { line -> line.replaceAll('jadx-gui-(.*)-all.jar', 'jadx-$1-all.jar') }
}
from(tasks.getByPath(":jadx-gui:installShadowDist")) {
include '**/*.jar'
rename 'jadx-gui-(.*)-all.jar', 'jadx-$1-all.jar'
}
into layout.buildDirectory.dir("jadx")
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
task pack(type: Zip) {
from copyArtifacts
archiveFileName = "jadx-${jadxVersion}.zip"
destinationDirectory = layout.buildDirectory
}
task copyExe(type: Copy) {
group 'jadx'
description = 'Copy exe to build dir'
// next task dependencies not needed, but gradle throws warning because of same output dir
mustRunAfter jar
mustRunAfter pack
from tasks.getByPath('jadx-gui:createExe')
include '*.exe'
into layout.buildDirectory
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
task distWinBundle(type: Copy, dependsOn: 'jadx-gui:distWinWithJre') {
group 'jadx'
description = 'Copy bundle to build dir'
mustRunAfter pack
destinationDir buildDir
from(tasks.getByPath('jadx-gui:distWinWithJre').outputs) {
include '*.zip'
}
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
task dist {
group 'jadx'
description = 'Build jadx distribution zip'
dependsOn(pack)
OperatingSystem os = org.gradle.nativeplatform.platform.internal.DefaultNativePlatform.currentOperatingSystem;
if (os.isWindows()) {
if (project.hasProperty("bundleJRE")) {
println("Build win bundle with JRE")
dependsOn('distWinBundle')
} else {
dependsOn('copyExe')
}
}
}
task cleanBuildDir(type: Delete) {
group 'jadx'
delete buildDir
}
clean.dependsOn(cleanBuildDir)

156
build.gradle.kts Normal file
View File

@ -0,0 +1,156 @@
import com.diffplug.gradle.spotless.FormatExtension
import com.diffplug.gradle.spotless.SpotlessExtension
import com.diffplug.spotless.LineEnding
import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask
import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform
import java.util.Locale
plugins {
id("com.github.ben-manes.versions") version "0.47.0"
id("se.patrikerdes.use-latest-versions") version "0.2.18"
id("com.diffplug.spotless") version "6.19.0"
}
val jadxVersion by extra { System.getenv("JADX_VERSION") ?: "dev" }
println("jadx version: $jadxVersion")
version = jadxVersion
allprojects {
apply(plugin = "java")
apply(plugin = "checkstyle")
apply(plugin = "com.diffplug.spotless")
apply(plugin = "com.github.ben-manes.versions")
apply(plugin = "se.patrikerdes.use-latest-versions")
repositories {
mavenCentral()
}
configure<SpotlessExtension> {
java {
importOrderFile("$rootDir/config/code-formatter/eclipse.importorder")
eclipse().configFile("$rootDir/config/code-formatter/eclipse.xml")
removeUnusedImports()
commonFormatOptions()
}
kotlin {
ktlint()
.setUseExperimental(false)
.editorConfigOverride(mapOf("indent_style" to "tab"))
commonFormatOptions()
}
kotlinGradle {
ktlint()
commonFormatOptions()
}
format("misc") {
target("**/*.gradle", "**/*.xml", "**/.gitignore", "**/.properties")
targetExclude(".gradle/**", ".idea/**", "*/build/**")
commonFormatOptions()
}
}
tasks.named<DependencyUpdatesTask>("dependencyUpdates") {
rejectVersionIf {
// disallow release candidates as upgradable versions from stable versions
isNonStable(candidate.version) && !isNonStable(currentVersion)
}
}
}
fun FormatExtension.commonFormatOptions() {
lineEndings = LineEnding.UNIX
encoding = Charsets.UTF_8
trimTrailingWhitespace()
endWithNewline()
}
fun isNonStable(version: String): Boolean {
val stableKeyword = listOf("RELEASE", "FINAL", "GA").any { version.uppercase(Locale.getDefault()).contains(it) }
val regex = "^[0-9,.v-]+(-r)?$".toRegex()
val isStable = stableKeyword || regex.matches(version)
return isStable.not()
}
val copyArtifacts by tasks.registering(Copy::class) {
val jarCliPattern = "jadx-cli-(.*)-all.jar".toPattern()
from(tasks.getByPath(":jadx-cli:installShadowDist")) {
exclude("**/*.jar")
filter { line ->
jarCliPattern.matcher(line).replaceAll("jadx-$1-all.jar")
.replace("-jar \"\\\"\$CLASSPATH\\\"\"", "-cp \"\\\"\$CLASSPATH\\\"\" jadx.cli.JadxCLI")
.replace("-jar \"%CLASSPATH%\"", "-cp \"%CLASSPATH%\" jadx.cli.JadxCLI")
}
}
val jarGuiPattern = "jadx-gui-(.*)-all.jar".toPattern()
from(tasks.getByPath(":jadx-gui:installShadowDist")) {
exclude("**/*.jar")
filter { line -> jarGuiPattern.matcher(line).replaceAll("jadx-$1-all.jar") }
}
from(tasks.getByPath(":jadx-gui:installShadowDist")) {
include("**/*.jar")
rename("jadx-gui-(.*)-all.jar", "jadx-$1-all.jar")
}
into(layout.buildDirectory.dir("jadx"))
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
val pack by tasks.registering(Zip::class) {
from(copyArtifacts)
archiveFileName.set("jadx-$jadxVersion.zip")
destinationDirectory.set(layout.buildDirectory)
}
val copyExe by tasks.registering(Copy::class) {
group = "jadx"
description = "Copy exe to build dir"
// next task dependencies not needed, but gradle throws warning because of same output dir
mustRunAfter("jar")
mustRunAfter(pack)
from(tasks.getByPath("jadx-gui:createExe"))
include("*.exe")
into(layout.buildDirectory)
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
val distWinBundle by tasks.registering(Copy::class) {
group = "jadx"
description = "Copy bundle to build dir"
dependsOn(tasks.getByPath(":jadx-gui:distWinWithJre"))
// next task dependencies not needed, but gradle throws warning because of same output dir
mustRunAfter("jar")
mustRunAfter(pack)
from(tasks.getByPath("jadx-gui:distWinWithJre").outputs) {
include("*.zip")
}
into(layout.buildDirectory)
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
val dist by tasks.registering {
group = "jadx"
description = "Build jadx distribution zip"
dependsOn(pack)
val os = DefaultNativePlatform.getCurrentOperatingSystem()
if (os.isWindows) {
if (project.hasProperty("bundleJRE")) {
println("Build win bundle with JRE")
dependsOn(distWinBundle)
} else {
dependsOn(copyExe)
}
}
}
val cleanBuildDir by tasks.registering(Delete::class) {
group = "jadx"
delete(buildDir)
}
tasks.getByName("clean").dependsOn(cleanBuildDir)

View File

@ -1,11 +0,0 @@
plugins {
id 'groovy-gradle-plugin'
}
dependencies {
implementation 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.22'
}
repositories {
gradlePluginPortal()
}

11
buildSrc/build.gradle.kts Normal file
View File

@ -0,0 +1,11 @@
plugins {
`kotlin-dsl`
}
dependencies {
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.0")
}
repositories {
gradlePluginPortal()
}

View File

@ -1,12 +0,0 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask
plugins {
id 'org.jetbrains.kotlin.jvm'
}
tasks.withType(KotlinCompilationTask.class).configureEach {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_11)
}
}

View File

@ -1,79 +0,0 @@
plugins {
id 'java-library'
id 'maven-publish'
id 'signing'
}
group = 'io.github.skylot'
version = jadxVersion
java {
withJavadocJar()
withSourcesJar()
}
publishing {
publications {
mavenJava(MavenPublication) {
artifactId = project.name
from components.java
versionMapping {
usage('java-api') {
fromResolutionOf('runtimeClasspath')
}
usage('java-runtime') {
fromResolutionResult()
}
}
pom {
name = project.name
description = 'Dex to Java decompiler'
url = 'https://github.com/skylot/jadx'
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id = 'skylot'
name = 'Skylot'
email = 'skylot@gmail.com'
url = 'https://github.com/skylot'
}
}
scm {
connection = 'scm:git:git://github.com/skylot/jadx.git'
developerConnection = 'scm:git:ssh://github.com:skylot/jadx.git'
url = 'https://github.com/skylot/jadx'
}
}
}
}
repositories {
maven {
def releasesRepoUrl = uri('https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/')
def snapshotsRepoUrl = uri('https://s01.oss.sonatype.org/content/repositories/snapshots/')
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
credentials {
username = project.properties['ossrhUser'].toString()
password = project.properties['ossrhPassword'].toString()
}
}
}
}
signing {
required { gradle.taskGraph.hasTask("publish") }
sign publishing.publications.mavenJava
}
javadoc {
if (JavaVersion.current().isJava9Compatible()) {
options.addBooleanOption('html5', true)
}
// disable 'missing' warnings
options.addStringOption('Xdoclint:all,-missing', '-quiet')
}

View File

@ -0,0 +1,51 @@
plugins {
java
checkstyle
}
val jadxVersion: String by rootProject.extra
group = "io.github.skylot"
version = jadxVersion
dependencies {
implementation("org.slf4j:slf4j-api:2.0.7")
compileOnly("org.jetbrains:annotations:24.0.1")
testImplementation("ch.qos.logback:logback-classic:1.4.8")
testImplementation("org.hamcrest:hamcrest-library:2.2")
testImplementation("org.mockito:mockito-core:5.4.0")
testImplementation("org.assertj:assertj-core:3.24.2")
testImplementation("org.junit.jupiter:junit-jupiter:5.9.3")
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
testCompileOnly("org.jetbrains:annotations:24.0.1")
}
repositories {
mavenCentral()
// required for `aapt-proto` and `r8`
google()
}
java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
tasks {
compileJava {
options.encoding = "UTF-8"
}
jar {
manifest {
attributes("jadx-version" to jadxVersion)
}
}
test {
useJUnitPlatform()
maxParallelForks = Runtime.getRuntime().availableProcessors()
testLogging.showExceptions = true
}
}

View File

@ -0,0 +1,12 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
plugins {
id("jadx-java")
id("org.jetbrains.kotlin.jvm")
}
kotlin {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_11)
}
}

View File

@ -0,0 +1,81 @@
plugins {
id("jadx-java")
id("java-library")
id("maven-publish")
id("signing")
}
val jadxVersion: String by rootProject.extra
group = "io.github.skylot"
version = jadxVersion
java {
withJavadocJar()
withSourcesJar()
}
publishing {
publications {
create<MavenPublication>("mavenJava") {
artifactId = project.name
from(components["java"])
versionMapping {
usage("java-api") {
fromResolutionOf("runtimeClasspath")
}
usage("java-runtime") {
fromResolutionResult()
}
}
pom {
name.set(project.name)
description.set("Dex to Java decompiler")
url.set("https://github.com/skylot/jadx")
licenses {
license {
name.set("The Apache License, Version 2.0")
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
}
}
developers {
developer {
id.set("skylot")
name.set("Skylot")
email.set("skylot@gmail.com")
url.set("https://github.com/skylot")
}
}
scm {
connection .set("scm:git:git://github.com/skylot/jadx.git")
developerConnection.set("scm:git:ssh://github.com:skylot/jadx.git")
url .set("https://github.com/skylot/jadx")
}
}
}
}
repositories {
maven {
val releasesRepoUrl = uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/")
val snapshotsRepoUrl = uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")
url = if (version.toString().endsWith("SNAPSHOT")) snapshotsRepoUrl else releasesRepoUrl
credentials {
username = project.properties["ossrhUser"].toString()
password = project.properties["ossrhPassword"].toString()
}
}
}
}
signing {
isRequired = gradle.taskGraph.hasTask("publish")
sign(publishing.publications["mavenJava"])
}
tasks.javadoc {
val stdOptions = options as StandardJavadocDocletOptions
stdOptions.addBooleanOption("html5", true)
// disable 'missing' warnings
stdOptions.addStringOption("Xdoclint:all,-missing", "-quiet")
}

Binary file not shown.

View File

@ -1,7 +1,8 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionSha256Sum=e111cb9948407e26351227dabce49822fb88c37ee72f1d1582a69c68af2e702f
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
distributionSha256Sum=38f66cd6eef217b4c35855bb11ea4e9fbc53594ccccb5fb82dfd317ef8c2c5a3
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

5
gradlew vendored
View File

@ -130,10 +130,13 @@ location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi
# Increase the maximum file descriptors if we can.

View File

@ -1,44 +0,0 @@
plugins {
id 'application'
// use shadow only for application scripts, jar will be copied from jadx-gui
id 'com.github.johnrengelman.shadow' version '8.1.1'
}
dependencies {
implementation(project(':jadx-core'))
implementation(project(':jadx-plugins-tools'))
runtimeOnly(project(':jadx-plugins:jadx-dex-input'))
runtimeOnly(project(':jadx-plugins:jadx-java-input'))
runtimeOnly(project(':jadx-plugins:jadx-java-convert'))
runtimeOnly(project(':jadx-plugins:jadx-smali-input'))
runtimeOnly(project(':jadx-plugins:jadx-rename-mappings'))
runtimeOnly(project(':jadx-plugins:jadx-kotlin-metadata'))
runtimeOnly(project(':jadx-plugins:jadx-script:jadx-script-plugin'))
implementation 'com.beust:jcommander:1.82'
implementation 'ch.qos.logback:logback-classic:1.4.8'
}
application {
applicationName = 'jadx'
mainClass.set('jadx.cli.JadxCLI')
applicationDefaultJvmArgs = ['-Xms128M', '-XX:MaxRAMPercentage=70.0', '-XX:+UseG1GC']
}
shadow {
mainClassName = application.mainClass.get()
}
shadowJar {
// shadow jar not needed
configurations = []
}
applicationDistribution.with {
into('') {
from '../.'
include 'README.md'
include 'NOTICE'
include 'LICENSE'
}
}

39
jadx-cli/build.gradle.kts Normal file
View File

@ -0,0 +1,39 @@
plugins {
id("jadx-java")
id("application")
// use shadow only for application scripts, jar will be copied from jadx-gui
id("com.github.johnrengelman.shadow") version "8.1.1"
}
dependencies {
implementation(project(":jadx-core"))
implementation(project(":jadx-plugins-tools"))
runtimeOnly(project(":jadx-plugins:jadx-dex-input"))
runtimeOnly(project(":jadx-plugins:jadx-java-input"))
runtimeOnly(project(":jadx-plugins:jadx-java-convert"))
runtimeOnly(project(":jadx-plugins:jadx-smali-input"))
runtimeOnly(project(":jadx-plugins:jadx-rename-mappings"))
runtimeOnly(project(":jadx-plugins:jadx-kotlin-metadata"))
runtimeOnly(project(":jadx-plugins:jadx-script:jadx-script-plugin"))
implementation("com.beust:jcommander:1.82")
implementation("ch.qos.logback:logback-classic:1.4.8")
}
application {
applicationName = "jadx"
mainClass.set("jadx.cli.JadxCLI")
applicationDefaultJvmArgs = listOf("-Xms256M", "-XX:MaxRAMPercentage=70.0")
applicationDistribution.from("$rootDir") {
include("README.md")
include("NOTICE")
include("LICENSE")
}
}
tasks.shadowJar {
// shadow jar not needed
configurations = listOf()
}

View File

@ -1,28 +0,0 @@
plugins {
id 'jadx-library'
}
dependencies {
api(project(":jadx-plugins:jadx-input-api"))
implementation 'com.google.code.gson:gson:2.10.1'
// TODO: move resources decoding to separate plugin module
implementation 'com.android.tools.build:aapt2-proto:8.0.2-9289358'
implementation 'com.google.protobuf:protobuf-java:3.23.3' // forcing latest version
testImplementation 'org.apache.commons:commons-lang3:3.12.0'
testImplementation(project(':jadx-plugins:jadx-dex-input'))
testRuntimeOnly(project(':jadx-plugins:jadx-smali-input'))
testRuntimeOnly(project(':jadx-plugins:jadx-java-convert'))
testRuntimeOnly(project(':jadx-plugins:jadx-java-input'))
testRuntimeOnly(project(':jadx-plugins:jadx-raung-input'))
testImplementation 'org.eclipse.jdt:ecj:3.33.0' // from 3.34 compiled with Java 17
testImplementation 'tools.profiler:async-profiler:2.9'
}
test {
exclude '**/tmp/*'
}

View File

@ -0,0 +1,33 @@
plugins {
id("jadx-library")
}
dependencies {
api(project(":jadx-plugins:jadx-input-api"))
implementation("com.google.code.gson:gson:2.10.1")
// TODO: move resources decoding to separate plugin module
implementation("com.android.tools.build:aapt2-proto:8.0.2-9289358")
implementation("com.google.protobuf:protobuf-java:3.23.4") // forcing latest version
testImplementation("org.apache.commons:commons-lang3:3.12.0")
testImplementation(project(":jadx-plugins:jadx-dex-input"))
testRuntimeOnly(project(":jadx-plugins:jadx-smali-input"))
testRuntimeOnly(project(":jadx-plugins:jadx-java-convert"))
testRuntimeOnly(project(":jadx-plugins:jadx-java-input"))
testRuntimeOnly(project(":jadx-plugins:jadx-raung-input"))
testImplementation("org.eclipse.jdt:ecj") {
version {
prefer("3.33.0")
strictly("[3.33, 3.34[") // from 3.34 compiled with Java 17
}
}
testImplementation("tools.profiler:async-profiler:2.9")
}
tasks.test {
exclude("**/tmp/*")
}

View File

@ -1,166 +0,0 @@
plugins {
id 'jadx-kotlin'
id 'application'
id 'edu.sc.seis.launch4j' version '3.0.3'
id 'com.github.johnrengelman.shadow' version '8.1.1'
id 'org.beryx.runtime' version '1.13.0'
}
dependencies {
implementation(project(':jadx-core'))
implementation(project(':jadx-cli'))
implementation(project(':jadx-plugins-tools'))
// import mappings
implementation project(':jadx-plugins:jadx-rename-mappings')
// 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.8.22'
implementation 'com.fifesoft:autocomplete:3.3.1'
// use KtLint for format and check jadx scripts
implementation 'com.pinterest.ktlint:ktlint-core:0.49.1'
implementation 'com.pinterest.ktlint:ktlint-rule-engine:0.49.1'
implementation 'com.pinterest.ktlint:ktlint-ruleset-standard:0.49.1'
implementation 'com.beust:jcommander:1.82'
implementation 'ch.qos.logback:logback-classic:1.4.8'
implementation 'dev.dirs:directories:26'
implementation 'com.fifesoft:rsyntaxtextarea:3.3.3'
implementation files('libs/jfontchooser-1.0.5.jar')
implementation 'hu.kazocsaba:image-viewer:1.2.3'
implementation 'com.formdev:flatlaf:3.1.1'
implementation 'com.formdev:flatlaf-intellij-themes:3.1.1'
implementation 'com.formdev:flatlaf-extras:3.1.1'
implementation 'com.formdev:svgSalamander:1.1.4'
implementation 'com.google.code.gson:gson:2.10.1'
implementation 'org.apache.commons:commons-lang3:3.12.0'
implementation 'org.apache.commons:commons-text:1.10.0'
implementation 'io.reactivex.rxjava2:rxjava:2.2.21'
implementation "com.github.akarnokd:rxjava2-swing:0.3.7"
implementation 'com.android.tools.build:apksig:8.0.2'
implementation 'io.github.skylot:jdwp:2.0.0'
testImplementation project(":jadx-core").sourceSets.test.output
}
test {
exclude '**/tmp/*'
}
application {
applicationName = 'jadx-gui'
mainClass.set('jadx.gui.JadxGUI')
applicationDefaultJvmArgs = [
'-Xms128M', '-XX:MaxRAMPercentage=70.0',
'-XX:+UseG1GC', // only relevant for Java 8, starting with Java 9 G1GC is already the default GC
'-Dawt.useSystemAAFontSettings=lcd', '-Dswing.aatext=true',
'-Djava.util.Arrays.useLegacyMergeSort=true',
'-XX:+IgnoreUnrecognizedVMOptions', '--add-opens=java.base/java.lang=ALL-UNNAMED', // for ktlint formatter
]
}
applicationDistribution.with {
into('') {
from '../'
include 'README.md'
include 'NOTICE'
include 'LICENSE'
}
}
jar {
manifest {
attributes(
"Main-Class": application.mainClass.get(),
"Class-Path": configurations.runtimeClasspath.collect { it.getName() }.join(' ')
)
}
}
shadow {
mainClassName = application.mainClass.get()
}
shadowJar {
mergeServiceFiles()
}
startScripts {
doLast {
def str = windowsScript.text
str = str.replaceAll('java.exe', 'javaw.exe')
str = str.replaceAll('"%JAVA_EXE%" %DEFAULT_JVM_OPTS%', 'start "jadx-gui" /B "%JAVA_EXE%" %DEFAULT_JVM_OPTS%')
windowsScript.text = str
}
}
launch4j {
mainClassName = application.mainClass.get()
copyConfigurable = []
jarTask = project.tasks.shadowJar
icon = "${projectDir}/src/main/resources/logos/jadx-logo.ico"
outfile = "jadx-gui-${project.jadxVersion}.exe"
copyright = 'Skylot'
windowTitle = 'jadx'
companyName = 'jadx'
jreMinVersion = '11'
jvmOptions = application.getApplicationDefaultJvmArgs()
requires64Bit = true
initialHeapPercent = 5
maxHeapSize = 4096
maxHeapPercent = 70
downloadUrl = 'https://www.oracle.com/java/technologies/downloads/#jdk17-windows'
bundledJrePath = project.hasProperty("bundleJRE") ? '%EXEDIR%/jre' : '%JAVA_HOME%'
}
createExe.dependsOn(jar)
runtime {
addOptions('--strip-debug', '--compress', '2', '--no-header-files', '--no-man-pages')
addModules(
'java.desktop',
'java.naming',
'java.xml',
)
jpackage {
imageOptions = ['--icon', "${projectDir}/src/main/resources/logos/jadx-logo.ico"]
skipInstaller = true
targetPlatformName = "win"
}
launcher {
noConsole = true
}
}
task copyDistWinWithJre(type: Copy, dependsOn: ['runtime', 'createExe']) {
group 'jadx'
destinationDir = new File(buildDir, "jadx-gui-${jadxVersion}-with-jre-win")
from(runtime.jreDir) {
include '**/*'
into 'jre'
}
from(createExe.outputs) {
include '*.exe'
}
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
task distWinWithJre(type: Zip, dependsOn: ['copyDistWinWithJre']) {
group 'jadx'
destinationDirectory = buildDir
archiveFileName = "jadx-gui-${jadxVersion}-with-jre-win.zip"
from(copyDistWinWithJre.outputs) {
include '**/*'
}
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
task addNewNLSLines(type: JavaExec) {
classpath = sourceSets.main.runtimeClasspath
mainClass.set('jadx.gui.utils.tools.NLSAddNewLines')
}

164
jadx-gui/build.gradle.kts Normal file
View File

@ -0,0 +1,164 @@
plugins {
id("jadx-kotlin")
id("application")
id("edu.sc.seis.launch4j") version "3.0.3"
id("com.github.johnrengelman.shadow") version "8.1.1"
id("org.beryx.runtime") version "1.13.0"
}
dependencies {
implementation(project(":jadx-core"))
implementation(project(":jadx-cli"))
implementation(project(":jadx-plugins-tools"))
// import mappings
implementation(project(":jadx-plugins:jadx-rename-mappings"))
// 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.9.0")
implementation("com.fifesoft:autocomplete:3.3.1")
// use KtLint for format and check jadx scripts
implementation("com.pinterest.ktlint:ktlint-rule-engine:0.50.0")
implementation("com.pinterest.ktlint:ktlint-ruleset-standard:0.50.0")
implementation("com.beust:jcommander:1.82")
implementation("ch.qos.logback:logback-classic:1.4.8")
implementation("dev.dirs:directories:26")
implementation("com.fifesoft:rsyntaxtextarea:3.3.3")
implementation(files("libs/jfontchooser-1.0.5.jar"))
implementation("hu.kazocsaba:image-viewer:1.2.3")
implementation("com.formdev:flatlaf:3.1.1")
implementation("com.formdev:flatlaf-intellij-themes:3.1.1")
implementation("com.formdev:flatlaf-extras:3.1.1")
implementation("com.formdev:svgSalamander:1.1.4")
implementation("com.google.code.gson:gson:2.10.1")
implementation("org.apache.commons:commons-lang3:3.12.0")
implementation("org.apache.commons:commons-text:1.10.0")
implementation("io.reactivex.rxjava2:rxjava:2.2.21")
implementation("com.github.akarnokd:rxjava2-swing:0.3.7")
implementation("com.android.tools.build:apksig:8.0.2")
implementation("io.github.skylot:jdwp:2.0.0")
testImplementation(project(":jadx-core").dependencyProject.sourceSets.getByName("test").output)
}
val jadxVersion: String by rootProject.extra
tasks.test {
exclude("**/tmp/*")
}
application {
applicationName = ("jadx-gui")
mainClass.set("jadx.gui.JadxGUI")
applicationDefaultJvmArgs = listOf(
"-Xms128M",
"-XX:MaxRAMPercentage=70.0",
"-Dawt.useSystemAAFontSettings=lcd",
"-Dswing.aatext=true",
"-Djava.util.Arrays.useLegacyMergeSort=true",
"-XX:+IgnoreUnrecognizedVMOptions",
"--add-opens=java.base/java.lang=ALL-UNNAMED", // for ktlint formatter
)
applicationDistribution.from("$rootDir") {
include("README.md")
include("NOTICE")
include("LICENSE")
}
}
tasks.jar {
manifest {
attributes(mapOf("Main-Class" to application.mainClass.get()))
}
}
tasks.shadowJar {
mergeServiceFiles()
manifest {
from(project.tasks.jar.get().manifest)
}
}
tasks.existing(CreateStartScripts::class) {
doLast {
val newContent = windowsScript.readText()
.replace("java.exe", "javaw.exe")
.replace("\"%JAVA_EXE%\" %DEFAULT_JVM_OPTS%", "start \"jadx-gui\" /B \"%JAVA_EXE%\" %DEFAULT_JVM_OPTS%")
windowsScript.writeText(newContent)
}
}
launch4j {
mainClassName = application.mainClass.get()
copyConfigurable.set(listOf<Any>())
setJarTask(tasks.shadowJar.get())
icon = "$projectDir/src/main/resources/logos/jadx-logo.ico"
outfile = "jadx-gui-$jadxVersion.exe"
copyright = "Skylot"
windowTitle = "jadx"
companyName = "jadx"
jreMinVersion = "11"
jvmOptions = application.applicationDefaultJvmArgs.toSet()
requires64Bit = true
initialHeapPercent = 5
maxHeapSize = 4096
maxHeapPercent = 70
downloadUrl = "https://www.oracle.com/java/technologies/downloads/#jdk17-windows"
bundledJrePath = if (project.hasProperty("bundleJRE")) "%EXEDIR%/jre" else "%JAVA_HOME%"
}
runtime {
addOptions("--strip-debug", "--compress", "2", "--no-header-files", "--no-man-pages")
addModules(
"java.desktop",
"java.naming",
"java.xml",
)
jpackage {
imageOptions = listOf("--icon", "$projectDir/src/main/resources/logos/jadx-logo.ico")
skipInstaller = true
targetPlatformName = "win"
}
launcher {
noConsole = true
}
}
val copyDistWinWithJre by tasks.registering(Copy::class) {
group = "jadx"
dependsOn(tasks.named("runtime"), tasks.named("createExe"))
from(runtime.jreDir) {
include("**/*")
into("jre")
}
from(tasks.named("createExe").get().outputs) {
include("*.exe")
}
into(File(buildDir, "jadx-gui-$jadxVersion-with-jre-win"))
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
val distWinWithJre by tasks.registering(Zip::class) {
group = "jadx"
dependsOn(copyDistWinWithJre)
archiveFileName.set("jadx-gui-$jadxVersion-with-jre-win.zip")
from(copyDistWinWithJre.get().outputs) {
include("**/*")
}
into(buildDir)
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
val addNewNLSLines by tasks.registering(JavaExec::class) {
group = "jadx"
classpath = sourceSets.main.get().runtimeClasspath
mainClass.set("jadx.gui.utils.tools.NLSAddNewLines")
}

View File

@ -1,20 +0,0 @@
plugins {
id 'jadx-library'
}
dependencies {
api(project(":jadx-core"))
// TODO: finish own smali printer
implementation 'org.smali:baksmali:2.5.2'
// force latest version for smali
constraints {
implementation 'com.google.guava:guava:30.1.1-jre'
implementation 'com.beust:jcommander:1.81'
}
// compile smali files in tests
testImplementation('org.smali:smali:2.5.2') {
exclude(group: 'junit', module: 'junit') // ignore junit 4 transitive dependency
}
}

View File

@ -0,0 +1,20 @@
plugins {
id("jadx-library")
}
dependencies {
api(project(":jadx-core"))
// TODO: finish own smali printer
implementation("org.smali:baksmali:2.5.2")
// force latest version for smali
constraints {
implementation("com.google.guava:guava:30.1.1-jre")
implementation("com.beust:jcommander:1.81")
}
// compile smali files in tests
testImplementation("org.smali:smali:2.5.2") {
exclude(group = "junit", module = "junit") // ignore junit 4 transitive dependency
}
}

View File

@ -1,3 +0,0 @@
plugins {
id 'jadx-library'
}

View File

@ -0,0 +1,3 @@
plugins {
id("jadx-library")
}

View File

@ -1,13 +0,0 @@
plugins {
id 'jadx-library'
}
dependencies {
api(project(":jadx-core"))
implementation(project(":jadx-plugins:jadx-dex-input"))
implementation('com.jakewharton.android.repackaged:dalvik-dx:11.0.0_r3')
implementation('com.android.tools:r8:8.0.40')
implementation 'org.ow2.asm:asm:9.5'
}

View File

@ -0,0 +1,13 @@
plugins {
id("jadx-library")
}
dependencies {
api(project(":jadx-core"))
implementation(project(":jadx-plugins:jadx-dex-input"))
implementation("com.jakewharton.android.repackaged:dalvik-dx:11.0.0_r3")
implementation("com.android.tools:r8:8.0.40")
implementation("org.ow2.asm:asm:9.5")
}

View File

@ -1,12 +1,12 @@
plugins {
id 'jadx-library'
id("jadx-library")
}
dependencies {
api(project(":jadx-core"))
// show bytecode disassemble
implementation 'io.github.skylot:raung-disasm:0.1.0'
implementation("io.github.skylot:raung-disasm:0.1.0")
testImplementation(project(":jadx-core"))
}

View File

@ -1,5 +1,5 @@
plugins {
id 'jadx-library'
id("jadx-library")
}
dependencies {
@ -7,5 +7,5 @@ dependencies {
implementation(project(":jadx-plugins:jadx-java-input"))
implementation('io.github.skylot:raung-asm:0.1.0')
implementation("io.github.skylot:raung-asm:0.1.0")
}

View File

@ -1,7 +1,7 @@
plugins {
id 'jadx-library'
id("jadx-library")
id 'com.github.johnrengelman.shadow' version '8.1.1'
id("com.github.johnrengelman.shadow") version "8.1.1"
}
dependencies {
@ -10,17 +10,18 @@ dependencies {
// TODO: Switch back to upstream once this PR gets merged:
// https://github.com/FabricMC/mapping-io/pull/19
// implementation 'net.fabricmc:mapping-io:0.3.0'
api(files('libs/mapping-io-0.4.0-SNAPSHOT.jar'))
api(files("libs/mapping-io-0.4.0-SNAPSHOT.jar"))
constraints {
runtimeOnly 'org.ow2.asm:asm:9.5'
runtimeOnly("org.ow2.asm:asm:9.5")
}
}
publishing {
publications {
shadow(MavenPublication) { publication ->
project.shadow.component(publication)
create<MavenPublication>("maven") {
from(components["java"])
artifact(tasks["shadowJar"])
}
}
}

View File

@ -23,7 +23,7 @@ sourceSets {
kotlin.srcDirs(
"scripts",
"scripts/gui",
"context"
"context",
)
}
}

View File

@ -6,9 +6,9 @@ plugins {
dependencies {
implementation(project(":jadx-plugins:jadx-script:jadx-script-runtime"))
implementation(kotlin("scripting-common"))
implementation(kotlin("scripting-jvm"))
implementation(kotlin("scripting-jvm-host"))
implementation(kotlin("scripting-common"))
implementation(kotlin("scripting-jvm"))
implementation(kotlin("scripting-jvm-host"))
implementation("io.github.microutils:kotlin-logging-jvm:3.0.5")

View File

@ -22,5 +22,4 @@ dependencies {
runtimeOnly(project(":jadx-plugins:jadx-java-convert"))
runtimeOnly(project(":jadx-plugins:jadx-java-input"))
runtimeOnly(project(":jadx-plugins:jadx-raung-input"))
}

View File

@ -1,18 +0,0 @@
plugins {
id 'jadx-library'
}
dependencies {
api(project(":jadx-core"))
implementation(project(":jadx-plugins:jadx-dex-input"))
implementation('org.smali:smali:2.5.2') {
exclude(group: 'junit', module: 'junit') // ignore junit 4 transitive dependency
}
// force latest version for smali
constraints {
implementation 'com.google.guava:guava:30.1.1-jre'
implementation 'com.beust:jcommander:1.81'
}
}

View File

@ -0,0 +1,18 @@
plugins {
id("jadx-library")
}
dependencies {
api(project(":jadx-core"))
implementation(project(":jadx-plugins:jadx-dex-input"))
implementation("org.smali:smali:2.5.2") {
exclude(group = "junit", module = "junit") // ignore junit 4 transitive dependency
}
// force latest version for smali
constraints {
implementation("com.google.guava:guava:30.1.1-jre")
implementation("com.beust:jcommander:1.81")
}
}