2017-05-26 08:31:56 +00:00
|
|
|
plugins {
|
2021-08-02 15:43:07 +00:00
|
|
|
id 'com.github.ben-manes.versions' version '0.39.0'
|
2021-12-24 12:53:30 +00:00
|
|
|
id 'com.diffplug.spotless' version '6.1.0'
|
2017-05-26 08:31:56 +00:00
|
|
|
}
|
|
|
|
|
2018-08-24 13:56:01 +00:00
|
|
|
ext.jadxVersion = System.getenv('JADX_VERSION') ?: "dev"
|
2014-11-29 11:52:32 +00:00
|
|
|
version = jadxVersion
|
2018-08-24 13:56:01 +00:00
|
|
|
println("jadx version: ${jadxVersion}")
|
2014-11-29 11:52:32 +00:00
|
|
|
|
2016-12-22 08:54:56 +00:00
|
|
|
allprojects {
|
2019-03-26 11:21:47 +00:00
|
|
|
apply plugin: 'java'
|
2019-04-29 21:04:16 +00:00
|
|
|
apply plugin: 'checkstyle'
|
2019-03-26 11:21:47 +00:00
|
|
|
|
|
|
|
version = jadxVersion
|
|
|
|
|
2020-07-05 15:46:37 +00:00
|
|
|
sourceCompatibility = JavaVersion.VERSION_1_8
|
|
|
|
targetCompatibility = JavaVersion.VERSION_1_8
|
|
|
|
|
2019-03-26 11:21:47 +00:00
|
|
|
compileJava {
|
|
|
|
options.encoding = "UTF-8"
|
|
|
|
}
|
|
|
|
|
|
|
|
jar {
|
|
|
|
manifest {
|
|
|
|
mainAttributes('jadx-version': jadxVersion)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
2021-08-02 15:43:07 +00:00
|
|
|
implementation 'org.slf4j:slf4j-api:1.7.32'
|
2021-11-11 11:12:21 +00:00
|
|
|
compileOnly 'org.jetbrains:annotations:23.0.0'
|
2019-03-26 11:21:47 +00:00
|
|
|
|
2021-12-24 12:53:30 +00:00
|
|
|
testImplementation 'ch.qos.logback:logback-classic:1.2.10'
|
2020-07-11 11:51:38 +00:00
|
|
|
testImplementation 'org.hamcrest:hamcrest-library:2.2'
|
2021-12-24 12:53:30 +00:00
|
|
|
testImplementation 'org.mockito:mockito-core:4.2.0'
|
2021-10-17 18:53:01 +00:00
|
|
|
testImplementation 'org.assertj:assertj-core:3.21.0'
|
2019-03-26 11:21:47 +00:00
|
|
|
|
2021-12-10 18:30:31 +00:00
|
|
|
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2'
|
|
|
|
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.2'
|
2019-03-29 11:05:22 +00:00
|
|
|
|
2020-07-11 11:51:38 +00:00
|
|
|
testImplementation 'org.eclipse.jdt.core.compiler:ecj:4.6.1'
|
2021-11-11 11:12:21 +00:00
|
|
|
testCompileOnly 'org.jetbrains:annotations:23.0.0'
|
2019-03-26 11:21:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
test {
|
|
|
|
useJUnitPlatform()
|
|
|
|
}
|
|
|
|
|
|
|
|
repositories {
|
|
|
|
mavenLocal()
|
|
|
|
mavenCentral()
|
|
|
|
google()
|
|
|
|
}
|
2014-04-29 19:15:30 +00:00
|
|
|
}
|
|
|
|
|
2019-04-29 21:04:16 +00:00
|
|
|
spotless {
|
|
|
|
java {
|
|
|
|
target fileTree(rootDir).matching {
|
|
|
|
include 'jadx-cli/src/**/java/**/*.java'
|
|
|
|
include 'jadx-core/src/**/java/**/*.java'
|
|
|
|
include 'jadx-gui/src/**/java/**/*.java'
|
2020-04-29 16:24:44 +00:00
|
|
|
include 'jadx-plugins/**/java/**/*.java'
|
2019-04-29 21:04:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
importOrderFile 'config/code-formatter/eclipse.importorder'
|
|
|
|
eclipse().configFile 'config/code-formatter/eclipse.xml'
|
2021-04-15 11:37:44 +00:00
|
|
|
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')
|
|
|
|
}
|
2019-04-29 21:04:16 +00:00
|
|
|
|
2019-10-17 17:23:44 +00:00
|
|
|
lineEndings(com.diffplug.spotless.LineEnding.UNIX)
|
2019-04-29 21:04:16 +00:00
|
|
|
encoding("UTF-8")
|
|
|
|
trimTrailingWhitespace()
|
|
|
|
endWithNewline()
|
|
|
|
}
|
|
|
|
format 'misc', {
|
|
|
|
target '**/*.gradle', '**/*.md', '**/*.xml', '**/.gitignore', '**/.properties'
|
2020-05-13 17:46:58 +00:00
|
|
|
targetExclude ".gradle/**", ".idea/**", "*/build/**"
|
2019-04-29 21:04:16 +00:00
|
|
|
|
2019-10-17 17:23:44 +00:00
|
|
|
lineEndings(com.diffplug.spotless.LineEnding.UNIX)
|
2019-04-29 21:04:16 +00:00
|
|
|
encoding("UTF-8")
|
|
|
|
trimTrailingWhitespace()
|
|
|
|
endWithNewline()
|
|
|
|
}
|
2017-05-27 09:05:27 +00:00
|
|
|
}
|
|
|
|
|
2020-07-11 11:51:38 +00:00
|
|
|
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')
|
|
|
|
}
|
2019-03-26 11:21:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2018-02-10 19:56:53 +00:00
|
|
|
}
|
|
|
|
|
2021-04-15 11:37:44 +00:00
|
|
|
task copyArtifacts(type: Copy) {
|
|
|
|
from tasks.getByPath(":jadx-cli:installDist")
|
|
|
|
from tasks.getByPath(":jadx-gui:installDist")
|
|
|
|
into layout.buildDirectory.dir("jadx")
|
2020-07-11 11:51:38 +00:00
|
|
|
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
2013-07-24 13:05:31 +00:00
|
|
|
}
|
|
|
|
|
2021-04-15 11:37:44 +00:00
|
|
|
task pack(type: Zip) {
|
|
|
|
from copyArtifacts
|
2020-07-11 11:51:38 +00:00
|
|
|
archiveFileName = "jadx-${jadxVersion}.zip"
|
2021-04-15 11:37:44 +00:00
|
|
|
destinationDirectory = layout.buildDirectory
|
2013-07-24 13:05:31 +00:00
|
|
|
}
|
|
|
|
|
2021-04-15 11:37:44 +00:00
|
|
|
task copyExe(type: Copy) {
|
2019-03-26 11:21:47 +00:00
|
|
|
group 'jadx'
|
|
|
|
description = 'Copy exe to build dir'
|
2021-04-15 11:37:44 +00:00
|
|
|
mustRunAfter pack // not needed, but gradle throws warning because of same output dir
|
|
|
|
|
|
|
|
from tasks.getByPath('jadx-gui:createExe')
|
2019-03-26 11:21:47 +00:00
|
|
|
include '*.exe'
|
2021-04-15 11:37:44 +00:00
|
|
|
into layout.buildDirectory
|
2020-07-11 11:51:38 +00:00
|
|
|
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
2018-03-27 15:55:33 +00:00
|
|
|
}
|
|
|
|
|
2021-11-20 20:24:30 +00:00
|
|
|
task distWinBundle(type: Copy, dependsOn: 'jadx-gui:distWinWithJre') {
|
|
|
|
group 'jadx'
|
|
|
|
description = 'Copy bundle to build dir'
|
|
|
|
destinationDir buildDir
|
|
|
|
from(tasks.getByPath('jadx-gui:distWinWithJre').outputs) {
|
|
|
|
include '*.zip'
|
|
|
|
}
|
|
|
|
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
|
|
|
}
|
|
|
|
|
2021-04-15 11:37:44 +00:00
|
|
|
task dist {
|
2019-03-26 11:21:47 +00:00
|
|
|
group 'jadx'
|
|
|
|
description = 'Build jadx distribution zip'
|
2021-04-15 11:37:44 +00:00
|
|
|
|
|
|
|
dependsOn(pack)
|
2021-05-27 14:41:34 +00:00
|
|
|
|
|
|
|
OperatingSystem os = org.gradle.nativeplatform.platform.internal.DefaultNativePlatform.currentOperatingSystem;
|
|
|
|
if (os.isWindows()) {
|
2021-11-20 20:24:30 +00:00
|
|
|
if (project.hasProperty("bundleJRE")) {
|
|
|
|
println("Build win bundle with JRE")
|
|
|
|
dependsOn('distWinBundle')
|
|
|
|
} else {
|
|
|
|
dependsOn('copyExe')
|
|
|
|
}
|
2020-11-14 15:54:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-11-29 11:52:32 +00:00
|
|
|
task cleanBuildDir(type: Delete) {
|
2019-03-26 11:21:47 +00:00
|
|
|
group 'jadx'
|
|
|
|
delete buildDir
|
2013-07-24 13:05:31 +00:00
|
|
|
}
|
|
|
|
|
2014-11-29 11:52:32 +00:00
|
|
|
clean.dependsOn(cleanBuildDir)
|