From c616b5b03b1b29f370d2d003d8de5619b344ffb0 Mon Sep 17 00:00:00 2001 From: Skylot Date: Sat, 11 Jul 2020 12:51:38 +0100 Subject: [PATCH] build: resolve gradle deprecation warnings --- build.gradle | 39 +++++++++++++++++++++------------------ jadx-cli/build.gradle | 10 +++++----- jadx-core/build.gradle | 18 +++++++++--------- jadx-gui/build.gradle | 28 ++++++++++++++++------------ jadx-samples/build.gradle | 16 ++++++++-------- 5 files changed, 59 insertions(+), 52 deletions(-) diff --git a/build.gradle b/build.gradle index 4fd689171..2133cbbb0 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,7 @@ plugins { id 'org.sonarqube' version '3.0' id 'com.github.ben-manes.versions' version '0.28.0' - id "com.diffplug.gradle.spotless" version "4.5.0" + id "com.diffplug.gradle.spotless" version "4.5.1" } ext.jadxVersion = System.getenv('JADX_VERSION') ?: "dev" @@ -29,25 +29,24 @@ allprojects { } jar { - version = jadxVersion manifest { mainAttributes('jadx-version': jadxVersion) } } dependencies { - compile 'org.slf4j:slf4j-api:1.7.30' + implementation 'org.slf4j:slf4j-api:1.7.30' compileOnly 'org.jetbrains:annotations:19.0.0' - testCompile 'ch.qos.logback:logback-classic:1.2.3' - testCompile 'org.hamcrest:hamcrest-library:2.2' - testCompile 'org.mockito:mockito-core:3.3.3' - testCompile 'org.assertj:assertj-core:3.16.1' + testImplementation 'ch.qos.logback:logback-classic:1.2.3' + testImplementation 'org.hamcrest:hamcrest-library:2.2' + testImplementation 'org.mockito:mockito-core:3.4.0' + testImplementation 'org.assertj:assertj-core:3.16.1' testImplementation 'org.junit.jupiter:junit-jupiter-api:5.6.2' testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.6.2' - testCompile 'org.eclipse.jdt.core.compiler:ecj:4.6.1' + testImplementation 'org.eclipse.jdt.core.compiler:ecj:4.6.1' testCompileOnly 'org.jetbrains:annotations:19.0.0' } @@ -114,14 +113,16 @@ spotless { } } -dependencyUpdates.resolutionStrategy = { - componentSelection { rules -> - rules.all { ComponentSelection selection -> - boolean rejected = ['alpha', 'beta', 'rc', 'cr', 'm', 'atlassian'].any { qualifier -> - selection.candidate.version ==~ /(?i).*[.-]${qualifier}[.\d-]*/ - } - if (rejected) { - selection.reject('Release candidate') +dependencyUpdates { + resolutionStrategy { + componentSelection { rules -> + rules.all { ComponentSelection selection -> + boolean rejected = ['alpha', 'beta', 'rc', 'cr', 'm', 'atlassian'].any { qualifier -> + selection.candidate.version ==~ /(?i).*[.-]${qualifier}[.\d-]*/ + } + if (rejected) { + selection.reject('Release candidate') + } } } } @@ -132,11 +133,12 @@ task copyArtifacts(type: Sync, dependsOn: ['jadx-cli:installDist', 'jadx-gui:ins ['jadx-cli', 'jadx-gui'].each { from tasks.getByPath(":${it}:installDist").destinationDir } + duplicatesStrategy = DuplicatesStrategy.EXCLUDE } task pack(type: Zip, dependsOn: copyArtifacts) { - destinationDir buildDir - archiveName "jadx-${jadxVersion}.zip" + destinationDirectory = buildDir + archiveFileName = "jadx-${jadxVersion}.zip" from copyArtifacts.destinationDir } @@ -146,6 +148,7 @@ task copyExe(type: Copy, dependsOn: 'jadx-gui:createExe') { destinationDir buildDir from tasks.getByPath('jadx-gui:createExe').outputs include '*.exe' + duplicatesStrategy = DuplicatesStrategy.EXCLUDE } task dist(dependsOn: [pack, copyExe]) { diff --git a/jadx-cli/build.gradle b/jadx-cli/build.gradle index 25eeed8ec..b528d2e23 100644 --- a/jadx-cli/build.gradle +++ b/jadx-cli/build.gradle @@ -3,13 +3,13 @@ plugins { } dependencies { - compile(project(':jadx-core')) + implementation(project(':jadx-core')) - runtime(project(':jadx-plugins:jadx-dex-input')) - runtime(project(':jadx-plugins:jadx-java-convert')) + runtimeOnly(project(':jadx-plugins:jadx-dex-input')) + runtimeOnly(project(':jadx-plugins:jadx-java-convert')) - compile 'com.beust:jcommander:1.78' - compile 'ch.qos.logback:logback-classic:1.2.3' + implementation 'com.beust:jcommander:1.78' + implementation 'ch.qos.logback:logback-classic:1.2.3' } application { diff --git a/jadx-core/build.gradle b/jadx-core/build.gradle index 5312202d7..8b77bcb14 100644 --- a/jadx-core/build.gradle +++ b/jadx-core/build.gradle @@ -3,23 +3,23 @@ plugins { } dependencies { - runtime files('clsp-data/android-29-clst.jar') - runtime files('clsp-data/android-29-res.jar') + runtimeOnly files('clsp-data/android-29-clst.jar') + runtimeOnly files('clsp-data/android-29-res.jar') api(project(':jadx-plugins:jadx-plugins-api')) - compile 'com.google.code.gson:gson:2.8.6' + implementation 'com.google.code.gson:gson:2.8.6' - compile 'org.smali:baksmali:2.4.0' - compile('org.smali:smali:2.4.0') { + implementation 'org.smali:baksmali:2.4.0' + implementation('org.smali:smali:2.4.0') { exclude group: 'com.google.guava' } - compile 'com.google.guava:guava:29.0-jre' + implementation 'com.google.guava:guava:29.0-jre' - testCompile 'org.apache.commons:commons-lang3:3.10' + testImplementation 'org.apache.commons:commons-lang3:3.10' - testRuntime(project(':jadx-plugins:jadx-dex-input')) - testRuntime(project(':jadx-plugins:jadx-java-convert')) + testRuntimeOnly(project(':jadx-plugins:jadx-dex-input')) + testRuntimeOnly(project(':jadx-plugins:jadx-java-convert')) } test { diff --git a/jadx-gui/build.gradle b/jadx-gui/build.gradle index 54ce4c943..551a78868 100644 --- a/jadx-gui/build.gradle +++ b/jadx-gui/build.gradle @@ -5,19 +5,23 @@ plugins { } dependencies { - compile(project(":jadx-core")) - compile(project(":jadx-cli")) + implementation(project(':jadx-core')) - compile 'com.fifesoft:rsyntaxtextarea:3.1.1' - compile files('libs/jfontchooser-1.0.5.jar') - compile 'hu.kazocsaba:image-viewer:1.2.3' + implementation(project(":jadx-cli")) + implementation 'com.beust:jcommander:1.78' + implementation 'ch.qos.logback:logback-classic:1.2.3' - compile 'org.apache.commons:commons-lang3:3.10' - compile 'org.apache.commons:commons-text:1.8' + implementation 'com.fifesoft:rsyntaxtextarea:3.1.1' + implementation files('libs/jfontchooser-1.0.5.jar') + implementation 'hu.kazocsaba:image-viewer:1.2.3' - compile 'io.reactivex.rxjava2:rxjava:2.2.19' - compile "com.github.akarnokd:rxjava2-swing:0.3.7" - compile 'com.android.tools.build:apksig:4.0.0' + implementation 'com.google.code.gson:gson:2.8.6' + implementation 'org.apache.commons:commons-lang3:3.10' + implementation 'org.apache.commons:commons-text:1.8' + + implementation 'io.reactivex.rxjava2:rxjava:2.2.19' + implementation "com.github.akarnokd:rxjava2-swing:0.3.7" + implementation 'com.android.tools.build:apksig:4.0.0' } application { @@ -38,7 +42,7 @@ jar { manifest { attributes( "Main-Class": mainClassName, - "Class-Path": configurations.compile.collect { it.getName() }.join(' ') + "Class-Path": configurations.runtimeClasspath.collect { it.getName() }.join(' ') ) } } @@ -61,7 +65,7 @@ startScripts { launch4j { mainClassName = 'jadx.gui.JadxGUI' copyConfigurable = project.tasks.shadowJar.outputs.files - jar = "lib/${project.tasks.shadowJar.archiveName}" + jar = "lib/${project.tasks.shadowJar.archiveFileName.get()}" icon = "${projectDir}/src/main/resources/logos/jadx-logo.ico" outfile = "jadx-gui-${version}.exe" copyright = 'Skylot' diff --git a/jadx-samples/build.gradle b/jadx-samples/build.gradle index f10f2fc69..0b696316a 100644 --- a/jadx-samples/build.gradle +++ b/jadx-samples/build.gradle @@ -1,11 +1,11 @@ project.ext { - mainSamplesClass = "jadx.samples.RunTests" + mainSamplesClass = 'jadx.samples.RunTests' samplesJadxSrcDir = "${buildDir}/samples-jadx/src" samplesJadxOutDir = "${buildDir}/samples-jadx/output" } dependencies { - compile(project(":jadx-cli")) + implementation(project(":jadx-cli")) } compileJava { @@ -21,25 +21,25 @@ task samplesRun(type: JavaExec, dependsOn: compileJava) { } task samplesJar(type: Jar, dependsOn: samplesRun) { - baseName = 'samples' + archivesBaseName = 'samples' from sourceSets.main.output } task samplesJadxCreate(type: JavaExec, dependsOn: samplesJar) { - classpath = sourceSets.main.output + configurations.compile + classpath = sourceSets.main.output + configurations.runtimeClasspath main = project(":jadx-cli").mainClassName - args = ['-v', '-d', samplesJadxSrcDir, samplesJar.archivePath] + args = ['-v', '-d', samplesJadxSrcDir, samplesJar.archiveFile.get()] } task samplesJadxCompile(type: JavaCompile, dependsOn: samplesJadxCreate) { - classpath = configurations.compile - destinationDir = file samplesJadxOutDir + classpath = configurations.runtimeClasspath + destinationDir = file(samplesJadxOutDir) source = samplesJadxSrcDir options.encoding = "UTF-8" } task samplesJadxRun(type: JavaExec, dependsOn: samplesJadxCompile) { - classpath = files samplesJadxOutDir + classpath = files(samplesJadxOutDir) main = mainSamplesClass }