blob: c734ad5355c35372a4006ce5b3e445bd5e85462a [file] [log] [blame]
Mads Ager418d1ca2017-05-22 09:35:49 +02001// Copyright (c) 2016, the R8 project authors. Please see the AUTHORS file
2// for details. All rights reserved. Use of this source code is governed by a
3// BSD-style license that can be found in the LICENSE file.
Jean-Marie Henaff34d85f72017-06-14 10:32:04 +02004import org.gradle.internal.os.OperatingSystem
Stephan Herhut417a72a2017-07-18 10:38:30 +02005import utils.Utils
Mads Ager418d1ca2017-05-22 09:35:49 +02006
7apply plugin: 'java'
8apply plugin: 'idea'
Stephan Herhut417a72a2017-07-18 10:38:30 +02009apply plugin: 'com.google.protobuf'
Yohann Roussel7f47c032017-09-14 12:19:06 +020010apply plugin: 'com.cookpad.android.licensetools'
Mads Ager418d1ca2017-05-22 09:35:49 +020011
12apply from: 'copyAdditionalJctfCommonFiles.gradle'
13
Sebastien Hertze2687b62017-07-25 11:16:04 +020014
15if (project.hasProperty('with_code_coverage')) {
16 apply plugin: 'jacoco'
17}
18
Mads Ager418d1ca2017-05-22 09:35:49 +020019repositories {
Yohann Roussel126f6872017-08-03 16:25:32 +020020 maven { url 'https://maven.google.com' }
Mads Ager418d1ca2017-05-22 09:35:49 +020021 mavenCentral()
22}
23
Stephan Herhut417a72a2017-07-18 10:38:30 +020024buildscript {
25 repositories {
26 mavenCentral()
mikaelpeltier80939312017-08-17 15:00:09 +020027 jcenter()
Stephan Herhut417a72a2017-07-18 10:38:30 +020028 }
29 dependencies {
30 classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.1'
Yohann Roussel7f47c032017-09-14 12:19:06 +020031 classpath 'com.cookpad.android.licensetools:license-tools-plugin:0.23.0'
Mads Ager1d5ae402017-09-22 12:30:56 +020032 // TODO(ager): shadow does not support java9 class files yet. Once it does,
33 // we should use the offial version instead of our fork using ASM 6.0 to
34 // support java9.
35 // classpath 'com.github.jengelman.gradle.plugins:shadow:2.0.1'
36 classpath files("third_party/shadow/shadow-2.0.1.jar")
Stephan Herhut417a72a2017-07-18 10:38:30 +020037 }
38}
39
Mads Ager418d1ca2017-05-22 09:35:49 +020040// Custom source set for example tests and generated tests.
41sourceSets {
42 test {
43 java {
44 srcDirs = [
45 'src/test/java',
46 'build/generated/test/java',
47 ]
48 }
49 }
50 debugTestResources {
51 java {
52 srcDirs = ['src/test/debugTestResources']
53 }
54 output.resourcesDir = 'build/classes/debugTestResources'
55 }
Sebastien Hertz964c5c22017-05-23 15:22:23 +020056 debugTestResourcesJava8 {
57 java {
58 srcDirs = ['src/test/debugTestResourcesJava8']
59 }
60 output.resourcesDir = 'build/classes/debugTestResourcesJava8'
61 }
Sebastien Hertz1d7702b2017-08-18 09:07:27 +020062 debugTestResourcesKotlin {
63 java {
64 srcDirs = ['src/test/debugTestResourcesKotlin']
65 }
66 output.resourcesDir = 'build/classes/debugTestResourcesKotlin'
67 }
Mads Ager418d1ca2017-05-22 09:35:49 +020068 examples {
69 java {
Stephan Herhut417a72a2017-07-18 10:38:30 +020070 srcDirs = ['src/test/examples', 'build/generated/source/proto/examples/javalite/' ]
71 }
72 proto {
73 srcDirs = [
74 'src/test/examples',
75 ]
Mads Ager418d1ca2017-05-22 09:35:49 +020076 }
77 output.resourcesDir = 'build/classes/examples'
78 }
79 examplesAndroidN {
80 java {
81 srcDirs = ['src/test/examplesAndroidN']
82 }
83 output.resourcesDir = 'build/classes/examplesAndroidN'
84 }
85 examplesAndroidO {
86 java {
87 srcDirs = ['src/test/examplesAndroidO']
88 }
89 output.resourcesDir = 'build/classes/examplesAndroidO'
90 }
91 jctfCommon {
92 java {
93 srcDirs = [
94 'third_party/jctf/Harness/src',
95 'third_party/jctf/LibTests/src/com/google/jctf/test/categories',
96 'third_party/jctf/LibTests/src/com/google/jctf/test/helper',
97 'third_party/jctf/LibTests/src/com/google/jctf/testHelpers',
98 'third_party/jctf/LibTests/src/org',
99 'build/additionalJctfCommonFiles'
100 ]
101 }
102 resources {
103 srcDirs = ['third_party/jctf/LibTests/resources']
104 }
105 }
106 jctfTests {
107 java {
108 srcDirs = [
109 'third_party/jctf/LibTests/src/com/google/jctf/test/lib',
110 // 'third_party/jctf/VMTests/src',
111 ]
112 }
113 }
114}
115
Yohann Roussel126f6872017-08-03 16:25:32 +0200116configurations {
117 supportLibs
118}
119
Mads Ager418d1ca2017-05-22 09:35:49 +0200120dependencies {
121 compile 'net.sf.jopt-simple:jopt-simple:4.6'
Mads Agercd06c802017-08-22 13:44:34 +0200122 compile 'com.googlecode.json-simple:json-simple:1.1'
Mads Ager0aa48052017-09-15 12:39:15 +0200123 // Include all of guava when compiling the code, but exclude annotations that we don't
124 // need from the packaging.
125 compileOnly('com.google.guava:guava:23.0')
126 compile('com.google.guava:guava:23.0', {
127 exclude group: 'com.google.errorprone'
128 exclude group: 'com.google.code.findbugs'
129 exclude group: 'com.google.j2objc'
130 exclude group: 'org.codehaus.mojo'
131 })
Stephan Herhutb17bb8d2017-05-23 12:34:55 +0200132 compile group: 'it.unimi.dsi', name: 'fastutil', version: '7.2.0'
Mads Ager418d1ca2017-05-22 09:35:49 +0200133 compile group: 'org.apache.commons', name: 'commons-compress', version: '1.12'
Mads Agerf1d93e22017-09-22 12:41:13 +0000134 compile group: 'org.ow2.asm', name: 'asm', version: '5.1'
135 compile group: 'org.ow2.asm', name: 'asm-commons', version: '5.1'
136 compile group: 'org.ow2.asm', name: 'asm-tree', version: '5.1'
137 compile group: 'org.ow2.asm', name: 'asm-util', version: '5.1'
Mads Ager418d1ca2017-05-22 09:35:49 +0200138 testCompile sourceSets.examples.output
139 testCompile 'junit:junit:4.12'
140 testCompile group: 'org.smali', name: 'smali', version: '2.2b4'
141 testCompile files('third_party/jasmin/jasmin-2.4.jar')
142 testCompile files('third_party/jdwp-tests/apache-harmony-jdwp-tests-host.jar')
143 jctfCommonCompile 'junit:junit:4.12'
144 jctfTestsCompile 'junit:junit:4.12'
145 jctfTestsCompile sourceSets.jctfCommon.output
Mads Agerf1d93e22017-09-22 12:41:13 +0000146 examplesAndroidOCompile group: 'org.ow2.asm', name: 'asm', version: '5.1'
Stephan Herhut417a72a2017-07-18 10:38:30 +0200147 examplesCompile 'com.google.protobuf:protobuf-lite:3.0.0'
148 examplesRuntime 'com.google.protobuf:protobuf-lite:3.0.0'
Yohann Roussel126f6872017-08-03 16:25:32 +0200149 supportLibs 'com.android.support:support-v4:25.4.0'
150 supportLibs 'junit:junit:4.12'
151 supportLibs 'com.android.support.test.espresso:espresso-core:3.0.0'
Sebastien Hertz9006e9c2017-09-11 11:03:26 +0200152 debugTestResourcesKotlinCompileOnly 'org.jetbrains.kotlin:kotlin-stdlib:1.1.4-3'
Stephan Herhut417a72a2017-07-18 10:38:30 +0200153}
154
Yohann Roussel7f47c032017-09-14 12:19:06 +0200155licenseTools {
156 licensesYaml = file('LIBRARY-LICENSE')
157}
158
Stephan Herhut417a72a2017-07-18 10:38:30 +0200159protobuf {
160 protoc {
161 // Download from repositories
162 artifact = 'com.google.protobuf:protoc:3.0.0'
163 }
164 plugins {
165 javalite {
166 artifact = 'com.google.protobuf:protoc-gen-javalite:3.0.0'
167 }
168 }
169 generateProtoTasks {
170 all().each { task ->
171 task.builtins {
172 // Disable the java code generator, as we want javalite only.
173 remove java
174 }
175 task.plugins {
176 javalite {}
177 }
178 }
179 }
Mads Ager418d1ca2017-05-22 09:35:49 +0200180}
181
Jean-Marie Henaff39587a82017-06-08 15:20:13 +0200182def osString = OperatingSystem.current().isLinux() ? "linux" :
183 OperatingSystem.current().isMacOsX() ? "mac" : "windows"
Mads Ager418d1ca2017-05-22 09:35:49 +0200184
185def cloudDependencies = [
186 "tests" : [
mikaelpeltier962da332017-08-18 11:40:55 +0200187 "2017-07-27/art.tar.gz",
Søren Gjesse34b77732017-07-07 13:56:21 +0200188 "2016-12-19/art.tar.gz"
Mads Ager418d1ca2017-05-22 09:35:49 +0200189 ],
190 "third_party": [
191 "android_jar/lib-v14.tar.gz",
192 "android_jar/lib-v19.tar.gz",
Søren Gjesseab220772017-06-23 13:05:53 +0200193 "android_jar/lib-v21.tar.gz",
Mads Ager418d1ca2017-05-22 09:35:49 +0200194 "android_jar/lib-v24.tar.gz",
195 "android_jar/lib-v25.tar.gz",
196 "android_jar/lib-v26.tar.gz",
197 "proguard/proguard5.2.1.tar.gz",
198 "gradle/gradle.tar.gz",
199 "jdwp-tests.tar.gz",
200 "jasmin.tar.gz",
201 "jctf.tar.gz",
Sebastien Hertz1d7702b2017-08-18 09:07:27 +0200202 "kotlin.tar.gz",
Mads Ager418d1ca2017-05-22 09:35:49 +0200203 "android_cts_baseline.tar.gz",
Mads Ager1d5ae402017-09-22 12:30:56 +0200204 "shadow.tar.gz",
Mads Ager418d1ca2017-05-22 09:35:49 +0200205 ],
206 // All dex-vms have a fixed OS of Linux, as they are only supported on Linux, and will be run in a Docker
207 // container on other platforms where supported.
208 "tools" : [
209 "linux/art.tar.gz",
210 "linux/art-5.1.1.tar.gz",
211 "linux/art-6.0.1.tar.gz",
212 "linux/art-7.0.0.tar.gz",
213 "linux/dalvik.tar.gz",
214 "${osString}/dx.tar.gz",
215 ]
216]
217
218cloudDependencies.each { entry ->
219 entry.value.each { entryFile ->
220 task "download_deps_${entry.key}/${entryFile}"(type: Exec) {
221 def gzFile = "${entry.key}/${entryFile}"
222 def sha1File = "${gzFile}.sha1"
223 inputs.file sha1File
224 outputs.file gzFile
Jean-Marie Henaff872e4422017-06-13 10:26:20 +0200225 List<String> dlFromStorageArgs = ["-n", "-b", "r8-deps", "-u", "-s", "${sha1File}"]
226 if (OperatingSystem.current().isWindows()) {
227 executable "download_from_google_storage.bat"
228 args dlFromStorageArgs
229 } else {
230 executable "bash"
231 args "-c", "download_from_google_storage " + String.join(" ", dlFromStorageArgs)
232 }
Mads Ager418d1ca2017-05-22 09:35:49 +0200233 }
234 }
235}
236
237def x20Dependencies = [
238 "third_party": [
Søren Gjesse5ecb04a2017-06-13 09:44:32 +0200239 "gmail/gmail_android_170604.16.tar.gz",
Mads Ager418d1ca2017-05-22 09:35:49 +0200240 "gmscore/v4.tar.gz",
241 "gmscore/v5.tar.gz",
242 "gmscore/v6.tar.gz",
243 "gmscore/v7.tar.gz",
244 "gmscore/v8.tar.gz",
245 "gmscore/gmscore_v9.tar.gz",
246 "gmscore/gmscore_v10.tar.gz",
Stephan Herhut4e743302017-06-09 13:09:03 +0200247 "gmscore/latest.tar.gz",
Mads Agerae646402017-06-07 13:32:43 +0200248 "photos/2017-06-06.tar.gz",
Mads Ager418d1ca2017-05-22 09:35:49 +0200249 "youtube/youtube.android_12.10.tar.gz",
Søren Gjessefeac2ef2017-05-22 17:09:29 +0200250 "youtube/youtube.android_12.17.tar.gz",
Søren Gjesse9be84982017-06-09 14:21:03 +0200251 "youtube/youtube.android_12.22.tar.gz",
Mads Ager418d1ca2017-05-22 09:35:49 +0200252 "proguardsettings.tar.gz",
Tamas Kenez5febf242017-06-20 16:00:44 +0200253 "proguard/proguard_internal_159423826.tar.gz",
Tamas Kenez67419712017-06-26 11:11:45 +0200254 "framework.tar.gz",
Tamas Kenez391fca82017-06-29 18:16:01 +0200255 "goyt.tar.gz",
Mads Ager418d1ca2017-05-22 09:35:49 +0200256 ],
257]
258
259x20Dependencies.each { entry ->
260 entry.value.each { entryFile ->
261 task "download_deps_${entry.key}/${entryFile}"(type: Exec) {
262 def gzFile = "${entry.key}/${entryFile}"
263 def sha1File = "${gzFile}.sha1"
264 inputs.file sha1File
265 outputs.file gzFile
266 executable "bash"
267 args "-c", "tools/download_from_x20.py ${sha1File}"
268 }
269 }
270}
271
Rico Wind897bb712017-05-23 10:44:29 +0200272task downloadProguard {
273 cloudDependencies.each { entry ->
274 entry.value.each { entryFile ->
275 if (entryFile.contains("proguard")) {
276 dependsOn "download_deps_${entry.key}/${entryFile}"
277 }
278 }
279 }
280}
281
Tamas Kenez427205b2017-06-29 15:57:09 +0200282task downloadDx {
283 cloudDependencies.each { entry ->
284 entry.value.each { entryFile ->
285 if (entryFile.contains("dx.tar")) {
286 dependsOn "download_deps_${entry.key}/${entryFile}"
287 }
288 }
289 }
290}
291
Tamas Kenez0e10c562017-06-08 10:00:34 +0200292task downloadAndroidCts {
293 cloudDependencies.each { entry ->
294 entry.value.each { entryFile ->
295 if (entryFile.contains("android_cts_baseline")) {
296 dependsOn "download_deps_${entry.key}/${entryFile}"
297 }
298 }
299 }
300}
301
Mads Ager418d1ca2017-05-22 09:35:49 +0200302task downloadDeps {
303 cloudDependencies.each { entry ->
304 entry.value.each { entryFile ->
305 dependsOn "download_deps_${entry.key}/${entryFile}"
306 }
307 }
308 if (!project.hasProperty('no_internal')) {
309 x20Dependencies.each { entry ->
310 entry.value.each { entryFile ->
311 dependsOn "download_deps_${entry.key}/${entryFile}"
312 }
313 }
314 }
315}
316
317allprojects {
318 sourceCompatibility = JavaVersion.VERSION_1_8
319 targetCompatibility = JavaVersion.VERSION_1_8
320}
321
322tasks.withType(JavaCompile) {
323 options.compilerArgs << '-Xlint:unchecked'
324}
325
326compileJctfCommonJava {
327 dependsOn 'copyAdditionalJctfCommonFiles'
328 options.compilerArgs = ['-Xlint:none']
329}
330
331compileJctfTestsJava {
332 dependsOn 'jctfCommonClasses'
333 options.compilerArgs = ['-Xlint:none']
334}
335
Yohann Roussel7f47c032017-09-14 12:19:06 +0200336task consolidatedLicense {
337 // checkLicenses verifies that the list of libraries referenced in 'LIBRARY-LICENSE' is
338 // corresponding to the effective list of embedded libraries.
339 dependsOn 'checkLicenses'
340 def license = new File(new File(buildDir, 'generatedLicense'), 'LICENSE')
341 inputs.files files('LICENSE', 'LIBRARY-LICENSE') + fileTree(dir: 'library-licensing')
342 outputs.files license
343 doLast {
344 license.getParentFile().mkdirs()
345 license.createNewFile()
346 license.text = "This file lists all licenses for code distributed.\n"
347 license.text += "All non-library code has the following 3-Clause BSD license.\n"
348 license.text += "\n"
349 license.text += "\n"
350 license.text += file('LICENSE').text
351 license.text += "\n"
352 license.text += "\n"
353 license.text += "Summary of distributed libraries:\n"
354 license.text += "\n"
355 license.text += file('LIBRARY-LICENSE').text
356 license.text += "\n"
357 license.text += "\n"
358 license.text += "Licenses details:\n"
359 fileTree(dir: 'library-licensing').getFiles().stream().sorted().forEach { file ->
360 license.text += "\n"
361 license.text += "\n"
362 license.text += file.text
363 }
364 }
365}
366
Mikaël Peltiere5e54722017-08-18 12:01:59 +0200367task R8(type: com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar) {
Mads Ager418d1ca2017-05-22 09:35:49 +0200368 from sourceSets.main.output
Yohann Roussel7f47c032017-09-14 12:19:06 +0200369 from consolidatedLicense.outputs.files
370 exclude { path ->
371 path.getRelativePath().getPathString().startsWith("META-INF")
372 }
Mads Ager418d1ca2017-05-22 09:35:49 +0200373 baseName 'r8'
Mikaël Peltiere5e54722017-08-18 12:01:59 +0200374 classifier = null
375 version = null
Mads Ager418d1ca2017-05-22 09:35:49 +0200376 manifest {
377 attributes 'Main-Class': 'com.android.tools.r8.R8'
378 }
379 // In order to build without dependencies, pass the exclude_deps property using:
380 // gradle -Pexclude_deps R8
381 if (!project.hasProperty('exclude_deps')) {
Stephan Herhut93123ef2017-08-22 12:05:11 +0200382 // Relocating dependencies to avoid conflicts. Keep this as precise as possible
383 // to avoid rewriting unrelated strings.
384 relocate 'com.google.common', 'com.android.tools.r8.com.google.common'
385 relocate 'com.google.thirdparty', 'com.android.tools.r8.com.google.thirdparty'
Mikaël Peltiere5e54722017-08-18 12:01:59 +0200386 relocate 'joptsimple', 'com.android.tools.r8.joptsimple'
Stephan Herhut93123ef2017-08-22 12:05:11 +0200387 relocate 'org.apache.commons', 'com.android.tools.r8.org.apache.commons'
388 relocate 'org.objectweb.asm', 'com.android.tools.r8.org.objectweb.asm'
Stephan Herhut93123ef2017-08-22 12:05:11 +0200389 relocate 'org.json.simple', 'com.android.tools.r8.org.json.simple'
Mikaël Peltiere5e54722017-08-18 12:01:59 +0200390 relocate 'it.unimi.dsi.fastutil', 'com.android.tools.r8.it.unimi.dsi.fastutil'
Mads Ager418d1ca2017-05-22 09:35:49 +0200391 // Also include dependencies
Mikaël Peltiere5e54722017-08-18 12:01:59 +0200392 configurations = [project.configurations.compile]
Mads Ager418d1ca2017-05-22 09:35:49 +0200393 }
394}
395
mikaelpeltier80939312017-08-17 15:00:09 +0200396task D8(type: com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar) {
Mads Ager418d1ca2017-05-22 09:35:49 +0200397 from sourceSets.main.output
Yohann Roussel7f47c032017-09-14 12:19:06 +0200398 from consolidatedLicense.outputs.files
399 exclude { path ->
400 path.getRelativePath().getPathString().startsWith("META-INF")
401 }
Mads Ager418d1ca2017-05-22 09:35:49 +0200402 baseName 'd8'
mikaelpeltier80939312017-08-17 15:00:09 +0200403 classifier = null
404 version = null
Mads Ager418d1ca2017-05-22 09:35:49 +0200405 manifest {
mikaelpeltier80939312017-08-17 15:00:09 +0200406 attributes 'Main-Class': 'com.android.tools.r8.D8'
Mads Ager418d1ca2017-05-22 09:35:49 +0200407 }
408 // In order to build without dependencies, pass the exclude_deps property using:
409 // gradle -Pexclude_deps D8
410 if (!project.hasProperty('exclude_deps')) {
Stephan Herhut93123ef2017-08-22 12:05:11 +0200411 // Relocating dependencies to avoid conflicts. Keep this as precise as possible
412 // to avoid rewriting unrelated strings.
413 relocate 'com.google.common', 'com.android.tools.r8.com.google.common'
414 relocate 'com.google.thirdparty', 'com.android.tools.r8.com.google.thirdparty'
mikaelpeltier80939312017-08-17 15:00:09 +0200415 relocate 'joptsimple', 'com.android.tools.r8.joptsimple'
Stephan Herhut93123ef2017-08-22 12:05:11 +0200416 relocate 'org.apache.commons', 'com.android.tools.r8.org.apache.commons'
417 relocate 'org.objectweb.asm', 'com.android.tools.r8.org.objectweb.asm'
Stephan Herhut93123ef2017-08-22 12:05:11 +0200418 relocate 'org.json.simple', 'com.android.tools.r8.org.json.simple'
mikaelpeltier80939312017-08-17 15:00:09 +0200419 relocate 'it.unimi.dsi.fastutil', 'com.android.tools.r8.it.unimi.dsi.fastutil'
Mads Ager418d1ca2017-05-22 09:35:49 +0200420 // Also include dependencies
mikaelpeltier80939312017-08-17 15:00:09 +0200421 configurations = [project.configurations.compile]
Mads Ager418d1ca2017-05-22 09:35:49 +0200422 }
423}
424
425task CompatDx(type: Jar) {
426 from sourceSets.main.output
427 baseName 'compatdx'
428 manifest {
429 attributes 'Main-Class': 'com.android.tools.r8.compatdx.CompatDx'
430 }
431 // In order to build without dependencies, pass the exclude_deps property using:
432 // gradle -Pexclude_deps CompatDx
433 if (!project.hasProperty('exclude_deps')) {
434 // Also include dependencies
435 from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
436 }
437}
438
Søren Gjesse1d21da72017-09-01 12:05:38 +0200439task CompatProguard(type: Jar) {
440 from sourceSets.main.output
441 baseName 'compatproguard'
442 manifest {
443 attributes 'Main-Class': 'com.android.tools.r8.compatproguard.CompatProguard'
444 }
445 // In order to build without dependencies, pass the exclude_deps property using:
446 // gradle -Pexclude_deps CompatProguard
447 if (!project.hasProperty('exclude_deps')) {
448 // Also include dependencies
449 from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
450 }
451}
452
Tamas Kenez971eec62017-05-24 11:08:40 +0200453task D8Logger(type: Jar) {
454 from sourceSets.main.output
455 baseName 'd8logger'
456 manifest {
457 attributes 'Main-Class': 'com.android.tools.r8.D8Logger'
458 }
459 // In order to build without dependencies, pass the exclude_deps property using:
460 // gradle -Pexclude_deps D8Logger
461 if (!project.hasProperty('exclude_deps')) {
462 // Also include dependencies
463 from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
464 }
465}
466
Mads Ager418d1ca2017-05-22 09:35:49 +0200467task disasm(type: Jar) {
468 from sourceSets.main.output
469 baseName 'disasm'
470 manifest {
471 attributes 'Main-Class': 'com.android.tools.r8.Disassemble'
472 }
473 // In order to build without dependencies, pass the exclude_deps property using:
474 // gradle -Pexclude_deps D8
475 if (!project.hasProperty('exclude_deps')) {
476 // Also include dependencies
477 from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
478 }
479}
480
481task bisect(type: Jar) {
482 from sourceSets.main.output
483 baseName 'bisect'
484 manifest {
485 attributes 'Main-Class': 'com.android.tools.r8.bisect.Bisect'
486 }
487 // In order to build without dependencies, pass the exclude_deps property using:
488 // gradle -Pexclude_deps R8
489 if (!project.hasProperty('exclude_deps')) {
490 // Also include dependencies
491 from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
492 }
493}
494
Lars Bak90c18042017-06-26 14:21:08 +0200495task DexSegments(type: Jar) {
496 from sourceSets.main.output
497 baseName 'dexsegments'
498 manifest {
499 attributes 'Main-Class': 'com.android.tools.r8.DexSegments'
500 }
501 // In order to build without dependencies, pass the exclude_deps property using:
502 // gradle -Pexclude_deps DexSegments
503 if (!project.hasProperty('exclude_deps')) {
504 // Also include dependencies
505 from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
506 }
507}
508
Søren Gjessec4e5e932017-09-04 17:01:23 +0200509task maindex(type: Jar) {
510 from sourceSets.main.output
511 baseName 'maindex'
512 manifest {
513 attributes 'Main-Class': 'com.android.tools.r8.GenerateMainDexList'
514 }
515 // In order to build without dependencies, pass the exclude_deps property using:
516 // gradle -Pexclude_deps maindex
517 if (!project.hasProperty('exclude_deps')) {
518 // Also include dependencies
519 from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
520 }
521}
522
Lars Bak44cef522017-08-10 16:02:39 +0200523task ExtractMarker(type: Jar) {
524 from sourceSets.main.output
525 baseName 'extractmarker'
526 manifest {
527 attributes 'Main-Class': 'com.android.tools.r8.ExtractMarker'
528 }
529 // In order to build without dependencies, pass the exclude_deps property using:
530 // gradle -Pexclude_deps ExtractMarker
531 if (!project.hasProperty('exclude_deps')) {
532 // Also include dependencies
533 from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
534 }
535}
536
Mads Ager418d1ca2017-05-22 09:35:49 +0200537task sourceJar(type: Jar, dependsOn: classes) {
538 classifier = 'src'
539 from sourceSets.main.allSource
540}
541
542task jctfCommonJar(type: Jar) {
543 from sourceSets.jctfCommon.output
544 baseName 'jctfCommon'
545}
546
547artifacts {
548 archives sourceJar
549}
550
551task createArtTests(type: Exec) {
552 def outputDir = "build/generated/test/java/com/android/tools/r8/art"
Mads Ager7e5bd722017-05-24 07:17:27 +0200553 def createArtTestsScript = "tools/create_art_tests.py"
mikaelpeltier962da332017-08-18 11:40:55 +0200554 inputs.file "tests/2017-07-27/art.tar.gz"
Mads Ager418d1ca2017-05-22 09:35:49 +0200555 inputs.file createArtTestsScript
556 outputs.dir outputDir
557 dependsOn downloadDeps
Mads Ager677e3002017-05-24 07:54:51 +0200558 commandLine "python", createArtTestsScript
Mads Ager418d1ca2017-05-22 09:35:49 +0200559 workingDir = projectDir
560}
561
562task createJctfTests(type: Exec) {
Stephan Herhutea6ee582017-05-23 13:14:34 +0200563 def outputDir = "build/generated/test/java/com/android/tools/r8/jctf"
Tamas Kenez25a99e92017-05-29 10:15:30 +0200564 def script = "tools/create_jctf_tests.py"
Mads Ager418d1ca2017-05-22 09:35:49 +0200565 inputs.file script
566 outputs.dir outputDir
567 dependsOn downloadDeps
Tamas Kenez25a99e92017-05-29 10:15:30 +0200568 commandLine "python", script
Mads Ager418d1ca2017-05-22 09:35:49 +0200569 workingDir = projectDir
570}
571
572compileTestJava {
573 dependsOn createArtTests
574 dependsOn createJctfTests
575}
576
577task buildDebugInfoExamplesDex {
578 def examplesDir = file("src/test/java")
579 def hostJar = "debuginfo_examples.jar"
580 def hostDexJar = "debuginfo_examples_dex.jar"
581 task "compile_debuginfo_examples"(type: JavaCompile) {
582 source = fileTree(dir: examplesDir, include: "com/android/tools/r8/debuginfo/*Test.java")
583 destinationDir = file("build/test/debuginfo_examples/classes")
584 classpath = sourceSets.main.compileClasspath
585 sourceCompatibility = JavaVersion.VERSION_1_7
586 targetCompatibility = JavaVersion.VERSION_1_7
587 options.compilerArgs += ["-Xlint:-options"]
588 }
589 task "jar_debuginfo_examples"(type: Jar, dependsOn: "compile_debuginfo_examples") {
590 archiveName = hostJar
591 destinationDir = file("build/test/")
592 from "build/test/debuginfo_examples/classes"
593 include "**/*.class"
594 }
595 task "dex_debuginfo_examples"(type: Exec,
596 dependsOn: ["jar_debuginfo_examples", "downloadDeps"]) {
Jean-Marie Henaff39587a82017-06-08 15:20:13 +0200597 if (OperatingSystem.current().isWindows()) {
598 executable file("tools/windows/dx/bin/dx.bat")
599 } else {
600 executable file("tools/linux/dx/bin/dx");
601 }
Mads Ager418d1ca2017-05-22 09:35:49 +0200602 args "--dex"
603 args "--output=build/test/${hostDexJar}"
604 args "build/test/${hostJar}"
605 inputs.file file("build/test/${hostJar}")
606 outputs.file file("build/test/${hostDexJar}")
607 }
608 dependsOn dex_debuginfo_examples
609}
610
611task buildDebugTestResourcesJars {
Mads Ager418d1ca2017-05-22 09:35:49 +0200612 def resourcesDir = file("src/test/debugTestResources")
613 def hostJar = "debug_test_resources.jar"
614 task "compile_debugTestResources"(type: JavaCompile) {
615 source = fileTree(dir: resourcesDir, include: '**/*.java')
616 destinationDir = file("build/test/debugTestResources/classes")
617 classpath = sourceSets.main.compileClasspath
618 sourceCompatibility = JavaVersion.VERSION_1_7
619 targetCompatibility = JavaVersion.VERSION_1_7
620 options.compilerArgs += ["-g", "-Xlint:-options"]
621 }
622 task "jar_debugTestResources"(type: Jar, dependsOn: "compile_debugTestResources") {
623 archiveName = hostJar
624 destinationDir = file("build/test/")
625 from "build/test/debugTestResources/classes"
626 include "**/*.class"
627 }
Sebastien Hertz964c5c22017-05-23 15:22:23 +0200628 def java8ResourcesDir = file("src/test/debugTestResourcesJava8")
629 def java8HostJar = "debug_test_resources_java8.jar"
630 task "compile_debugTestResourcesJava8"(type: JavaCompile) {
631 source = fileTree(dir: java8ResourcesDir, include: '**/*.java')
632 destinationDir = file("build/test/debugTestResourcesJava8/classes")
633 classpath = sourceSets.main.compileClasspath
634 sourceCompatibility = JavaVersion.VERSION_1_8
635 targetCompatibility = JavaVersion.VERSION_1_8
636 options.compilerArgs += ["-g", "-Xlint:-options"]
637 }
638 task "jar_debugTestResourcesJava8"(type: Jar, dependsOn: "compile_debugTestResourcesJava8") {
639 archiveName = java8HostJar
640 destinationDir = file("build/test/")
641 from "build/test/debugTestResourcesJava8/classes"
642 include "**/*.class"
643 }
Sebastien Hertz1d7702b2017-08-18 09:07:27 +0200644 def kotlinResourcesDir = file("src/test/debugTestResourcesKotlin")
645 def kotlinHostJar = "debug_test_resources_kotlin.jar"
Sebastien Hertz9006e9c2017-09-11 11:03:26 +0200646 task "jar_debugTestResourcesKotlin"(type: kotlin.Kotlinc) {
647 source = fileTree(dir: kotlinResourcesDir, include: '**/*.kt')
648 destination = file("build/test/${kotlinHostJar}")
Sebastien Hertz1d7702b2017-08-18 09:07:27 +0200649 }
Sebastien Hertz964c5c22017-05-23 15:22:23 +0200650 dependsOn downloadDeps
Mads Ager418d1ca2017-05-22 09:35:49 +0200651 dependsOn jar_debugTestResources
Sebastien Hertz964c5c22017-05-23 15:22:23 +0200652 dependsOn jar_debugTestResourcesJava8
Sebastien Hertz1d7702b2017-08-18 09:07:27 +0200653 dependsOn jar_debugTestResourcesKotlin
Mads Ager418d1ca2017-05-22 09:35:49 +0200654}
655
Lars Bakc91e87e2017-08-18 08:53:10 +0200656// Proto lite generated code yields warnings when compiling with javac.
657// We change the options passed to javac to ignore it.
658compileExamplesJava.options.compilerArgs = ["-Xlint:none"]
659
Mads Ager418d1ca2017-05-22 09:35:49 +0200660task buildExampleJars {
Rico Wind897bb712017-05-23 10:44:29 +0200661 dependsOn downloadProguard
Mads Ager418d1ca2017-05-22 09:35:49 +0200662 def examplesDir = file("src/test/examples")
Stephan Herhut417a72a2017-07-18 10:38:30 +0200663 def protoSourceDir = file("build/generated/source/proto/examples/javalite")
Jean-Marie Henaff872e4422017-06-13 10:26:20 +0200664 def proguardScript
665 if (OperatingSystem.current().isWindows()) {
666 proguardScript = "third_party/proguard/proguard5.2.1/bin/proguard.bat"
667 } else {
668 proguardScript = "third_party/proguard/proguard5.2.1/bin/proguard.sh"
669 }
Stephan Herhut417a72a2017-07-18 10:38:30 +0200670 task extractExamplesRuntime(type: Sync) {
671 dependsOn configurations.examplesRuntime
672 from configurations.examplesRuntime.collect { zipTree(it) }
673 include "**/*.class"
674 includeEmptyDirs false
675 into "$buildDir/runtime/examples/"
676 }
677
678 task "compile_examples"(type: JavaCompile, dependsOn: "generateExamplesProto") {
679 source examplesDir, protoSourceDir
680 include "**/*.java"
Mads Ager418d1ca2017-05-22 09:35:49 +0200681 destinationDir = file("build/test/examples/classes")
Stephan Herhut417a72a2017-07-18 10:38:30 +0200682 classpath = sourceSets.examples.compileClasspath
Mads Ager418d1ca2017-05-22 09:35:49 +0200683 sourceCompatibility = JavaVersion.VERSION_1_7
684 targetCompatibility = JavaVersion.VERSION_1_7
Tamas Kenezc5163ed2017-09-19 09:27:37 +0200685 options.compilerArgs = ["-g:source,lines", "-Xlint:none"]
686 }
687 task "compile_examples_debuginfo_all"(type: JavaCompile, dependsOn: "generateExamplesProto") {
688 source examplesDir, protoSourceDir
689 include "**/*.java"
690 destinationDir = file("build/test/examples/classes_debuginfo_all")
691 classpath = sourceSets.examples.compileClasspath
692 sourceCompatibility = JavaVersion.VERSION_1_7
693 targetCompatibility = JavaVersion.VERSION_1_7
694 options.compilerArgs = ["-g", "-Xlint:none"]
695 }
696 task "compile_examples_debuginfo_none"(type: JavaCompile, dependsOn: "generateExamplesProto") {
697 source examplesDir, protoSourceDir
698 include "**/*.java"
699 destinationDir = file("build/test/examples/classes_debuginfo_none")
700 classpath = sourceSets.examples.compileClasspath
701 sourceCompatibility = JavaVersion.VERSION_1_7
702 targetCompatibility = JavaVersion.VERSION_1_7
703 options.compilerArgs = ["-g:none", "-Xlint:none"]
Mads Ager418d1ca2017-05-22 09:35:49 +0200704 }
705 examplesDir.eachDir { dir ->
706 def name = dir.getName();
707 def exampleOutputDir = file("build/test/examples");
708 def jarName = "${name}.jar"
709 dependsOn "jar_example_${name}"
Tamas Kenezc5163ed2017-09-19 09:27:37 +0200710 dependsOn "jar_example_${name}_debuginfo_all"
711 dependsOn "jar_example_${name}_debuginfo_none"
Stephan Herhut417a72a2017-07-18 10:38:30 +0200712 dependsOn "extractExamplesRuntime"
713 def runtimeDependencies = copySpec { }
714 if (!fileTree(dir: dir, include: '**/*.proto').empty) {
715 // If we have any proto use, we have to include those classes and the runtime.
716 runtimeDependencies = copySpec {
717 from "$buildDir/runtime/examples/"
718 include "com/google/protobuf/**/*.class"
719 }
720 }
Mads Ager418d1ca2017-05-22 09:35:49 +0200721 // The "throwing" test verifies debugging/stack info on the post-proguarded output.
722 def proguardConfigPath = "${dir}/proguard.cfg"
723 if (new File(proguardConfigPath).exists()) {
724 task "pre_proguard_example_${name}"(type: Jar, dependsOn: "compile_examples") {
725 archiveName = "${name}_pre_proguard.jar"
726 destinationDir = exampleOutputDir
727 from "build/test/examples/classes"
Stephan Herhut417a72a2017-07-18 10:38:30 +0200728 include name + "/**/*.class"
729 with runtimeDependencies
730 includeEmptyDirs false
Mads Ager418d1ca2017-05-22 09:35:49 +0200731 }
732 def jarPath = files(tasks.getByPath("pre_proguard_example_${name}")).files.first();
733 def proguardJarPath = "${exampleOutputDir}/${jarName}"
734 def proguardMapPath = "${exampleOutputDir}/${name}/${name}.map"
735 task "jar_example_${name}"(type: Exec, dependsOn: "pre_proguard_example_${name}") {
736 inputs.files tasks.getByPath("pre_proguard_example_${name}")
737 inputs.file proguardConfigPath
738 // Enable these to get stdout and stderr redirected to files...
739 // standardOutput = new FileOutputStream('proguard.stdout')
740 // errorOutput = new FileOutputStream('proguard.stderr')
Jean-Marie Henaff872e4422017-06-13 10:26:20 +0200741 def proguardArguments = "-verbose -dontwarn java.** -injars ${jarPath}" +
Mads Ager418d1ca2017-05-22 09:35:49 +0200742 " -outjars ${proguardJarPath}" +
743 " -include ${proguardConfigPath}" +
Jean-Marie Henaff872e4422017-06-13 10:26:20 +0200744 " -printmapping ${proguardMapPath}"
745 if (OperatingSystem.current().isWindows()) {
746 executable "${proguardScript}"
747 args "${proguardArguments}"
748 } else {
749 executable "bash"
750 args "-c", "${proguardScript} '${proguardArguments}'"
751 }
Mads Ager418d1ca2017-05-22 09:35:49 +0200752 outputs.file proguardJarPath
753 }
Tamas Kenezc5163ed2017-09-19 09:27:37 +0200754 // TODO: Consider performing distinct proguard compilations.
755 task "jar_example_${name}_debuginfo_all"(type: Copy, dependsOn: "jar_example_${name}") {
756 from "${exampleOutputDir}/${name}.jar"
Tamas Kenez925cb642017-09-19 10:41:15 +0200757 into "${exampleOutputDir}"
758 rename(".*", "${name}_debuginfo_all.jar")
Tamas Kenezc5163ed2017-09-19 09:27:37 +0200759 }
760 task "jar_example_${name}_debuginfo_none"(type: Copy, dependsOn: "jar_example_${name}") {
761 from "${exampleOutputDir}/${name}.jar"
Tamas Kenez925cb642017-09-19 10:41:15 +0200762 into "${exampleOutputDir}"
763 rename(".*", "${name}_debuginfo_none.jar")
Tamas Kenezc5163ed2017-09-19 09:27:37 +0200764 }
Mads Ager418d1ca2017-05-22 09:35:49 +0200765 } else {
766 task "jar_example_${name}"(type: Jar, dependsOn: "compile_examples") {
Tamas Kenezc5163ed2017-09-19 09:27:37 +0200767 archiveName = "${name}.jar"
Mads Ager418d1ca2017-05-22 09:35:49 +0200768 destinationDir = exampleOutputDir
769 from "build/test/examples/classes"
Stephan Herhut417a72a2017-07-18 10:38:30 +0200770 include name + "/**/*.class"
771 with runtimeDependencies
772 includeEmptyDirs false
Mads Ager418d1ca2017-05-22 09:35:49 +0200773 }
Tamas Kenezc5163ed2017-09-19 09:27:37 +0200774 task "jar_example_${name}_debuginfo_all"(type: Jar, dependsOn: "compile_examples_debuginfo_all") {
775 archiveName = "${name}_debuginfo_all.jar"
776 destinationDir = exampleOutputDir
777 from "build/test/examples/classes_debuginfo_all"
778 include name + "/**/*.class"
779 with runtimeDependencies
780 includeEmptyDirs false
781 }
782 task "jar_example_${name}_debuginfo_none"(type: Jar, dependsOn: "compile_examples_debuginfo_none") {
783 archiveName = "${name}_debuginfo_none.jar"
784 destinationDir = exampleOutputDir
785 from "build/test/examples/classes_debuginfo_none"
786 include name + "/**/*.class"
787 with runtimeDependencies
788 includeEmptyDirs false
789 }
Mads Ager418d1ca2017-05-22 09:35:49 +0200790 }
791 }
792}
793
794task buildExampleAndroidNJars {
795 dependsOn downloadDeps
796 def examplesDir = file("src/test/examplesAndroidN")
797 task "compile_examplesAndroidN"(type: JavaCompile) {
798 source = fileTree(dir: examplesDir, include: '**/*.java')
799 destinationDir = file("build/test/examplesAndroidN/classes")
800 classpath = sourceSets.main.compileClasspath
801 sourceCompatibility = JavaVersion.VERSION_1_8
802 targetCompatibility = JavaVersion.VERSION_1_8
803 options.compilerArgs += ["-Xlint:-options"]
804 }
805 examplesDir.eachDir { dir ->
806 def name = dir.getName();
807 def exampleOutputDir = file("build/test/examplesAndroidN");
808 def jarName = "${name}.jar"
809 dependsOn "jar_examplesAndroidN_${name}"
810 task "jar_examplesAndroidN_${name}"(type: Jar, dependsOn: "compile_examplesAndroidN") {
811 archiveName = jarName
812 destinationDir = exampleOutputDir
813 from "build/test/examplesAndroidN/classes"
814 include "**/" + name + "/**/*.class"
815 }
816 }
817}
818
819
820task buildExampleAndroidOJars {
821 dependsOn downloadDeps
822 def examplesDir = file("src/test/examplesAndroidO")
823 // NOTE: we want to enable a scenario when test needs to reference some
824 // classes generated by legacy (1.6) Java compiler to test some specific
825 // behaviour. To do so we compile all the java files located in sub-directory
826 // called 'legacy' with Java 1.6, then compile the rest of the files with
827 // Java 1.8 and a reference to previously generated 1.6 classes.
828
829 // Compiling all classes in dirs 'legacy' with old Java version.
830 task "compile_examplesAndroidO_Legacy"(type: JavaCompile) {
831 source = fileTree(dir: examplesDir, include: '**/legacy/**/*.java')
832 destinationDir = file("build/test/examplesAndroidOLegacy/classes")
833 classpath = sourceSets.main.compileClasspath
834 sourceCompatibility = JavaVersion.VERSION_1_6
835 targetCompatibility = JavaVersion.VERSION_1_6
836 options.compilerArgs += ["-Xlint:-options", "-parameters"]
837 }
838 // Compiling the rest of the files as Java 1.8 code.
839 task "compile_examplesAndroidO"(type: JavaCompile) {
840 dependsOn "compile_examplesAndroidO_Legacy"
841 source = fileTree(dir: examplesDir, include: '**/*.java', exclude: '**/legacy/**/*.java')
842 destinationDir = file("build/test/examplesAndroidO/classes")
843 classpath = sourceSets.main.compileClasspath
844 classpath += files("build/test/examplesAndroidOLegacy/classes")
845 sourceCompatibility = JavaVersion.VERSION_1_8
846 targetCompatibility = JavaVersion.VERSION_1_8
847 options.compilerArgs += ["-Xlint:-options", "-parameters"]
848 }
849 examplesDir.eachDir { dir ->
850 def name = dir.getName();
851 def destinationDir = file("build/test/examplesAndroidO/classes");
852 if (file("src/test/examplesAndroidO/" + name + "/TestGenerator.java").isFile()) {
853 task "generate_examplesAndroidO_${name}"(type: JavaExec,
854 dependsOn: "compile_examplesAndroidO") {
855 main = name + ".TestGenerator"
856 classpath = files(destinationDir, sourceSets.main.compileClasspath)
857 args destinationDir
858 }
859 } else {
860 task "generate_examplesAndroidO_${name}" () {}
861 }
862 }
863 examplesDir.eachDir { dir ->
864 def name = dir.getName();
865 def exampleOutputDir = file("build/test/examplesAndroidO");
866 def jarName = "${name}.jar"
867 dependsOn "jar_examplesAndroidO_${name}"
868 task "jar_examplesAndroidO_${name}"(type: Jar, dependsOn: ["compile_examplesAndroidO",
869 "generate_examplesAndroidO_${name}"]) {
870 archiveName = jarName
871 destinationDir = exampleOutputDir
872 from "build/test/examplesAndroidO/classes" // Java 1.8 classes
873 from "build/test/examplesAndroidOLegacy/classes" // Java 1.6 classes
874 include "**/" + name + "/**/*.class"
875 // Do not include generator into the test runtime jar, it is not useful.
876 // Otherwise, shrinking will need ASM jars.
877 exclude "**/TestGenerator*"
878 }
879 }
880}
881
882task buildExamples {
Jean-Marie Henaff39587a82017-06-08 15:20:13 +0200883 if (OperatingSystem.current().isMacOsX() || OperatingSystem.current().isWindows()) {
884 logger.lifecycle("WARNING: Testing (including building examples) is only partially supported on your " +
885 "platform (" + OperatingSystem.current().getName() + ").")
Mads Ager418d1ca2017-05-22 09:35:49 +0200886 } else if (!OperatingSystem.current().isLinux()) {
887 logger.lifecycle("WARNING: Testing (including building examples) is not supported on your platform. " +
Jean-Marie Henaff39587a82017-06-08 15:20:13 +0200888 "It is fully supported on Linux and partially supported on Mac OS and Windows")
Mads Ager418d1ca2017-05-22 09:35:49 +0200889 return;
890 }
891 dependsOn buildDebugTestResourcesJars
892 dependsOn buildExampleJars
893 dependsOn buildExampleAndroidNJars
894 dependsOn buildExampleAndroidOJars
895 def examplesDir = file("src/test/examples")
Yohann Rousself820a572017-05-31 20:25:51 +0200896 def noDexTests = [
897 "multidex",
898 "multidex002",
899 "multidex004",
900 ]
Mads Ager418d1ca2017-05-22 09:35:49 +0200901 examplesDir.eachDir { dir ->
902 def name = dir.getName();
Yohann Rousself820a572017-05-31 20:25:51 +0200903 if (!(name in noDexTests)) {
904 dependsOn "dex_example_${name}"
905 def exampleOutputDir = file("build/test/examples/" + name);
906 def dexPath = file("${exampleOutputDir}")
907 def debug = (name == "throwing")
908 if (!dexPath.exists()) {
909 dexPath.mkdirs()
910 }
911 task "dex_example_${name}"(type: dx.Dx, dependsOn: "jar_example_${name}") {
912 source = files(tasks.getByPath("jar_example_${name}")).asFileTree
913 destination = dexPath
914 debug = debug
915 }
Mads Ager418d1ca2017-05-22 09:35:49 +0200916 }
917 }
918}
919
920task buildSmali {
921 def smaliDir = file("src/test/smali")
922 smaliDir.eachDirRecurse() { dir ->
923 def name = dir.getName();
924 def relativeDir = smaliDir.toPath().relativize(dir.toPath());
925 def smaliOutputDir = file("build/test/smali/" + relativeDir);
926 smaliOutputDir.mkdirs()
927 outputs.dir smaliOutputDir
928 def taskName = "smali_build_${relativeDir.toString().replace('/', '_')}"
929 def smaliFiles = fileTree(dir: dir, include: '*.smali')
930 def javaFiles = fileTree(dir: dir, include: '*.java')
931 def destDir = smaliOutputDir;
932 def destFile = destDir.toPath().resolve("${name}.dex").toFile()
933 def intermediateFileName = "${name}-intermediate.dex";
934 def intermediateFile = destDir.toPath().resolve(intermediateFileName).toFile()
935 if (javaFiles.empty) {
936 if (!smaliFiles.empty) {
937 dependsOn "${taskName}_smali"
938 task "${taskName}_smali"(type: smali.Smali) {
939 source = smaliFiles
940 destination = destFile
941 }
942 }
943 } else {
944 dependsOn "${taskName}_dexmerger"
945 task "${taskName}_smali"(type: smali.Smali) {
946 source = smaliFiles
947 destination = intermediateFile
948 }
949 task "${taskName}_java"(type: JavaCompile) {
950 source = javaFiles
951 destinationDir destDir
952 classpath = sourceSets.main.compileClasspath
953 sourceCompatibility = JavaVersion.VERSION_1_7
954 targetCompatibility = JavaVersion.VERSION_1_7
955 options.compilerArgs += ["-Xlint:-options"]
956 }
957 task "${taskName}_jar"(type: Jar, dependsOn: "${taskName}_java") {
958 archiveName = "Test.jar"
959 destinationDir = destDir
960 from fileTree(dir: destDir, include: 'Test.class')
961 }
962 task "${taskName}_dx"(type: dx.Dx, dependsOn: "${taskName}_jar") {
963 source = fileTree(dir: destDir, include: 'Test.jar')
964 destination = destDir
965 }
966 task "${taskName}_dexmerger"(
967 type: dx.DexMerger, dependsOn: ["${taskName}_dx", "${taskName}_smali"]) {
968 source = fileTree(dir: destDir, include: ["classes.dex", intermediateFileName])
969 destination = destFile
970 }
971 }
972 }
973}
974
975tasks.withType(Test) {
976 def userDefinedCoresPerFork = System.getenv('R8_GRADLE_CORES_PER_FORK')
977 def coresPerFork = userDefinedCoresPerFork ? userDefinedCoresPerFork.toInteger() : 3
978 // See https://docs.gradle.org/current/dsl/org.gradle.api.tasks.testing.Test.html.
979 maxParallelForks = Runtime.runtime.availableProcessors().intdiv(coresPerFork) ?: 1
980 forkEvery = 0
981 // Use the Concurrent Mark Sweep GC (CMS) to keep memory usage at a resonable level.
982 jvmArgs = ["-XX:+UseConcMarkSweepGC"]
Søren Gjesseaf1c5e22017-06-15 12:24:03 +0200983 if (project.hasProperty('disable_assertions')) {
984 enableAssertions = false
985 }
Mads Ager418d1ca2017-05-22 09:35:49 +0200986}
987
988task buildPreNJdwpTestsJar(type: Jar) {
989 baseName = 'jdwp-tests-preN'
990 from zipTree('third_party/jdwp-tests/apache-harmony-jdwp-tests-host.jar')
991 // Exclude the classes containing java8
992 exclude 'org/apache/harmony/jpda/tests/jdwp/InterfaceType/*.class'
993 exclude 'org/apache/harmony/jpda/tests/jdwp/ObjectReference/InvokeMethodDefault*.class'
994 includeEmptyDirs = false
995}
996
Yohann Roussel126f6872017-08-03 16:25:32 +0200997task supportLibDir() {
998 doLast {
999 File dir = file("build/supportlibraries")
1000 dir.mkdir()
1001 }
1002}
1003
1004configurations.supportLibs.files.each { file ->
1005 if (file.getName().endsWith(".aar")) {
1006 def name = "extract_"+file.getName()
1007 task "${name}"(type: Copy) {
1008 dependsOn supportLibDir
1009 from zipTree(file)
1010 into "build/supportlibraries"
1011 eachFile { FileCopyDetails fcp ->
1012 if (fcp.relativePath.pathString.equals("classes.jar")) {
1013 // remap the file to the root with correct name
1014 fcp.relativePath = new RelativePath(true, file.getName().replace(".aar", ".jar"))
1015 } else {
1016 fcp.exclude()
1017 }
1018 }
1019 }
1020 }
1021}
1022
1023task supportLibList() {
1024 configurations.supportLibs.files.each {
1025 if (it.getName().endsWith(".aar")) {
1026 dependsOn "extract_"+it.getName()
1027 }
1028 }
1029 doLast {
Yohann Roussel630dfe12017-08-03 17:24:08 +02001030 file("build/generated").mkdir()
Yohann Roussel126f6872017-08-03 16:25:32 +02001031 def file = file("build/generated/supportlibraries.txt")
1032 file.createNewFile()
1033 file.text = ""
1034 configurations.supportLibs.files.each {
1035 if (it.getName().endsWith(".aar")) {
1036 def outName = it.getName().replace(".aar", ".jar")
1037 file.text += ("build/supportlibraries/"
1038 + outName + "\n")
1039 } else {
1040 file.text += (it.getPath() + "\n")
1041 }
1042 }
1043 }
1044}
1045
Tamas Kenez0cad51c2017-08-21 14:42:01 +02001046task AospJarTest(type: Exec) {
1047 dependsOn CompatDx, downloadDeps
1048 def script = "tools/test_aosp_jar.py"
1049 inputs.file script
1050 commandLine "python", script, "--no-build"
1051 workingDir = projectDir
1052}
1053
Mads Ager418d1ca2017-05-22 09:35:49 +02001054test {
Yohann Roussel126f6872017-08-03 16:25:32 +02001055 dependsOn supportLibList
Mads Ager418d1ca2017-05-22 09:35:49 +02001056 testLogging.exceptionFormat = 'full'
1057 if (project.hasProperty('print_test_stdout')) {
1058 testLogging.showStandardStreams = true
1059 }
Tamas Kenez0cad51c2017-08-21 14:42:01 +02001060 if (project.hasProperty('dex_vm') && project.property('dex_vm') != 'default') {
Mads Ager418d1ca2017-05-22 09:35:49 +02001061 println "Running with non default vm: " + project.property('dex_vm')
1062 systemProperty 'dex_vm', project.property('dex_vm')
1063 if (project.property('dex_vm') == '5.1.1' || project.property('dex_vm') == '6.0.1') {
1064 // R8 and D8 compute the dex file version number based on the input.
1065 // Jack generates dex files with version 37 which art 5.1.1 and 6.0.1 will not run.
1066 // Therefore we skip the jack generated art tests with those art versions.
1067 exclude "com/android/tools/r8/art/jack/**"
1068 }
1069 }
Tamas Kenez0cad51c2017-08-21 14:42:01 +02001070
Mads Ager418d1ca2017-05-22 09:35:49 +02001071 if (project.hasProperty('one_line_per_test')) {
1072 beforeTest { desc ->
1073 println "Start executing test ${desc.name} [${desc.className}]"
1074 }
1075 afterTest { desc, result ->
1076 println "Done executing test ${desc.name} [${desc.className}] with result: ${result.resultType}"
1077 }
1078 }
1079 if (project.hasProperty('no_internal')) {
1080 exclude "com/android/tools/r8/internal/**"
1081 }
1082 if (project.hasProperty('only_internal')) {
1083 include "com/android/tools/r8/internal/**"
1084 }
1085 if (project.hasProperty('tool')) {
1086 if (project.property('tool') == 'r8') {
1087 exclude "com/android/tools/r8/art/*/d8/**"
Tamas Kenez69c2e8b2017-05-31 13:41:07 +02001088 exclude "com/android/tools/r8/jctf/d8/**"
Mads Ager418d1ca2017-05-22 09:35:49 +02001089 } else {
1090 assert(project.property('tool') == 'd8')
1091 exclude "com/android/tools/r8/art/*/r8/**"
Tamas Kenez69c2e8b2017-05-31 13:41:07 +02001092 exclude "com/android/tools/r8/jctf/r8/**"
Mads Ager418d1ca2017-05-22 09:35:49 +02001093 }
1094 }
1095 if (!project.hasProperty('all_tests')) {
1096 exclude "com/android/tools/r8/art/dx/**"
1097 exclude "com/android/tools/r8/art/jack/**"
1098 }
1099 // TODO(tamaskenez) enable jctf on all_tests when consolidated
1100 if (!project.hasProperty('jctf') && !project.hasProperty('only_jctf')) {
Stephan Herhutea6ee582017-05-23 13:14:34 +02001101 exclude "com/android/tools/r8/jctf/**"
Mads Ager418d1ca2017-05-22 09:35:49 +02001102 }
1103 if (project.hasProperty('only_jctf')) {
Stephan Herhutea6ee582017-05-23 13:14:34 +02001104 include "com/android/tools/r8/jctf/**"
Mads Ager418d1ca2017-05-22 09:35:49 +02001105 }
1106 if (project.hasProperty('jctf_compile_only')) {
1107 println "JCTF: compiling only"
1108 systemProperty 'jctf_compile_only', '1'
1109 }
Tamas Kenezb77b7d82017-08-17 14:05:16 +02001110 if (project.hasProperty('test_dir')) {
1111 systemProperty 'test_dir', project.property('test_dir')
1112 }
Tamas Kenez0cad51c2017-08-21 14:42:01 +02001113 if (project.hasProperty('aosp_jar')) {
1114 dependsOn AospJarTest
1115 }
Mads Ager418d1ca2017-05-22 09:35:49 +02001116
Jean-Marie Henaff39587a82017-06-08 15:20:13 +02001117 if (OperatingSystem.current().isLinux()
1118 || OperatingSystem.current().isMacOsX()
1119 || OperatingSystem.current().isWindows()) {
Mads Ager418d1ca2017-05-22 09:35:49 +02001120 if (OperatingSystem.current().isMacOsX()) {
1121 logger.lifecycle("WARNING: Testing in only partially supported on Mac OS. " +
1122 "Art only runs on Linux and tests requiring Art runs in a Docker container, which must be present. " +
1123 "See tools/docker/README.md for details.")
1124 }
Jean-Marie Henaff39587a82017-06-08 15:20:13 +02001125 if (OperatingSystem.current().isWindows()) {
1126 logger.lifecycle("WARNING: Testing in only partially supported on Windows. " +
1127 "Art only runs on Linux and tests requiring Art will be skipped")
1128 }
Mads Ager418d1ca2017-05-22 09:35:49 +02001129 dependsOn downloadDeps
1130 dependsOn buildExamples
1131 dependsOn buildSmali
1132 dependsOn jctfCommonJar
1133 dependsOn jctfTestsClasses
1134 dependsOn buildDebugInfoExamplesDex
1135 dependsOn buildPreNJdwpTestsJar
1136 } else {
1137 logger.lifecycle("WARNING: Testing in not supported on your platform. Testing is only fully supported on " +
Jean-Marie Henaff39587a82017-06-08 15:20:13 +02001138 "Linux and partially supported on Mac OS and Windows. Art does not run on other platforms.")
Mads Ager418d1ca2017-05-22 09:35:49 +02001139 }
1140}
1141
1142// The Art tests we use for R8 are pre-build and downloaded from Google Cloud Storage.
1143//
1144// To build and upload a new set of the Art tests for use with R8 follow these steps:
1145//
1146// First of all an Android checkout is required. Currently it must be located
1147// in $HOME/android/master.
1148//
1149// TODO(ricow): simplify this
1150//
1151// Before: update the checked in art, see scripts/update-host-art.sh
1152//
1153// 1. Get an android checkout in $HOME/android/master and apply the patch from
1154// https://android-review.googlesource.com/#/c/294187/
1155//
1156// 2. run the following commands in the Android checkout directory:
1157//
1158// source build/envsetup.sh
Søren Gjesse34b77732017-07-07 13:56:21 +02001159// lunch aosp_angler-userdebug # or lunch aosp_angler-eng
1160// m desugar
1161// m -j30 test-art-host
1162// DESUGAR=false ANDROID_COMPILE_WITH_JACK=false art/test.py --host -t 001-HelloWorld
1163//
1164// Without running the test.py command the classes.jar file used by desugar in
1165// $HOME/android/master/out/host/common/obj/JAVA_LIBRARIES/core-oj-hostdex_intermediates/
1166// seems to be missing - there is probably also a make target to build it more directly
Mads Ager418d1ca2017-05-22 09:35:49 +02001167//
1168// 3. In the R8 project root directory, make sure we have a clean state before starting:
1169// tools/gradle.py downloadDeps
1170// tools/gradle.py clean
1171// rm -rf tests/art
1172//
1173// 4. Now build in the R8 checkout (-P hack to not generate dirs when not running this target)
Søren Gjesse34b77732017-07-07 13:56:21 +02001174// Make sure you have smali on your path, please use the build binary in the
1175// out/host/linux-x86/bin directory of the android checkout. Currently this is version pre 2.2.1,
1176// if that is updated the call to smali in "task "${smaliToDexTask}"(type: Exec)" below might
1177// need to change as smali got a completely new command line interface in version 2.2.1.
Mads Ager418d1ca2017-05-22 09:35:49 +02001178//
Søren Gjesse34b77732017-07-07 13:56:21 +02001179// PATH=$HOME/android/master/out/host/linux-x86/bin:$PATH tools/gradle.py -Pandroid_source buildArtTests
Mads Ager418d1ca2017-05-22 09:35:49 +02001180//
1181// 4a. If any failures are produced in step 4, figure out what went wrong and add an entry in
1182// skippedTests with an explanation. Rerun from step 3.
1183//
1184// 5. Run the tests:
1185// tools/gradle.py clean
1186// tools/test.py
1187//
Søren Gjesse34b77732017-07-07 13:56:21 +02001188// 5a. If any more tests fail, either fix the issue or add them to the failuresToTriage list (note
1189// that you need to change "_" to "-" from stdout). Rerun from step 5 if anything was added to
1190// failuresToTriage.
Mads Ager418d1ca2017-05-22 09:35:49 +02001191//
Søren Gjesse34b77732017-07-07 13:56:21 +02001192// 6. To upload a new version to Google Cloud Storage:
Mads Ager418d1ca2017-05-22 09:35:49 +02001193// cd tests
1194// upload_to_google_storage.py -a --bucket r8-deps art
Søren Gjesse34b77732017-07-07 13:56:21 +02001195//
1196// 7. Update the manifest file describing the Android repo used:
1197// repo manifest -o <r8-checkout-root>/tools/linux/aosp_master_manifest.xml -r
Mads Ager418d1ca2017-05-22 09:35:49 +02001198
1199enum DexTool {
1200 JACK,
1201 DX
1202}
1203
1204def androidCheckoutDir = file("${System.env.HOME}/android/master")
1205def androidCheckoutJack = file("${androidCheckoutDir}/out/host/linux-x86/bin/jack");
1206def androidCheckoutJackServer = file("${androidCheckoutDir}/out/host/linux-x86/bin/jack-admin");
1207
1208def artTestDir = file("${androidCheckoutDir}/art/test")
1209
1210if (project.hasProperty('android_source')) {
1211 task buildArtTests {
1212 outputs.upToDateWhen { false }
1213 def toBeTriaged = [
1214 "903-hello-tagging",
1215 "904-object-allocation",
1216 "905-object-free",
1217 "906-iterate-heap",
1218 "907-get-loaded-classes",
1219 "908-gc-start-finish",
1220 "954-invoke-polymorphic-verifier",
1221 "955-methodhandles-smali",
1222 "596-monitor-inflation",
1223 ]
1224 def skippedTests = toBeTriaged + [
1225 // This test produces no jar.
1226 "000-nop",
1227 // This does not build, as it tests the error when the application exceeds more
1228 // than 65536 methods
1229 "089-many-methods",
1230 // Requires some jack beta jar
1231 "956-methodhandles",
1232 ]
1233
1234 def skippedTestsDx = [
1235 // Tests with custom build scripts, where javac is not passed the options
1236 // -source 1.7 -target 1.7.
1237 "462-checker-inlining-across-dex-files",
1238 "556-invoke-super",
1239 "569-checker-pattern-replacement",
1240 // These tests use jack even when --build-with-javac-dx is specified.
1241 "004-JniTest",
1242 "048-reflect-v8",
1243 "146-bad-interface",
1244 "563-checker-invoke-super",
1245 "580-checker-string-fact-intrinsics", // java.lang.StringFactory
1246 "604-hot-static-interface",
1247 "957-methodhandle-transforms",
1248 "958-methodhandle-emulated-stackframe",
1249 "959-invoke-polymorphic-accessors",
1250 "961-default-iface-resolution-gen",
1251 "962-iface-static",
1252 "963-default-range-smali",
1253 "964-default-iface-init-gen",
1254 "965-default-verify",
1255 "966-default-conflict",
1256 "967-default-ame",
1257 "968-default-partial-compile-gen",
1258 "969-iface-super",
1259 "970-iface-super-resolution-gen",
1260 "971-iface-super",
1261 // These tests does not build with --build-with-javac-dx
1262 "004-NativeAllocations", // Javac error
1263 "031-class-attributes",
1264 "138-duplicate-classes-check",
1265 "157-void-class", // Javac error
1266 "580-checker-string-factory-intrinsics",
1267 "612-jit-dex-cache",
1268 "613-inlining-dex-cache",
1269 "900-hello-plugin", // --experimental agents
1270 "901-hello-ti-agent", // --experimental agents
1271 "902-hello-transformation", // --experimental agents
1272 "909-attach-agent", // --experimental agents
1273 "946-obsolete-throw", // -source 1.7 -target 1.7, but use lambda
1274 "950-redefine-intrinsic", // -source 1.7 -target 1.7, but use method references
1275 "951-threaded-obsolete", // -source 1.7 -target 1.7, but use lambda
1276 "960-default-smali", // --experimental default-methods
1277 // These tests force the build to use jack
1278 "953-invoke-polymorphic-compiler",
1279 "958-methodhandle-stackframe",
1280 ]
1281
1282 def artTestBuildDir = file("${projectDir}/tests/art")
1283
1284 if (androidCheckoutDir.exists()) {
1285 dependsOn downloadDeps
1286 artTestBuildDir.mkdirs()
1287 // Ensure Jack server is running.
1288 "${androidCheckoutJackServer} start-server".execute()
1289 artTestDir.eachDir { dir ->
1290 def name = dir.getName();
1291 def markerFile = dir.toPath().resolve("info.txt").toFile();
1292 if (markerFile.exists() && !(name in skippedTests)) {
1293 if (!(name in skippedTestsDx)) {
1294 dependsOn buildArtTest(androidCheckoutDir, artTestBuildDir, dir, DexTool.DX);
1295 }
1296 dependsOn buildArtTest(androidCheckoutDir, artTestBuildDir, dir, DexTool.JACK);
1297 }
1298 }
1299 }
1300 doFirst {
1301 if (!androidCheckoutDir.exists()) {
1302 throw new InvalidUserDataException(
1303 "This task requires an Android checkout in ${androidCheckoutDir}");
1304 } else if (!androidCheckoutJack.exists() ||
1305 !androidCheckoutJackServer.exists()) {
1306 throw new InvalidUserDataException(
1307 "This task requires that tools for host testing have been build in the " +
1308 "Android checkout in ${androidCheckoutDir}");
1309 }
1310 }
1311 doLast {
1312 copy {
1313 from file("${androidCheckoutDir}/out/host/linux-x86/nativetest64")
1314 into file("${artTestBuildDir}/lib64")
1315 include 'lib*.so'
1316 }
1317 copy {
1318 from file("${androidCheckoutDir}/out/host/linux-x86/lib64")
1319 into file("${artTestBuildDir}/lib64")
1320 include 'libart.so'
1321 include 'libbacktrace.so'
1322 include 'libbase.so'
1323 include 'libc++.so'
1324 include 'libcutils.so'
1325 include 'liblz4.so'
1326 include 'liblzma.so'
1327 include 'libnativebridge.so'
1328 include 'libnativeloader.so'
1329 include 'libsigchain.so'
1330 include 'libunwind.so'
1331 include 'libziparchive.so'
1332 }
1333 copy {
1334 from file("${androidCheckoutDir}/out/host/linux-x86/nativetest")
1335 into file("${artTestBuildDir}/lib")
1336 include 'lib*.so'
1337 }
1338 copy {
1339 from file("${androidCheckoutDir}/out/host/linux-x86/lib")
1340 into file("${artTestBuildDir}/lib")
1341 include 'libart.so'
1342 include 'libbacktrace.so'
1343 include 'libbase.so'
1344 include 'libc++.so'
1345 include 'libcutils.so'
1346 include 'liblz4.so'
1347 include 'liblzma.so'
1348 include 'libnativebridge.so'
1349 include 'libnativeloader.so'
1350 include 'libsigchain.so'
1351 include 'libunwind.so'
1352 include 'libziparchive.so'
1353 }
1354 }
1355 }
1356}
1357
1358def buildArtTest(androidCheckoutDir, artTestBuildDir, dir, dexTool) {
1359 def artTestDir = file("${androidCheckoutDir}/art/test")
1360 def artRunTestScript = file("${artTestDir}/run-test")
1361 def dxExecutable = new File("tools/linux/dx/bin/dx");
Jean-Marie Henaff34d85f72017-06-14 10:32:04 +02001362 def dexMergerExecutable = Utils.dexMergerExecutable()
Mads Ager418d1ca2017-05-22 09:35:49 +02001363 def dexToolName = dexTool == DexTool.DX ? "dx" : "jack"
1364
Søren Gjesse34b77732017-07-07 13:56:21 +02001365 def name = dir.getName()
Mads Ager418d1ca2017-05-22 09:35:49 +02001366 def buildTask = "build_art_test_${dexToolName}_${name}"
1367 def sanitizeTask = "sanitize_art_test_${dexToolName}_${name}"
1368 def copyCheckTask = "copy_check_art_test_${dexToolName}_${name}"
1369 def smaliToDexTask = "smali_to_dex_${dexToolName}_${name}"
1370
1371 def buildInputs = fileTree(dir: dir, include: '**/*')
1372 def testDir = file("${artTestBuildDir}/${dexToolName}/${name}")
1373 def outputJar = testDir.toPath().resolve("${name}.jar").toFile()
1374 testDir.mkdirs()
1375 if (dexTool == DexTool.DX) {
1376 task "$buildTask"(type: Exec) {
1377 outputs.upToDateWhen { false }
1378 inputs.file buildInputs
1379 executable "${artRunTestScript}"
1380 args "--host"
1381 args "--build-only"
1382 args "--build-with-javac-dx"
1383 args "--output-path", "${testDir}"
1384 args "${name}"
1385 environment DX: "${dxExecutable.absolutePath}"
1386 environment DXMERGER: "${dexMergerExecutable.absolutePath}"
Søren Gjesse34b77732017-07-07 13:56:21 +02001387 environment ANDROID_BUILD_TOP: "${androidCheckoutDir}"
Mads Ager418d1ca2017-05-22 09:35:49 +02001388 outputs.file outputJar
1389 }
1390 } else {
1391 assert dexTool == DexTool.JACK
1392 def javaLibs = "${androidCheckoutDir}/out/host/common/obj/JAVA_LIBRARIES"
1393 def jackClasspath = "${javaLibs}/core-libart-hostdex_intermediates/classes.jack:" +
1394 "${javaLibs}/core-oj-hostdex_intermediates/classes.jack"
1395 task "$buildTask"(type: Exec) {
1396 outputs.upToDateWhen { false }
1397 inputs.file buildInputs
1398 executable "${artRunTestScript}"
1399 args "--host"
1400 args "--build-only"
1401 args "--output-path", "${testDir}"
1402 args "${name}"
1403 environment JACK: "${androidCheckoutDir}/out/host/linux-x86/bin/jack"
1404 environment JACK_CLASSPATH: jackClasspath
1405 environment DXMERGER: "${dexMergerExecutable.absolutePath}"
1406 environment ANDROID_BUILD_TOP: "${androidCheckoutDir}"
1407 outputs.file outputJar
1408 }
1409 }
1410 task "${sanitizeTask}"(type: Exec, dependsOn: buildTask) {
1411 outputs.upToDateWhen { false }
1412 executable "/bin/bash"
1413 args "-c"
1414 args "rm -rf ${testDir}/smali_*.dex ${testDir}/*-ex.dex ${testDir}/*-ex.jar" +
1415 " ${testDir}/classes-ex ${testDir}/check"
1416 }
1417
1418 task "${smaliToDexTask}"(type: Exec) {
1419 workingDir "${testDir}/smali"
1420 executable "/bin/bash"
Søren Gjesse34b77732017-07-07 13:56:21 +02001421 // This is the command line options for smali prior to 2.2.1, where smali got a new
1422 // command line interface.
1423 args "-c", "smali a *.smali"
1424 // This is the command line options for smali 2.2.1 and later.
1425 // args "-c", "smali -o out.dex *.smali"
Mads Ager418d1ca2017-05-22 09:35:49 +02001426 }
1427
1428 task "${copyCheckTask}"(type: Copy, dependsOn: sanitizeTask) {
1429 def smali_dir = file("${dir}/smali")
1430 outputs.upToDateWhen { false }
1431 if (smali_dir.exists() && dexTool == DexTool.DX) {
1432 dependsOn smaliToDexTask
1433 }
1434 from("${artTestDir}/${name}") {
1435 include 'check'
1436 }
1437 into testDir
1438 }
1439
1440 return copyCheckTask
1441}
1442
1443task javadocD8(type: Javadoc) {
1444 classpath = sourceSets.main.compileClasspath
1445 source = sourceSets.main.allJava
1446 include '**/com/android/tools/r8/BaseCommand.java'
1447 include '**/com/android/tools/r8/BaseOutput.java'
1448 include '**/com/android/tools/r8/CompilationException.java'
1449 include '**/com/android/tools/r8/CompilationMode.java'
1450 include '**/com/android/tools/r8/D8.java'
1451 include '**/com/android/tools/r8/D8Command.java'
1452 include '**/com/android/tools/r8/D8Output.java'
1453 include '**/com/android/tools/r8/Resource.java'
1454}