forked from google/bundletool
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
executable file
·195 lines (170 loc) · 6.11 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
184
185
186
187
188
189
190
191
192
193
194
195
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
buildscript {
repositories {
jcenter()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "com.google.protobuf:protobuf-gradle-plugin:0.8.8"
classpath "com.github.jengelman.gradle.plugins:shadow:4.0.4"
}
}
apply plugin: "com.github.johnrengelman.shadow"
apply plugin: "com.google.protobuf"
apply plugin: "java"
apply plugin: "maven"
repositories {
mavenLocal()
jcenter()
google()
maven {
url "https://storage.googleapis.com/r8-releases/raw"
}
}
configurations {
compileWindows
compileMacOs
compileLinux
}
// The repackaging rules are defined in the "shadowJar" task below.
dependencies {
compile "com.android.tools:r8:1.6.51"
compile "com.android.tools.build:apkzlib:3.4.0-beta01"
compile "com.android.tools.ddms:ddmlib:26.2.0"
shadow "com.android.tools.build:aapt2-proto:0.4.0"
shadow "com.google.auto.value:auto-value-annotations:1.6.2"
annotationProcessor "com.google.auto.value:auto-value:1.6.2"
shadow "com.google.errorprone:error_prone_annotations:2.3.1"
shadow "com.google.guava:guava:27.0.1-jre"
shadow "com.google.protobuf:protobuf-java:3.4.0"
shadow "com.google.protobuf:protobuf-java-util:3.4.0"
compileWindows "com.android.tools.build:aapt2:3.5.0-alpha03-5252756:windows"
compileMacOs "com.android.tools.build:aapt2:3.5.0-alpha03-5252756:osx"
compileLinux "com.android.tools.build:aapt2:3.5.0-alpha03-5252756:linux"
testCompile "com.android.tools.build:aapt2-proto:0.4.0"
testCompile "com.google.auto.value:auto-value-annotations:1.6.2"
testAnnotationProcessor "com.google.auto.value:auto-value:1.6.2"
testCompile "com.google.errorprone:error_prone_annotations:2.3.1"
testCompile "com.google.guava:guava:27.0.1-jre"
testCompile "com.google.truth.extensions:truth-java8-extension:0.45"
testCompile "com.google.truth.extensions:truth-proto-extension:0.45"
testCompile "com.google.jimfs:jimfs:1.1"
testCompile "com.google.protobuf:protobuf-java:3.4.0"
testCompile "com.google.protobuf:protobuf-java-util:3.4.0"
testCompile "org.mockito:mockito-core:2.18.3"
testCompile "junit:junit:4.12"
testCompile "org.junit.jupiter:junit-jupiter-api:5.2.0"
testCompile "org.junit.vintage:junit-vintage-engine:5.2.0"
testRuntime "org.junit.jupiter:junit-jupiter-engine:5.2.0"
testCompile "org.junit.platform:junit-platform-runner:1.2.0"
}
def osName = System.getProperty("os.name").toLowerCase()
// Use utf-8 instead of the platform default encoding.
compileJava.options.encoding = "UTF-8"
compileTestJava.options.encoding = "UTF-8"
test {
if (osName.contains("linux")) {
environment "AAPT2_PATH", "build/resources/main/linux/aapt2"
}
if (osName.contains("windows")) {
environment "AAPT2_PATH", 'build/resources/main/windows/aapt2'
}
if (osName.contains("mac")) {
environment "AAPT2_PATH", 'build/resources/main/macos/aapt2'
}
testLogging {
events "passed", "skipped", "failed"
showStandardStreams = true
}
reports {
html.enabled = false
}
}
protobuf {
protoc {
artifact = "com.google.protobuf:protoc:3.4.0"
}
}
uploadShadow {
repositories {
mavenDeployer {
def localRepo = project.hasProperty('localRepo') ?
project.localRepo : "$buildDir/repo"
repository(url: "file://" + localRepo)
pom.project {
groupId 'com.android.tools.build'
artifactId 'bundletool'
version project.release_version
licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution 'repo'
}
}
}
}
}
}
// Artifact released to Maven.
shadowJar {
baseName = 'bundletool'
classifier = ''
// Package all the Android Gradle plugin dependencies that are compiled from
// source.
dependencies {
include(dependency {
it.moduleGroup.startsWith('com.android.tools')
})
}
relocate('com.android', 'shadow.bundletool.com.android') {
// BundleTool classes.
exclude 'com.android.tools.build.bundletool.**'
// Bundle protos.
exclude 'com.android.bundle.**'
// Aapt protos.
exclude 'com.android.aapt.**'
// String constants in classes.
// For some reason, the Shadow plug-in seems to rename strings in classes too!
exclude 'com.android.vending.splits'
exclude 'com.android.vending.splits.required'
exclude 'com.android.dynamic.apk.fused.modules'
}
}
// Artifact to use as standalone command line tool.
task executableJar(type: ShadowJar) {
baseName = 'bundletool'
classifier = 'all'
from sourceSets.main.output
from({ zipTree(project.configurations.compileWindows.singleFile) }) { into 'windows/' }
from({ zipTree(project.configurations.compileMacOs.singleFile) }) { into 'macos/' }
from({ zipTree(project.configurations.compileLinux.singleFile) }) { into 'linux/' }
configurations = [
project.configurations.runtime,
project.configurations.shadow
]
manifest {
attributes 'Main-Class': 'com.android.tools.build.bundletool.BundleToolMain'
}
exclude 'META-INF/*.SF'
exclude 'META-INF/*.DSA'
exclude 'META-INF/*.RSA'
}
// Unzip the aapt2 dependency jar.
task unzipAapt2Jar(type: Copy) {
if (osName.contains("linux")) {
from zipTree(project.configurations.compileLinux.singleFile)
into('build/resources/main/linux')
}
if (osName.contains("windows")) {
from zipTree(project.configurations.compileWindows.singleFile)
into('build/resources/main/windows')
}
if (osName.contains("mac")) {
from zipTree(project.configurations.compileMacOs.singleFile)
into('build/resources/main/macos')
}
}
compileTestJava.dependsOn(unzipAapt2Jar)