blob: 419bbae434b5b55dccfaaa3a813ff5116d860d54 [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
5import utils.Utils;
Mads Ager418d1ca2017-05-22 09:35:49 +02006
7apply plugin: 'java'
8apply plugin: 'idea'
9apply plugin: 'jacoco'
10
11apply from: 'copyAdditionalJctfCommonFiles.gradle'
12
13repositories {
14 mavenCentral()
15}
16
17// Custom source set for example tests and generated tests.
18sourceSets {
19 test {
20 java {
21 srcDirs = [
22 'src/test/java',
23 'build/generated/test/java',
24 ]
25 }
26 }
27 debugTestResources {
28 java {
29 srcDirs = ['src/test/debugTestResources']
30 }
31 output.resourcesDir = 'build/classes/debugTestResources'
32 }
Sebastien Hertz964c5c22017-05-23 15:22:23 +020033 debugTestResourcesJava8 {
34 java {
35 srcDirs = ['src/test/debugTestResourcesJava8']
36 }
37 output.resourcesDir = 'build/classes/debugTestResourcesJava8'
38 }
Mads Ager418d1ca2017-05-22 09:35:49 +020039 examples {
40 java {
41 srcDirs = ['src/test/examples']
42 }
43 output.resourcesDir = 'build/classes/examples'
44 }
45 examplesAndroidN {
46 java {
47 srcDirs = ['src/test/examplesAndroidN']
48 }
49 output.resourcesDir = 'build/classes/examplesAndroidN'
50 }
51 examplesAndroidO {
52 java {
53 srcDirs = ['src/test/examplesAndroidO']
54 }
55 output.resourcesDir = 'build/classes/examplesAndroidO'
56 }
57 jctfCommon {
58 java {
59 srcDirs = [
60 'third_party/jctf/Harness/src',
61 'third_party/jctf/LibTests/src/com/google/jctf/test/categories',
62 'third_party/jctf/LibTests/src/com/google/jctf/test/helper',
63 'third_party/jctf/LibTests/src/com/google/jctf/testHelpers',
64 'third_party/jctf/LibTests/src/org',
65 'build/additionalJctfCommonFiles'
66 ]
67 }
68 resources {
69 srcDirs = ['third_party/jctf/LibTests/resources']
70 }
71 }
72 jctfTests {
73 java {
74 srcDirs = [
75 'third_party/jctf/LibTests/src/com/google/jctf/test/lib',
76 // 'third_party/jctf/VMTests/src',
77 ]
78 }
79 }
80}
81
82dependencies {
83 compile 'net.sf.jopt-simple:jopt-simple:4.6'
84 compile group: 'com.google.guava', name: 'guava', version: '19.0'
Stephan Herhutb17bb8d2017-05-23 12:34:55 +020085 compile group: 'it.unimi.dsi', name: 'fastutil', version: '7.2.0'
Mads Ager418d1ca2017-05-22 09:35:49 +020086 compile group: 'org.apache.commons', name: 'commons-compress', version: '1.12'
87 compile group: 'org.ow2.asm', name: 'asm', version: '5.1'
88 compile group: 'org.ow2.asm', name: 'asm-commons', version: '5.1'
89 compile group: 'org.ow2.asm', name: 'asm-tree', version: '5.1'
90 compile group: 'org.ow2.asm', name: 'asm-util', version: '5.1'
91 testCompile sourceSets.examples.output
92 testCompile 'junit:junit:4.12'
93 testCompile group: 'org.smali', name: 'smali', version: '2.2b4'
94 testCompile files('third_party/jasmin/jasmin-2.4.jar')
95 testCompile files('third_party/jdwp-tests/apache-harmony-jdwp-tests-host.jar')
96 jctfCommonCompile 'junit:junit:4.12'
97 jctfTestsCompile 'junit:junit:4.12'
98 jctfTestsCompile sourceSets.jctfCommon.output
99 examplesAndroidOCompile group: 'org.ow2.asm', name: 'asm', version: '5.1'
100}
101
Jean-Marie Henaff39587a82017-06-08 15:20:13 +0200102def osString = OperatingSystem.current().isLinux() ? "linux" :
103 OperatingSystem.current().isMacOsX() ? "mac" : "windows"
Mads Ager418d1ca2017-05-22 09:35:49 +0200104
105def cloudDependencies = [
106 "tests" : [
107 "art.tar.gz"
108 ],
109 "third_party": [
110 "android_jar/lib-v14.tar.gz",
111 "android_jar/lib-v19.tar.gz",
Søren Gjesseab220772017-06-23 13:05:53 +0200112 "android_jar/lib-v21.tar.gz",
Mads Ager418d1ca2017-05-22 09:35:49 +0200113 "android_jar/lib-v24.tar.gz",
114 "android_jar/lib-v25.tar.gz",
115 "android_jar/lib-v26.tar.gz",
116 "proguard/proguard5.2.1.tar.gz",
117 "gradle/gradle.tar.gz",
118 "jdwp-tests.tar.gz",
119 "jasmin.tar.gz",
120 "jctf.tar.gz",
121 "android_cts_baseline.tar.gz",
122 ],
123 // All dex-vms have a fixed OS of Linux, as they are only supported on Linux, and will be run in a Docker
124 // container on other platforms where supported.
125 "tools" : [
126 "linux/art.tar.gz",
127 "linux/art-5.1.1.tar.gz",
128 "linux/art-6.0.1.tar.gz",
129 "linux/art-7.0.0.tar.gz",
130 "linux/dalvik.tar.gz",
131 "${osString}/dx.tar.gz",
132 ]
133]
134
135cloudDependencies.each { entry ->
136 entry.value.each { entryFile ->
137 task "download_deps_${entry.key}/${entryFile}"(type: Exec) {
138 def gzFile = "${entry.key}/${entryFile}"
139 def sha1File = "${gzFile}.sha1"
140 inputs.file sha1File
141 outputs.file gzFile
Jean-Marie Henaff872e4422017-06-13 10:26:20 +0200142 List<String> dlFromStorageArgs = ["-n", "-b", "r8-deps", "-u", "-s", "${sha1File}"]
143 if (OperatingSystem.current().isWindows()) {
144 executable "download_from_google_storage.bat"
145 args dlFromStorageArgs
146 } else {
147 executable "bash"
148 args "-c", "download_from_google_storage " + String.join(" ", dlFromStorageArgs)
149 }
Mads Ager418d1ca2017-05-22 09:35:49 +0200150 }
151 }
152}
153
154def x20Dependencies = [
155 "third_party": [
Søren Gjesse5ecb04a2017-06-13 09:44:32 +0200156 "gmail/gmail_android_170604.16.tar.gz",
Mads Ager418d1ca2017-05-22 09:35:49 +0200157 "gmscore/v4.tar.gz",
158 "gmscore/v5.tar.gz",
159 "gmscore/v6.tar.gz",
160 "gmscore/v7.tar.gz",
161 "gmscore/v8.tar.gz",
162 "gmscore/gmscore_v9.tar.gz",
163 "gmscore/gmscore_v10.tar.gz",
Stephan Herhut4e743302017-06-09 13:09:03 +0200164 "gmscore/latest.tar.gz",
Mads Agerae646402017-06-07 13:32:43 +0200165 "photos/2017-06-06.tar.gz",
Mads Ager418d1ca2017-05-22 09:35:49 +0200166 "youtube/youtube.android_12.10.tar.gz",
Søren Gjessefeac2ef2017-05-22 17:09:29 +0200167 "youtube/youtube.android_12.17.tar.gz",
Søren Gjesse9be84982017-06-09 14:21:03 +0200168 "youtube/youtube.android_12.22.tar.gz",
Mads Ager418d1ca2017-05-22 09:35:49 +0200169 "proguardsettings.tar.gz",
Tamas Kenez5febf242017-06-20 16:00:44 +0200170 "proguard/proguard_internal_159423826.tar.gz",
Tamas Kenez67419712017-06-26 11:11:45 +0200171 "framework.tar.gz",
Mads Ager418d1ca2017-05-22 09:35:49 +0200172 ],
173]
174
175x20Dependencies.each { entry ->
176 entry.value.each { entryFile ->
177 task "download_deps_${entry.key}/${entryFile}"(type: Exec) {
178 def gzFile = "${entry.key}/${entryFile}"
179 def sha1File = "${gzFile}.sha1"
180 inputs.file sha1File
181 outputs.file gzFile
182 executable "bash"
183 args "-c", "tools/download_from_x20.py ${sha1File}"
184 }
185 }
186}
187
Rico Wind897bb712017-05-23 10:44:29 +0200188task downloadProguard {
189 cloudDependencies.each { entry ->
190 entry.value.each { entryFile ->
191 if (entryFile.contains("proguard")) {
192 dependsOn "download_deps_${entry.key}/${entryFile}"
193 }
194 }
195 }
196}
197
Tamas Kenez427205b2017-06-29 15:57:09 +0200198task downloadDx {
199 cloudDependencies.each { entry ->
200 entry.value.each { entryFile ->
201 if (entryFile.contains("dx.tar")) {
202 dependsOn "download_deps_${entry.key}/${entryFile}"
203 }
204 }
205 }
206}
207
Tamas Kenez0e10c562017-06-08 10:00:34 +0200208task downloadAndroidCts {
209 cloudDependencies.each { entry ->
210 entry.value.each { entryFile ->
211 if (entryFile.contains("android_cts_baseline")) {
212 dependsOn "download_deps_${entry.key}/${entryFile}"
213 }
214 }
215 }
216}
217
Mads Ager418d1ca2017-05-22 09:35:49 +0200218task downloadDeps {
219 cloudDependencies.each { entry ->
220 entry.value.each { entryFile ->
221 dependsOn "download_deps_${entry.key}/${entryFile}"
222 }
223 }
224 if (!project.hasProperty('no_internal')) {
225 x20Dependencies.each { entry ->
226 entry.value.each { entryFile ->
227 dependsOn "download_deps_${entry.key}/${entryFile}"
228 }
229 }
230 }
231}
232
233allprojects {
234 sourceCompatibility = JavaVersion.VERSION_1_8
235 targetCompatibility = JavaVersion.VERSION_1_8
236}
237
238tasks.withType(JavaCompile) {
239 options.compilerArgs << '-Xlint:unchecked'
240}
241
242compileJctfCommonJava {
243 dependsOn 'copyAdditionalJctfCommonFiles'
244 options.compilerArgs = ['-Xlint:none']
245}
246
247compileJctfTestsJava {
248 dependsOn 'jctfCommonClasses'
249 options.compilerArgs = ['-Xlint:none']
250}
251
252task R8(type: Jar) {
253 from sourceSets.main.output
254 baseName 'r8'
255 manifest {
256 attributes 'Main-Class': 'com.android.tools.r8.R8'
257 }
258 // In order to build without dependencies, pass the exclude_deps property using:
259 // gradle -Pexclude_deps R8
260 if (!project.hasProperty('exclude_deps')) {
261 // Also include dependencies
262 from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
263 }
264}
265
266task D8(type: Jar) {
267 from sourceSets.main.output
268 baseName 'd8'
269 manifest {
270 attributes 'Main-Class': 'com.android.tools.r8.D8'
271 }
272 // In order to build without dependencies, pass the exclude_deps property using:
273 // gradle -Pexclude_deps D8
274 if (!project.hasProperty('exclude_deps')) {
275 // Also include dependencies
276 from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
277 }
278}
279
280task CompatDx(type: Jar) {
281 from sourceSets.main.output
282 baseName 'compatdx'
283 manifest {
284 attributes 'Main-Class': 'com.android.tools.r8.compatdx.CompatDx'
285 }
286 // In order to build without dependencies, pass the exclude_deps property using:
287 // gradle -Pexclude_deps CompatDx
288 if (!project.hasProperty('exclude_deps')) {
289 // Also include dependencies
290 from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
291 }
292}
293
Tamas Kenez971eec62017-05-24 11:08:40 +0200294task D8Logger(type: Jar) {
295 from sourceSets.main.output
296 baseName 'd8logger'
297 manifest {
298 attributes 'Main-Class': 'com.android.tools.r8.D8Logger'
299 }
300 // In order to build without dependencies, pass the exclude_deps property using:
301 // gradle -Pexclude_deps D8Logger
302 if (!project.hasProperty('exclude_deps')) {
303 // Also include dependencies
304 from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
305 }
306}
307
Mads Ager418d1ca2017-05-22 09:35:49 +0200308task disasm(type: Jar) {
309 from sourceSets.main.output
310 baseName 'disasm'
311 manifest {
312 attributes 'Main-Class': 'com.android.tools.r8.Disassemble'
313 }
314 // In order to build without dependencies, pass the exclude_deps property using:
315 // gradle -Pexclude_deps D8
316 if (!project.hasProperty('exclude_deps')) {
317 // Also include dependencies
318 from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
319 }
320}
321
322task bisect(type: Jar) {
323 from sourceSets.main.output
324 baseName 'bisect'
325 manifest {
326 attributes 'Main-Class': 'com.android.tools.r8.bisect.Bisect'
327 }
328 // In order to build without dependencies, pass the exclude_deps property using:
329 // gradle -Pexclude_deps R8
330 if (!project.hasProperty('exclude_deps')) {
331 // Also include dependencies
332 from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
333 }
334}
335
Lars Bak90c18042017-06-26 14:21:08 +0200336task DexSegments(type: Jar) {
337 from sourceSets.main.output
338 baseName 'dexsegments'
339 manifest {
340 attributes 'Main-Class': 'com.android.tools.r8.DexSegments'
341 }
342 // In order to build without dependencies, pass the exclude_deps property using:
343 // gradle -Pexclude_deps DexSegments
344 if (!project.hasProperty('exclude_deps')) {
345 // Also include dependencies
346 from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
347 }
348}
349
Mads Ager418d1ca2017-05-22 09:35:49 +0200350task sourceJar(type: Jar, dependsOn: classes) {
351 classifier = 'src'
352 from sourceSets.main.allSource
353}
354
355task jctfCommonJar(type: Jar) {
356 from sourceSets.jctfCommon.output
357 baseName 'jctfCommon'
358}
359
360artifacts {
361 archives sourceJar
362}
363
364task createArtTests(type: Exec) {
365 def outputDir = "build/generated/test/java/com/android/tools/r8/art"
Mads Ager7e5bd722017-05-24 07:17:27 +0200366 def createArtTestsScript = "tools/create_art_tests.py"
Mads Ager418d1ca2017-05-22 09:35:49 +0200367 inputs.file "tests/art.tar.gz"
368 inputs.file createArtTestsScript
369 outputs.dir outputDir
370 dependsOn downloadDeps
Mads Ager677e3002017-05-24 07:54:51 +0200371 commandLine "python", createArtTestsScript
Mads Ager418d1ca2017-05-22 09:35:49 +0200372 workingDir = projectDir
373}
374
375task createJctfTests(type: Exec) {
Stephan Herhutea6ee582017-05-23 13:14:34 +0200376 def outputDir = "build/generated/test/java/com/android/tools/r8/jctf"
Tamas Kenez25a99e92017-05-29 10:15:30 +0200377 def script = "tools/create_jctf_tests.py"
Mads Ager418d1ca2017-05-22 09:35:49 +0200378 inputs.file script
379 outputs.dir outputDir
380 dependsOn downloadDeps
Tamas Kenez25a99e92017-05-29 10:15:30 +0200381 commandLine "python", script
Mads Ager418d1ca2017-05-22 09:35:49 +0200382 workingDir = projectDir
383}
384
385compileTestJava {
386 dependsOn createArtTests
387 dependsOn createJctfTests
388}
389
390task buildDebugInfoExamplesDex {
391 def examplesDir = file("src/test/java")
392 def hostJar = "debuginfo_examples.jar"
393 def hostDexJar = "debuginfo_examples_dex.jar"
394 task "compile_debuginfo_examples"(type: JavaCompile) {
395 source = fileTree(dir: examplesDir, include: "com/android/tools/r8/debuginfo/*Test.java")
396 destinationDir = file("build/test/debuginfo_examples/classes")
397 classpath = sourceSets.main.compileClasspath
398 sourceCompatibility = JavaVersion.VERSION_1_7
399 targetCompatibility = JavaVersion.VERSION_1_7
400 options.compilerArgs += ["-Xlint:-options"]
401 }
402 task "jar_debuginfo_examples"(type: Jar, dependsOn: "compile_debuginfo_examples") {
403 archiveName = hostJar
404 destinationDir = file("build/test/")
405 from "build/test/debuginfo_examples/classes"
406 include "**/*.class"
407 }
408 task "dex_debuginfo_examples"(type: Exec,
409 dependsOn: ["jar_debuginfo_examples", "downloadDeps"]) {
Jean-Marie Henaff39587a82017-06-08 15:20:13 +0200410 if (OperatingSystem.current().isWindows()) {
411 executable file("tools/windows/dx/bin/dx.bat")
412 } else {
413 executable file("tools/linux/dx/bin/dx");
414 }
Mads Ager418d1ca2017-05-22 09:35:49 +0200415 args "--dex"
416 args "--output=build/test/${hostDexJar}"
417 args "build/test/${hostJar}"
418 inputs.file file("build/test/${hostJar}")
419 outputs.file file("build/test/${hostDexJar}")
420 }
421 dependsOn dex_debuginfo_examples
422}
423
424task buildDebugTestResourcesJars {
Mads Ager418d1ca2017-05-22 09:35:49 +0200425 def resourcesDir = file("src/test/debugTestResources")
426 def hostJar = "debug_test_resources.jar"
427 task "compile_debugTestResources"(type: JavaCompile) {
428 source = fileTree(dir: resourcesDir, include: '**/*.java')
429 destinationDir = file("build/test/debugTestResources/classes")
430 classpath = sourceSets.main.compileClasspath
431 sourceCompatibility = JavaVersion.VERSION_1_7
432 targetCompatibility = JavaVersion.VERSION_1_7
433 options.compilerArgs += ["-g", "-Xlint:-options"]
434 }
435 task "jar_debugTestResources"(type: Jar, dependsOn: "compile_debugTestResources") {
436 archiveName = hostJar
437 destinationDir = file("build/test/")
438 from "build/test/debugTestResources/classes"
439 include "**/*.class"
440 }
Sebastien Hertz964c5c22017-05-23 15:22:23 +0200441 def java8ResourcesDir = file("src/test/debugTestResourcesJava8")
442 def java8HostJar = "debug_test_resources_java8.jar"
443 task "compile_debugTestResourcesJava8"(type: JavaCompile) {
444 source = fileTree(dir: java8ResourcesDir, include: '**/*.java')
445 destinationDir = file("build/test/debugTestResourcesJava8/classes")
446 classpath = sourceSets.main.compileClasspath
447 sourceCompatibility = JavaVersion.VERSION_1_8
448 targetCompatibility = JavaVersion.VERSION_1_8
449 options.compilerArgs += ["-g", "-Xlint:-options"]
450 }
451 task "jar_debugTestResourcesJava8"(type: Jar, dependsOn: "compile_debugTestResourcesJava8") {
452 archiveName = java8HostJar
453 destinationDir = file("build/test/")
454 from "build/test/debugTestResourcesJava8/classes"
455 include "**/*.class"
456 }
457 dependsOn downloadDeps
Mads Ager418d1ca2017-05-22 09:35:49 +0200458 dependsOn jar_debugTestResources
Sebastien Hertz964c5c22017-05-23 15:22:23 +0200459 dependsOn jar_debugTestResourcesJava8
Mads Ager418d1ca2017-05-22 09:35:49 +0200460}
461
462task buildExampleJars {
Rico Wind897bb712017-05-23 10:44:29 +0200463 dependsOn downloadProguard
Mads Ager418d1ca2017-05-22 09:35:49 +0200464 def examplesDir = file("src/test/examples")
Jean-Marie Henaff872e4422017-06-13 10:26:20 +0200465 def proguardScript
466 if (OperatingSystem.current().isWindows()) {
467 proguardScript = "third_party/proguard/proguard5.2.1/bin/proguard.bat"
468 } else {
469 proguardScript = "third_party/proguard/proguard5.2.1/bin/proguard.sh"
470 }
Mads Ager418d1ca2017-05-22 09:35:49 +0200471 task "compile_examples"(type: JavaCompile) {
472 source = fileTree(dir: examplesDir, include: '**/*.java')
473 destinationDir = file("build/test/examples/classes")
474 classpath = sourceSets.main.compileClasspath
475 sourceCompatibility = JavaVersion.VERSION_1_7
476 targetCompatibility = JavaVersion.VERSION_1_7
477 options.compilerArgs += ["-Xlint:-options"]
478 }
479 examplesDir.eachDir { dir ->
480 def name = dir.getName();
481 def exampleOutputDir = file("build/test/examples");
482 def jarName = "${name}.jar"
483 dependsOn "jar_example_${name}"
484 // The "throwing" test verifies debugging/stack info on the post-proguarded output.
485 def proguardConfigPath = "${dir}/proguard.cfg"
486 if (new File(proguardConfigPath).exists()) {
487 task "pre_proguard_example_${name}"(type: Jar, dependsOn: "compile_examples") {
488 archiveName = "${name}_pre_proguard.jar"
489 destinationDir = exampleOutputDir
490 from "build/test/examples/classes"
491 include "**/" + name + "/**/*.class"
492 }
493 def jarPath = files(tasks.getByPath("pre_proguard_example_${name}")).files.first();
494 def proguardJarPath = "${exampleOutputDir}/${jarName}"
495 def proguardMapPath = "${exampleOutputDir}/${name}/${name}.map"
496 task "jar_example_${name}"(type: Exec, dependsOn: "pre_proguard_example_${name}") {
497 inputs.files tasks.getByPath("pre_proguard_example_${name}")
498 inputs.file proguardConfigPath
499 // Enable these to get stdout and stderr redirected to files...
500 // standardOutput = new FileOutputStream('proguard.stdout')
501 // errorOutput = new FileOutputStream('proguard.stderr')
Jean-Marie Henaff872e4422017-06-13 10:26:20 +0200502 def proguardArguments = "-verbose -dontwarn java.** -injars ${jarPath}" +
Mads Ager418d1ca2017-05-22 09:35:49 +0200503 " -outjars ${proguardJarPath}" +
504 " -include ${proguardConfigPath}" +
Jean-Marie Henaff872e4422017-06-13 10:26:20 +0200505 " -printmapping ${proguardMapPath}"
506 if (OperatingSystem.current().isWindows()) {
507 executable "${proguardScript}"
508 args "${proguardArguments}"
509 } else {
510 executable "bash"
511 args "-c", "${proguardScript} '${proguardArguments}'"
512 }
Mads Ager418d1ca2017-05-22 09:35:49 +0200513 outputs.file proguardJarPath
514 }
515 } else {
516 task "jar_example_${name}"(type: Jar, dependsOn: "compile_examples") {
517 archiveName = jarName
518 destinationDir = exampleOutputDir
519 from "build/test/examples/classes"
520 include "**/" + name + "/**/*.class"
521 }
522 }
523 }
524}
525
526task buildExampleAndroidNJars {
527 dependsOn downloadDeps
528 def examplesDir = file("src/test/examplesAndroidN")
529 task "compile_examplesAndroidN"(type: JavaCompile) {
530 source = fileTree(dir: examplesDir, include: '**/*.java')
531 destinationDir = file("build/test/examplesAndroidN/classes")
532 classpath = sourceSets.main.compileClasspath
533 sourceCompatibility = JavaVersion.VERSION_1_8
534 targetCompatibility = JavaVersion.VERSION_1_8
535 options.compilerArgs += ["-Xlint:-options"]
536 }
537 examplesDir.eachDir { dir ->
538 def name = dir.getName();
539 def exampleOutputDir = file("build/test/examplesAndroidN");
540 def jarName = "${name}.jar"
541 dependsOn "jar_examplesAndroidN_${name}"
542 task "jar_examplesAndroidN_${name}"(type: Jar, dependsOn: "compile_examplesAndroidN") {
543 archiveName = jarName
544 destinationDir = exampleOutputDir
545 from "build/test/examplesAndroidN/classes"
546 include "**/" + name + "/**/*.class"
547 }
548 }
549}
550
551
552task buildExampleAndroidOJars {
553 dependsOn downloadDeps
554 def examplesDir = file("src/test/examplesAndroidO")
555 // NOTE: we want to enable a scenario when test needs to reference some
556 // classes generated by legacy (1.6) Java compiler to test some specific
557 // behaviour. To do so we compile all the java files located in sub-directory
558 // called 'legacy' with Java 1.6, then compile the rest of the files with
559 // Java 1.8 and a reference to previously generated 1.6 classes.
560
561 // Compiling all classes in dirs 'legacy' with old Java version.
562 task "compile_examplesAndroidO_Legacy"(type: JavaCompile) {
563 source = fileTree(dir: examplesDir, include: '**/legacy/**/*.java')
564 destinationDir = file("build/test/examplesAndroidOLegacy/classes")
565 classpath = sourceSets.main.compileClasspath
566 sourceCompatibility = JavaVersion.VERSION_1_6
567 targetCompatibility = JavaVersion.VERSION_1_6
568 options.compilerArgs += ["-Xlint:-options", "-parameters"]
569 }
570 // Compiling the rest of the files as Java 1.8 code.
571 task "compile_examplesAndroidO"(type: JavaCompile) {
572 dependsOn "compile_examplesAndroidO_Legacy"
573 source = fileTree(dir: examplesDir, include: '**/*.java', exclude: '**/legacy/**/*.java')
574 destinationDir = file("build/test/examplesAndroidO/classes")
575 classpath = sourceSets.main.compileClasspath
576 classpath += files("build/test/examplesAndroidOLegacy/classes")
577 sourceCompatibility = JavaVersion.VERSION_1_8
578 targetCompatibility = JavaVersion.VERSION_1_8
579 options.compilerArgs += ["-Xlint:-options", "-parameters"]
580 }
581 examplesDir.eachDir { dir ->
582 def name = dir.getName();
583 def destinationDir = file("build/test/examplesAndroidO/classes");
584 if (file("src/test/examplesAndroidO/" + name + "/TestGenerator.java").isFile()) {
585 task "generate_examplesAndroidO_${name}"(type: JavaExec,
586 dependsOn: "compile_examplesAndroidO") {
587 main = name + ".TestGenerator"
588 classpath = files(destinationDir, sourceSets.main.compileClasspath)
589 args destinationDir
590 }
591 } else {
592 task "generate_examplesAndroidO_${name}" () {}
593 }
594 }
595 examplesDir.eachDir { dir ->
596 def name = dir.getName();
597 def exampleOutputDir = file("build/test/examplesAndroidO");
598 def jarName = "${name}.jar"
599 dependsOn "jar_examplesAndroidO_${name}"
600 task "jar_examplesAndroidO_${name}"(type: Jar, dependsOn: ["compile_examplesAndroidO",
601 "generate_examplesAndroidO_${name}"]) {
602 archiveName = jarName
603 destinationDir = exampleOutputDir
604 from "build/test/examplesAndroidO/classes" // Java 1.8 classes
605 from "build/test/examplesAndroidOLegacy/classes" // Java 1.6 classes
606 include "**/" + name + "/**/*.class"
607 // Do not include generator into the test runtime jar, it is not useful.
608 // Otherwise, shrinking will need ASM jars.
609 exclude "**/TestGenerator*"
610 }
611 }
612}
613
614task buildExamples {
Jean-Marie Henaff39587a82017-06-08 15:20:13 +0200615 if (OperatingSystem.current().isMacOsX() || OperatingSystem.current().isWindows()) {
616 logger.lifecycle("WARNING: Testing (including building examples) is only partially supported on your " +
617 "platform (" + OperatingSystem.current().getName() + ").")
Mads Ager418d1ca2017-05-22 09:35:49 +0200618 } else if (!OperatingSystem.current().isLinux()) {
619 logger.lifecycle("WARNING: Testing (including building examples) is not supported on your platform. " +
Jean-Marie Henaff39587a82017-06-08 15:20:13 +0200620 "It is fully supported on Linux and partially supported on Mac OS and Windows")
Mads Ager418d1ca2017-05-22 09:35:49 +0200621 return;
622 }
623 dependsOn buildDebugTestResourcesJars
624 dependsOn buildExampleJars
625 dependsOn buildExampleAndroidNJars
626 dependsOn buildExampleAndroidOJars
627 def examplesDir = file("src/test/examples")
Yohann Rousself820a572017-05-31 20:25:51 +0200628 def noDexTests = [
629 "multidex",
630 "multidex002",
631 "multidex004",
632 ]
Mads Ager418d1ca2017-05-22 09:35:49 +0200633 examplesDir.eachDir { dir ->
634 def name = dir.getName();
Yohann Rousself820a572017-05-31 20:25:51 +0200635 if (!(name in noDexTests)) {
636 dependsOn "dex_example_${name}"
637 def exampleOutputDir = file("build/test/examples/" + name);
638 def dexPath = file("${exampleOutputDir}")
639 def debug = (name == "throwing")
640 if (!dexPath.exists()) {
641 dexPath.mkdirs()
642 }
643 task "dex_example_${name}"(type: dx.Dx, dependsOn: "jar_example_${name}") {
644 source = files(tasks.getByPath("jar_example_${name}")).asFileTree
645 destination = dexPath
646 debug = debug
647 }
Mads Ager418d1ca2017-05-22 09:35:49 +0200648 }
649 }
650}
651
652task buildSmali {
653 def smaliDir = file("src/test/smali")
654 smaliDir.eachDirRecurse() { dir ->
655 def name = dir.getName();
656 def relativeDir = smaliDir.toPath().relativize(dir.toPath());
657 def smaliOutputDir = file("build/test/smali/" + relativeDir);
658 smaliOutputDir.mkdirs()
659 outputs.dir smaliOutputDir
660 def taskName = "smali_build_${relativeDir.toString().replace('/', '_')}"
661 def smaliFiles = fileTree(dir: dir, include: '*.smali')
662 def javaFiles = fileTree(dir: dir, include: '*.java')
663 def destDir = smaliOutputDir;
664 def destFile = destDir.toPath().resolve("${name}.dex").toFile()
665 def intermediateFileName = "${name}-intermediate.dex";
666 def intermediateFile = destDir.toPath().resolve(intermediateFileName).toFile()
667 if (javaFiles.empty) {
668 if (!smaliFiles.empty) {
669 dependsOn "${taskName}_smali"
670 task "${taskName}_smali"(type: smali.Smali) {
671 source = smaliFiles
672 destination = destFile
673 }
674 }
675 } else {
676 dependsOn "${taskName}_dexmerger"
677 task "${taskName}_smali"(type: smali.Smali) {
678 source = smaliFiles
679 destination = intermediateFile
680 }
681 task "${taskName}_java"(type: JavaCompile) {
682 source = javaFiles
683 destinationDir destDir
684 classpath = sourceSets.main.compileClasspath
685 sourceCompatibility = JavaVersion.VERSION_1_7
686 targetCompatibility = JavaVersion.VERSION_1_7
687 options.compilerArgs += ["-Xlint:-options"]
688 }
689 task "${taskName}_jar"(type: Jar, dependsOn: "${taskName}_java") {
690 archiveName = "Test.jar"
691 destinationDir = destDir
692 from fileTree(dir: destDir, include: 'Test.class')
693 }
694 task "${taskName}_dx"(type: dx.Dx, dependsOn: "${taskName}_jar") {
695 source = fileTree(dir: destDir, include: 'Test.jar')
696 destination = destDir
697 }
698 task "${taskName}_dexmerger"(
699 type: dx.DexMerger, dependsOn: ["${taskName}_dx", "${taskName}_smali"]) {
700 source = fileTree(dir: destDir, include: ["classes.dex", intermediateFileName])
701 destination = destFile
702 }
703 }
704 }
705}
706
707tasks.withType(Test) {
708 def userDefinedCoresPerFork = System.getenv('R8_GRADLE_CORES_PER_FORK')
709 def coresPerFork = userDefinedCoresPerFork ? userDefinedCoresPerFork.toInteger() : 3
710 // See https://docs.gradle.org/current/dsl/org.gradle.api.tasks.testing.Test.html.
711 maxParallelForks = Runtime.runtime.availableProcessors().intdiv(coresPerFork) ?: 1
712 forkEvery = 0
713 // Use the Concurrent Mark Sweep GC (CMS) to keep memory usage at a resonable level.
714 jvmArgs = ["-XX:+UseConcMarkSweepGC"]
Søren Gjesseaf1c5e22017-06-15 12:24:03 +0200715 if (project.hasProperty('disable_assertions')) {
716 enableAssertions = false
717 }
Mads Ager418d1ca2017-05-22 09:35:49 +0200718}
719
720task buildPreNJdwpTestsJar(type: Jar) {
721 baseName = 'jdwp-tests-preN'
722 from zipTree('third_party/jdwp-tests/apache-harmony-jdwp-tests-host.jar')
723 // Exclude the classes containing java8
724 exclude 'org/apache/harmony/jpda/tests/jdwp/InterfaceType/*.class'
725 exclude 'org/apache/harmony/jpda/tests/jdwp/ObjectReference/InvokeMethodDefault*.class'
726 includeEmptyDirs = false
727}
728
729test {
730 testLogging.exceptionFormat = 'full'
731 if (project.hasProperty('print_test_stdout')) {
732 testLogging.showStandardStreams = true
733 }
734 if (project.hasProperty('dex_vm')) {
735 println "Running with non default vm: " + project.property('dex_vm')
736 systemProperty 'dex_vm', project.property('dex_vm')
737 if (project.property('dex_vm') == '5.1.1' || project.property('dex_vm') == '6.0.1') {
738 // R8 and D8 compute the dex file version number based on the input.
739 // Jack generates dex files with version 37 which art 5.1.1 and 6.0.1 will not run.
740 // Therefore we skip the jack generated art tests with those art versions.
741 exclude "com/android/tools/r8/art/jack/**"
742 }
743 }
744 if (project.hasProperty('one_line_per_test')) {
745 beforeTest { desc ->
746 println "Start executing test ${desc.name} [${desc.className}]"
747 }
748 afterTest { desc, result ->
749 println "Done executing test ${desc.name} [${desc.className}] with result: ${result.resultType}"
750 }
751 }
752 if (project.hasProperty('no_internal')) {
753 exclude "com/android/tools/r8/internal/**"
754 }
755 if (project.hasProperty('only_internal')) {
756 include "com/android/tools/r8/internal/**"
757 }
758 if (project.hasProperty('tool')) {
759 if (project.property('tool') == 'r8') {
760 exclude "com/android/tools/r8/art/*/d8/**"
Tamas Kenez69c2e8b2017-05-31 13:41:07 +0200761 exclude "com/android/tools/r8/jctf/d8/**"
Mads Ager418d1ca2017-05-22 09:35:49 +0200762 } else {
763 assert(project.property('tool') == 'd8')
764 exclude "com/android/tools/r8/art/*/r8/**"
Tamas Kenez69c2e8b2017-05-31 13:41:07 +0200765 exclude "com/android/tools/r8/jctf/r8/**"
Mads Ager418d1ca2017-05-22 09:35:49 +0200766 }
767 }
768 if (!project.hasProperty('all_tests')) {
769 exclude "com/android/tools/r8/art/dx/**"
770 exclude "com/android/tools/r8/art/jack/**"
771 }
772 // TODO(tamaskenez) enable jctf on all_tests when consolidated
773 if (!project.hasProperty('jctf') && !project.hasProperty('only_jctf')) {
Stephan Herhutea6ee582017-05-23 13:14:34 +0200774 exclude "com/android/tools/r8/jctf/**"
Mads Ager418d1ca2017-05-22 09:35:49 +0200775 }
776 if (project.hasProperty('only_jctf')) {
Stephan Herhutea6ee582017-05-23 13:14:34 +0200777 include "com/android/tools/r8/jctf/**"
Mads Ager418d1ca2017-05-22 09:35:49 +0200778 }
779 if (project.hasProperty('jctf_compile_only')) {
780 println "JCTF: compiling only"
781 systemProperty 'jctf_compile_only', '1'
782 }
783
Jean-Marie Henaff39587a82017-06-08 15:20:13 +0200784 if (OperatingSystem.current().isLinux()
785 || OperatingSystem.current().isMacOsX()
786 || OperatingSystem.current().isWindows()) {
Mads Ager418d1ca2017-05-22 09:35:49 +0200787 if (OperatingSystem.current().isMacOsX()) {
788 logger.lifecycle("WARNING: Testing in only partially supported on Mac OS. " +
789 "Art only runs on Linux and tests requiring Art runs in a Docker container, which must be present. " +
790 "See tools/docker/README.md for details.")
791 }
Jean-Marie Henaff39587a82017-06-08 15:20:13 +0200792 if (OperatingSystem.current().isWindows()) {
793 logger.lifecycle("WARNING: Testing in only partially supported on Windows. " +
794 "Art only runs on Linux and tests requiring Art will be skipped")
795 }
Mads Ager418d1ca2017-05-22 09:35:49 +0200796 dependsOn downloadDeps
797 dependsOn buildExamples
798 dependsOn buildSmali
799 dependsOn jctfCommonJar
800 dependsOn jctfTestsClasses
801 dependsOn buildDebugInfoExamplesDex
802 dependsOn buildPreNJdwpTestsJar
803 } else {
804 logger.lifecycle("WARNING: Testing in not supported on your platform. Testing is only fully supported on " +
Jean-Marie Henaff39587a82017-06-08 15:20:13 +0200805 "Linux and partially supported on Mac OS and Windows. Art does not run on other platforms.")
Mads Ager418d1ca2017-05-22 09:35:49 +0200806 }
807}
808
809// The Art tests we use for R8 are pre-build and downloaded from Google Cloud Storage.
810//
811// To build and upload a new set of the Art tests for use with R8 follow these steps:
812//
813// First of all an Android checkout is required. Currently it must be located
814// in $HOME/android/master.
815//
816// TODO(ricow): simplify this
817//
818// Before: update the checked in art, see scripts/update-host-art.sh
819//
820// 1. Get an android checkout in $HOME/android/master and apply the patch from
821// https://android-review.googlesource.com/#/c/294187/
822//
823// 2. run the following commands in the Android checkout directory:
824//
825// source build/envsetup.sh
826// lunch aosp_angler-userdebug
827// make -j30 test-art-host
828//
829// 3. In the R8 project root directory, make sure we have a clean state before starting:
830// tools/gradle.py downloadDeps
831// tools/gradle.py clean
832// rm -rf tests/art
833//
834// 4. Now build in the R8 checkout (-P hack to not generate dirs when not running this target)
835// Make sure you have smali on your path, there is a build binary in the out directory of
836// the android checkout:
837//
838// tools/gradle.py -Pandroid_source buildArtTests
839//
840// 4a. If any failures are produced in step 4, figure out what went wrong and add an entry in
841// skippedTests with an explanation. Rerun from step 3.
842//
843// 5. Run the tests:
844// tools/gradle.py clean
845// tools/test.py
846//
847// 5a. If any more tests fail, either fix the issue or add them to the toBeTriaged list (note that
848// you need to change "_" to "-" from stdout). Rerun from step 3 if anything was added to
849// toBeTriaged.
850//
851// 6. To upload a new version to Google Cloud Storage
852// cd tests
853// upload_to_google_storage.py -a --bucket r8-deps art
854
855enum DexTool {
856 JACK,
857 DX
858}
859
860def androidCheckoutDir = file("${System.env.HOME}/android/master")
861def androidCheckoutJack = file("${androidCheckoutDir}/out/host/linux-x86/bin/jack");
862def androidCheckoutJackServer = file("${androidCheckoutDir}/out/host/linux-x86/bin/jack-admin");
863
864def artTestDir = file("${androidCheckoutDir}/art/test")
865
866if (project.hasProperty('android_source')) {
867 task buildArtTests {
868 outputs.upToDateWhen { false }
869 def toBeTriaged = [
870 "903-hello-tagging",
871 "904-object-allocation",
872 "905-object-free",
873 "906-iterate-heap",
874 "907-get-loaded-classes",
875 "908-gc-start-finish",
876 "954-invoke-polymorphic-verifier",
877 "955-methodhandles-smali",
878 "596-monitor-inflation",
879 ]
880 def skippedTests = toBeTriaged + [
881 // This test produces no jar.
882 "000-nop",
883 // This does not build, as it tests the error when the application exceeds more
884 // than 65536 methods
885 "089-many-methods",
886 // Requires some jack beta jar
887 "956-methodhandles",
888 ]
889
890 def skippedTestsDx = [
891 // Tests with custom build scripts, where javac is not passed the options
892 // -source 1.7 -target 1.7.
893 "462-checker-inlining-across-dex-files",
894 "556-invoke-super",
895 "569-checker-pattern-replacement",
896 // These tests use jack even when --build-with-javac-dx is specified.
897 "004-JniTest",
898 "048-reflect-v8",
899 "146-bad-interface",
900 "563-checker-invoke-super",
901 "580-checker-string-fact-intrinsics", // java.lang.StringFactory
902 "604-hot-static-interface",
903 "957-methodhandle-transforms",
904 "958-methodhandle-emulated-stackframe",
905 "959-invoke-polymorphic-accessors",
906 "961-default-iface-resolution-gen",
907 "962-iface-static",
908 "963-default-range-smali",
909 "964-default-iface-init-gen",
910 "965-default-verify",
911 "966-default-conflict",
912 "967-default-ame",
913 "968-default-partial-compile-gen",
914 "969-iface-super",
915 "970-iface-super-resolution-gen",
916 "971-iface-super",
917 // These tests does not build with --build-with-javac-dx
918 "004-NativeAllocations", // Javac error
919 "031-class-attributes",
920 "138-duplicate-classes-check",
921 "157-void-class", // Javac error
922 "580-checker-string-factory-intrinsics",
923 "612-jit-dex-cache",
924 "613-inlining-dex-cache",
925 "900-hello-plugin", // --experimental agents
926 "901-hello-ti-agent", // --experimental agents
927 "902-hello-transformation", // --experimental agents
928 "909-attach-agent", // --experimental agents
929 "946-obsolete-throw", // -source 1.7 -target 1.7, but use lambda
930 "950-redefine-intrinsic", // -source 1.7 -target 1.7, but use method references
931 "951-threaded-obsolete", // -source 1.7 -target 1.7, but use lambda
932 "960-default-smali", // --experimental default-methods
933 // These tests force the build to use jack
934 "953-invoke-polymorphic-compiler",
935 "958-methodhandle-stackframe",
936 ]
937
938 def artTestBuildDir = file("${projectDir}/tests/art")
939
940 if (androidCheckoutDir.exists()) {
941 dependsOn downloadDeps
942 artTestBuildDir.mkdirs()
943 // Ensure Jack server is running.
944 "${androidCheckoutJackServer} start-server".execute()
945 artTestDir.eachDir { dir ->
946 def name = dir.getName();
947 def markerFile = dir.toPath().resolve("info.txt").toFile();
948 if (markerFile.exists() && !(name in skippedTests)) {
949 if (!(name in skippedTestsDx)) {
950 dependsOn buildArtTest(androidCheckoutDir, artTestBuildDir, dir, DexTool.DX);
951 }
952 dependsOn buildArtTest(androidCheckoutDir, artTestBuildDir, dir, DexTool.JACK);
953 }
954 }
955 }
956 doFirst {
957 if (!androidCheckoutDir.exists()) {
958 throw new InvalidUserDataException(
959 "This task requires an Android checkout in ${androidCheckoutDir}");
960 } else if (!androidCheckoutJack.exists() ||
961 !androidCheckoutJackServer.exists()) {
962 throw new InvalidUserDataException(
963 "This task requires that tools for host testing have been build in the " +
964 "Android checkout in ${androidCheckoutDir}");
965 }
966 }
967 doLast {
968 copy {
969 from file("${androidCheckoutDir}/out/host/linux-x86/nativetest64")
970 into file("${artTestBuildDir}/lib64")
971 include 'lib*.so'
972 }
973 copy {
974 from file("${androidCheckoutDir}/out/host/linux-x86/lib64")
975 into file("${artTestBuildDir}/lib64")
976 include 'libart.so'
977 include 'libbacktrace.so'
978 include 'libbase.so'
979 include 'libc++.so'
980 include 'libcutils.so'
981 include 'liblz4.so'
982 include 'liblzma.so'
983 include 'libnativebridge.so'
984 include 'libnativeloader.so'
985 include 'libsigchain.so'
986 include 'libunwind.so'
987 include 'libziparchive.so'
988 }
989 copy {
990 from file("${androidCheckoutDir}/out/host/linux-x86/nativetest")
991 into file("${artTestBuildDir}/lib")
992 include 'lib*.so'
993 }
994 copy {
995 from file("${androidCheckoutDir}/out/host/linux-x86/lib")
996 into file("${artTestBuildDir}/lib")
997 include 'libart.so'
998 include 'libbacktrace.so'
999 include 'libbase.so'
1000 include 'libc++.so'
1001 include 'libcutils.so'
1002 include 'liblz4.so'
1003 include 'liblzma.so'
1004 include 'libnativebridge.so'
1005 include 'libnativeloader.so'
1006 include 'libsigchain.so'
1007 include 'libunwind.so'
1008 include 'libziparchive.so'
1009 }
1010 }
1011 }
1012}
1013
1014def buildArtTest(androidCheckoutDir, artTestBuildDir, dir, dexTool) {
1015 def artTestDir = file("${androidCheckoutDir}/art/test")
1016 def artRunTestScript = file("${artTestDir}/run-test")
1017 def dxExecutable = new File("tools/linux/dx/bin/dx");
Jean-Marie Henaff34d85f72017-06-14 10:32:04 +02001018 def dexMergerExecutable = Utils.dexMergerExecutable()
Mads Ager418d1ca2017-05-22 09:35:49 +02001019 def dexToolName = dexTool == DexTool.DX ? "dx" : "jack"
1020
1021 def name = dir.getName();
1022 def buildTask = "build_art_test_${dexToolName}_${name}"
1023 def sanitizeTask = "sanitize_art_test_${dexToolName}_${name}"
1024 def copyCheckTask = "copy_check_art_test_${dexToolName}_${name}"
1025 def smaliToDexTask = "smali_to_dex_${dexToolName}_${name}"
1026
1027 def buildInputs = fileTree(dir: dir, include: '**/*')
1028 def testDir = file("${artTestBuildDir}/${dexToolName}/${name}")
1029 def outputJar = testDir.toPath().resolve("${name}.jar").toFile()
1030 testDir.mkdirs()
1031 if (dexTool == DexTool.DX) {
1032 task "$buildTask"(type: Exec) {
1033 outputs.upToDateWhen { false }
1034 inputs.file buildInputs
1035 executable "${artRunTestScript}"
1036 args "--host"
1037 args "--build-only"
1038 args "--build-with-javac-dx"
1039 args "--output-path", "${testDir}"
1040 args "${name}"
1041 environment DX: "${dxExecutable.absolutePath}"
1042 environment DXMERGER: "${dexMergerExecutable.absolutePath}"
1043 outputs.file outputJar
1044 }
1045 } else {
1046 assert dexTool == DexTool.JACK
1047 def javaLibs = "${androidCheckoutDir}/out/host/common/obj/JAVA_LIBRARIES"
1048 def jackClasspath = "${javaLibs}/core-libart-hostdex_intermediates/classes.jack:" +
1049 "${javaLibs}/core-oj-hostdex_intermediates/classes.jack"
1050 task "$buildTask"(type: Exec) {
1051 outputs.upToDateWhen { false }
1052 inputs.file buildInputs
1053 executable "${artRunTestScript}"
1054 args "--host"
1055 args "--build-only"
1056 args "--output-path", "${testDir}"
1057 args "${name}"
1058 environment JACK: "${androidCheckoutDir}/out/host/linux-x86/bin/jack"
1059 environment JACK_CLASSPATH: jackClasspath
1060 environment DXMERGER: "${dexMergerExecutable.absolutePath}"
1061 environment ANDROID_BUILD_TOP: "${androidCheckoutDir}"
1062 outputs.file outputJar
1063 }
1064 }
1065 task "${sanitizeTask}"(type: Exec, dependsOn: buildTask) {
1066 outputs.upToDateWhen { false }
1067 executable "/bin/bash"
1068 args "-c"
1069 args "rm -rf ${testDir}/smali_*.dex ${testDir}/*-ex.dex ${testDir}/*-ex.jar" +
1070 " ${testDir}/classes-ex ${testDir}/check"
1071 }
1072
1073 task "${smaliToDexTask}"(type: Exec) {
1074 workingDir "${testDir}/smali"
1075 executable "/bin/bash"
1076 args "-c", "smali -o out.dex *.smali"
1077 }
1078
1079 task "${copyCheckTask}"(type: Copy, dependsOn: sanitizeTask) {
1080 def smali_dir = file("${dir}/smali")
1081 outputs.upToDateWhen { false }
1082 if (smali_dir.exists() && dexTool == DexTool.DX) {
1083 dependsOn smaliToDexTask
1084 }
1085 from("${artTestDir}/${name}") {
1086 include 'check'
1087 }
1088 into testDir
1089 }
1090
1091 return copyCheckTask
1092}
1093
1094task javadocD8(type: Javadoc) {
1095 classpath = sourceSets.main.compileClasspath
1096 source = sourceSets.main.allJava
1097 include '**/com/android/tools/r8/BaseCommand.java'
1098 include '**/com/android/tools/r8/BaseOutput.java'
1099 include '**/com/android/tools/r8/CompilationException.java'
1100 include '**/com/android/tools/r8/CompilationMode.java'
1101 include '**/com/android/tools/r8/D8.java'
1102 include '**/com/android/tools/r8/D8Command.java'
1103 include '**/com/android/tools/r8/D8Output.java'
1104 include '**/com/android/tools/r8/Resource.java'
1105}