chore: update gradle to 7.0, update dependencies, fix some build warnings

This commit is contained in:
Skylot 2021-04-15 12:37:44 +01:00
parent c28e8142f4
commit 012f7665aa
9 changed files with 54 additions and 31 deletions

View File

@ -11,14 +11,19 @@ stages:
java-8:
stage: test
image: openjdk:8
script: ./gradlew clean build dist
script: ./gradlew clean build dist --warning-mode=all
java-11:
stage: test
image: openjdk:11
script: ./gradlew clean build dist
script: ./gradlew clean build dist --warning-mode=all
java-15:
stage: test
image: openjdk:15
script: ./gradlew clean build dist --warning-mode=all
java-latest:
stage: test
image: openjdk:latest
script: java -version && ./gradlew clean build dist
script: java -version && ./gradlew clean build dist --warning-mode=all

View File

@ -1,6 +1,6 @@
plugins {
id 'com.github.ben-manes.versions' version '0.38.0'
id "com.diffplug.spotless" version "5.11.0"
id "com.diffplug.spotless" version "5.12.4"
}
ext.jadxVersion = System.getenv('JADX_VERSION') ?: "dev"
@ -38,7 +38,7 @@ allprojects {
testImplementation 'ch.qos.logback:logback-classic:1.2.3'
testImplementation 'org.hamcrest:hamcrest-library:2.2'
testImplementation 'org.mockito:mockito-core:3.8.0'
testImplementation 'org.mockito:mockito-core:3.9.0'
testImplementation 'org.assertj:assertj-core:3.19.0'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.1'
@ -75,7 +75,12 @@ spotless {
importOrderFile 'config/code-formatter/eclipse.importorder'
eclipse().configFile 'config/code-formatter/eclipse.xml'
removeUnusedImports()
if (JavaVersion.current() < JavaVersion.VERSION_16) {
removeUnusedImports()
} else {
// google-format broken on java 16 (https://github.com/diffplug/spotless/issues/834)
println('Warning! Unused imports remove is disabled for Java 16')
}
lineEndings(com.diffplug.spotless.LineEnding.UNIX)
encoding("UTF-8")
@ -108,32 +113,42 @@ dependencyUpdates {
}
}
task copyArtifacts(type: Sync, dependsOn: ['jadx-cli:installDist', 'jadx-gui:installDist']) {
destinationDir file("$buildDir/jadx")
['jadx-cli', 'jadx-gui'].each {
from tasks.getByPath(":${it}:installDist").destinationDir
}
task copyArtifacts(type: Copy) {
from tasks.getByPath(":jadx-cli:installDist")
from tasks.getByPath(":jadx-gui:installDist")
into layout.buildDirectory.dir("jadx")
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
task pack(type: Zip, dependsOn: copyArtifacts) {
destinationDirectory = buildDir
task pack(type: Zip) {
from copyArtifacts
archiveFileName = "jadx-${jadxVersion}.zip"
from copyArtifacts.destinationDir
destinationDirectory = layout.buildDirectory
}
task copyExe(type: Copy, dependsOn: 'jadx-gui:createExe') {
task copyExe(type: Copy) {
group 'jadx'
description = 'Copy exe to build dir'
destinationDir buildDir
from tasks.getByPath('jadx-gui:createExe').outputs
mustRunAfter pack // not needed, but gradle throws warning because of same output dir
from tasks.getByPath('jadx-gui:createExe')
include '*.exe'
into layout.buildDirectory
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
task dist(dependsOn: [pack, copyExe]) {
task dist {
group 'jadx'
description = 'Build jadx distribution zip'
dependsOn(pack)
if (JavaVersion.current() < JavaVersion.VERSION_16) {
dependsOn('copyExe')
} else {
// shadow jar plugin broken on java 16 (https://github.com/johnrengelman/shadow/issues/658)
tasks.getByPath(':jadx-gui:shadowJar').enabled = false
println('Warning! Build of jadx-gui.exe disabled for Java 16')
}
}
task samples(dependsOn: 'jadx-samples:samples') {

View File

@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionSha256Sum=e2774e6fb77c43657decde25542dea710aafd78c4022d19b196e7e78d79d8c6c
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8-bin.zip
distributionSha256Sum=eb8b89184261025b0430f5b2233701ff1377f96da1ef5e278af6ae8bac5cc305
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

View File

@ -15,7 +15,7 @@ dependencies {
application {
applicationName = 'jadx'
mainClassName = 'jadx.cli.JadxCLI'
mainClass.set('jadx.cli.JadxCLI')
applicationDefaultJvmArgs = ['-Xms128M', '-Xmx4g', '-XX:+UseG1GC']
}

View File

@ -6,7 +6,7 @@ dependencies {
api(project(':jadx-plugins:jadx-plugins-api'))
implementation 'com.google.code.gson:gson:2.8.6'
implementation 'com.android.tools.build:aapt2-proto:4.1.2-6503028'
implementation 'com.android.tools.build:aapt2-proto:4.1.3-6503028'
testImplementation 'org.apache.commons:commons-lang3:3.12.0'

View File

@ -1,6 +1,6 @@
plugins {
id 'application'
id 'edu.sc.seis.launch4j' version '2.4.9'
id 'edu.sc.seis.launch4j' version '2.5.0'
id 'com.github.johnrengelman.shadow' version '6.1.0'
}
@ -21,13 +21,13 @@ dependencies {
implementation 'io.reactivex.rxjava2:rxjava:2.2.21'
implementation "com.github.akarnokd:rxjava2-swing:0.3.7"
implementation 'com.android.tools.build:apksig:4.1.1'
implementation 'com.android.tools.build:apksig:4.1.3'
implementation 'io.github.hqktech:jdwp:1.0'
}
application {
applicationName = 'jadx-gui'
mainClassName = 'jadx.gui.JadxGUI'
mainClass.set('jadx.gui.JadxGUI')
}
applicationDistribution.with {
@ -42,12 +42,15 @@ applicationDistribution.with {
jar {
manifest {
attributes(
"Main-Class": mainClassName,
"Main-Class": application.mainClass.get(),
"Class-Path": configurations.runtimeClasspath.collect { it.getName() }.join(' ')
)
}
}
shadow {
mainClassName = application.mainClass.get()
}
shadowJar {
mergeServiceFiles()
}
@ -64,9 +67,9 @@ startScripts {
}
launch4j {
mainClassName = 'jadx.gui.JadxGUI'
mainClassName = application.mainClass.get()
copyConfigurable = project.tasks.shadowJar.outputs.files
jar = "lib/${project.tasks.shadowJar.archiveFileName.get()}"
jarTask = project.tasks.shadowJar
icon = "${projectDir}/src/main/resources/logos/jadx-logo.ico"
outfile = "jadx-gui-${version}.exe"
copyright = 'Skylot'

View File

@ -9,7 +9,7 @@ dependencies {
implementation 'org.smali:baksmali:2.5.2'
// force latest version for smali
constraints {
implementation 'com.google.guava:guava:30.1-jre'
implementation 'com.google.guava:guava:30.1.1-jre'
implementation 'com.beust:jcommander:1.81'
}

View File

@ -12,7 +12,7 @@ dependencies {
}
// force latest version for smali
constraints {
implementation 'com.google.guava:guava:30.1-jre'
implementation 'com.google.guava:guava:30.1.1-jre'
implementation 'com.beust:jcommander:1.81'
}
}

View File

@ -27,7 +27,7 @@ task samplesJar(type: Jar, dependsOn: samplesRun) {
task samplesJadxCreate(type: JavaExec, dependsOn: samplesJar) {
classpath = sourceSets.main.output + configurations.runtimeClasspath
main = project(":jadx-cli").mainClassName
main = project(":jadx-cli").application.mainClass.get()
args = ['-v', '-d', samplesJadxSrcDir, samplesJar.archiveFile.get()]
}