-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
107 lines (90 loc) · 2.71 KB
/
build.gradle.kts
File metadata and controls
107 lines (90 loc) · 2.71 KB
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
import java.io.ByteArrayOutputStream
val version = "3.0.2"
val suffix = "SNAPSHOT"
// Strings embedded into the build.
var gitRevision by extra("")
var apktoolVersion by extra("")
defaultTasks("build", "shadowJar", "proguard")
// Functions
val gitDescribe: String? by lazy {
try {
val result = providers.exec {
commandLine("git", "describe", "--tags")
}
result.standardOutput.asText.get().trim().replace("-g", "-")
} catch (e: Exception) {
null
}
}
val gitBranch: String? by lazy {
try {
val result = providers.exec {
commandLine("git", "rev-parse", "--abbrev-ref", "HEAD")
}
result.standardOutput.asText.get().trim()
} catch (e: Exception) {
null
}
}
if ("release" !in gradle.startParameter.taskNames) {
val hash = gitDescribe
if (hash == null) {
gitRevision = "dirty"
apktoolVersion = "$version-dirty"
project.logger.lifecycle("Building SNAPSHOT (no .git folder found)")
} else {
gitRevision = hash
apktoolVersion = "$hash-SNAPSHOT"
project.logger.lifecycle("Building SNAPSHOT ($gitBranch): $gitRevision")
}
} else {
gitRevision = ""
apktoolVersion = if (suffix.isNotEmpty()) "$version-$suffix" else version;
project.logger.lifecycle("Building RELEASE ($gitBranch): $apktoolVersion")
}
plugins {
`java-library`
if (JavaVersion.current().isJava11Compatible) {
alias(libs.plugins.vanniktech.maven.publish) apply false
}
}
allprojects {
repositories {
mavenCentral()
// Obtain baksmali/smali from source builds - https://github.com/iBotPeaches/smali
// Remove when official smali releases come out again.
maven {
url = uri("https://jitpack.io")
content {
includeGroup("com.github.iBotPeaches.smali")
}
}
google()
}
}
subprojects {
apply(plugin = "java")
apply(plugin = "java-library")
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
val mavenProjects = arrayOf(
"brut.j.common", "brut.j.util", "brut.j.dir", "brut.j.xml", "brut.j.yaml",
"apktool-lib", "apktool-cli"
)
if (project.name in mavenProjects && JavaVersion.current().isJava11Compatible) {
apply(from = "${rootProject.projectDir}/gradle/scripts/publishing.gradle")
}
}
tasks.register("release") {
// Used for official releases.
}
tasks.wrapper {
distributionType = Wrapper.DistributionType.ALL
}
tasks.withType<JavaCompile> {
options.compilerArgs.add("-Xlint:-options")
options.compilerArgs.add("--release 8")
options.encoding = "UTF-8"
}