forked from skylot/jadx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
183 lines (154 loc) · 4.59 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
//file:noinspection UnnecessaryQualifiedReference
plugins {
id 'com.github.ben-manes.versions' version '0.46.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.7'
testImplementation 'org.hamcrest:hamcrest-library:2.2'
testImplementation 'org.mockito:mockito-core:5.3.1'
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)