Revert "Move examples and examplesAndroidX out into third_party"
This reverts commit 968ab6cdb50255fe438f4d6af500bc1335266113.
Reason for revert: the breaker of bots
Change-Id: I28fb5f5d645376ccf9a27a598170014dce5693f1
diff --git a/.gitignore b/.gitignore
index 4008f3e..4496e10 100644
--- a/.gitignore
+++ b/.gitignore
@@ -96,20 +96,8 @@
third_party/dependencies_new.tar.gz
third_party/desugar/desugar_*.tar.gz
third_party/desugar/desugar_*/
-third_party/examples
-third_party/examples.tar.gz
-third_party/examplesAndroidN
-third_party/examplesAndroidN.tar.gz
-third_party/examplesAndroidO
-third_party/examplesAndroidO.tar.gz
-third_party/examplesAndroidOGenerated
-third_party/examplesAndroidOGenerated.tar.gz
third_party/examplesAndroidOLegacy
third_party/examplesAndroidOLegacy.tar.gz
-third_party/examplesAndroidP
-third_party/examplesAndroidP.tar.gz
-third_party/examplesAndroidPGenerated
-third_party/examplesAndroidPGenerated.tar.gz
third_party/framework
third_party/framework.tar.gz
third_party/gmail/*
@@ -167,8 +155,6 @@
third_party/kotlin/kotlin-compiler-dev
third_party/kotlinx-coroutines-1.3.6.tar.gz
third_party/kotlinx-coroutines-1.3.6
-third_party/kotlinR8TestResources
-third_party/kotlinR8TestResources.tar.gz
third_party/multidex
third_party/multidex.tar.gz
third_party/nest/*
diff --git a/build.gradle b/build.gradle
index 2e89280..8db5b0d 100644
--- a/build.gradle
+++ b/build.gradle
@@ -105,6 +105,12 @@
}
output.resourcesDir = 'build/classes/debugTestResourcesJava8'
}
+ examples {
+ java {
+ srcDirs = ['src/test/examples']
+ }
+ output.resourcesDir = 'build/classes/examples'
+ }
examplesJava9 {
java {
srcDirs = ['src/test/examplesJava9']
@@ -130,6 +136,30 @@
srcDirs = ['src/test/examplesJava20']
}
}
+ examplesAndroidN {
+ java {
+ srcDirs = ['src/test/examplesAndroidN']
+ }
+ output.resourcesDir = 'build/classes/examplesAndroidN'
+ }
+ examplesAndroidO {
+ java {
+ srcDirs = ['src/test/examplesAndroidO']
+ }
+ output.resourcesDir = 'build/classes/examplesAndroidO'
+ }
+ examplesAndroidP {
+ java {
+ srcDirs = ['src/test/examplesAndroidP']
+ }
+ output.resourcesDir = 'build/classes/examplesAndroidP'
+ }
+ kotlinR8TestResources {
+ java {
+ srcDirs = ['src/test/kotlinR8TestResources']
+ }
+ output.resourcesDir = 'build/classes/kotlinR8TestResources'
+ }
keepanno {
java {
srcDirs = ['src/keepanno/java']
@@ -195,6 +225,7 @@
main17Implementation group: 'org.ow2.asm', name: 'asm-analysis', version: asmVersion
main17Implementation group: 'org.ow2.asm', name: 'asm-util', version: asmVersion
+ testCompile sourceSets.examples.output
testCompile "junit:junit:$junitVersion"
testCompile "com.google.guava:guava:$guavaVersion"
testCompile "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
@@ -211,8 +242,18 @@
testCompile group: 'it.unimi.dsi', name: 'fastutil', version: fastutilVersion
testCompile group: 'org.javassist', name: 'javassist', version: javassistVersion
+ examplesAndroidOCompile group: 'org.ow2.asm', name: 'asm', version: asmVersion
+ examplesAndroidOCompile files("third_party/android_jar/lib-v26/android.jar")
+ examplesAndroidOCompile files("third_party/examplesAndroidOLegacy")
+
+ examplesAndroidPCompile group: 'org.ow2.asm', name: 'asm', version: asmVersion
+ // Import Guava for @Nullable annotation
+ examplesCompile "com.google.guava:guava:$guavaVersion"
+ examplesCompile "junit:junit:$junitVersion"
+ examplesCompile "org.mockito:mockito-core:$mockitoVersion"
apiUsageSampleCompile sourceSets.main.output
apiUsageSampleCompile "com.google.guava:guava:$guavaVersion"
+ kotlinR8TestResourcesCompileOnly "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
errorprone("com.google.errorprone:error_prone_core:$errorproneVersion")
keepannoCompile group: 'org.ow2.asm', name: 'asm', version: asmVersion
@@ -266,13 +307,7 @@
"dagger/2.41",
"dart-sdk",
"ddmlib",
- "examples",
- "examplesAndroidN",
- "examplesAndroidO",
"examplesAndroidOLegacy",
- "examplesAndroidOGenerated",
- "examplesAndroidP",
- "examplesAndroidPGenerated",
"gradle/gradle",
"google/google-java-format/1.14.0",
"google-java-format",
@@ -294,7 +329,6 @@
"kotlin/kotlin-compiler-1.7.0",
"kotlin/kotlin-compiler-1.8.0",
"kotlinx-coroutines-1.3.6",
- "kotlinR8TestResources",
"multidex",
"openjdk/custom_conversion",
"openjdk/openjdk-rt-1.8",
@@ -1099,6 +1133,211 @@
dependsOn buildR8ApiUsageSample
}
+// Proto lite generated code yields warnings when compiling with javac.
+// We change the options passed to javac to ignore it.
+compileExamplesJava.options.compilerArgs = ["-Xlint:none"]
+
+
+task buildExampleJars {
+ def examplesDir = file("src/test/examples")
+ task extractExamplesRuntime(type: Sync) {
+ dependsOn configurations.examplesRuntime
+ from { configurations.examplesRuntime.collect { zipTree(it) } }
+ include "**/*.class"
+ includeEmptyDirs false
+ into "$buildDir/runtime/examples/"
+ }
+
+ task "copy_examples_resources"(type: org.gradle.api.tasks.Copy) {
+ from examplesDir
+ exclude "**/*.java"
+ exclude "**/keep-rules*.txt"
+ into file("build/test/examples/classes")
+ }
+
+ task "compile_examples"(type: JavaCompile) {
+ dependsOn "copy_examples_resources"
+ source examplesDir
+ include "**/*.java"
+ destinationDir = file("build/test/examples/classes")
+ classpath = sourceSets.examples.compileClasspath
+ sourceCompatibility = JavaVersion.VERSION_1_7
+ targetCompatibility = JavaVersion.VERSION_1_7
+ options.compilerArgs = ["-g:source,lines", "-Xlint:none"]
+ }
+ task "compile_examples_debuginfo_all"(type: JavaCompile) {
+ source examplesDir
+ include "**/*.java"
+ destinationDir = file("build/test/examples/classes_debuginfo_all")
+ classpath = sourceSets.examples.compileClasspath
+ sourceCompatibility = JavaVersion.VERSION_1_7
+ targetCompatibility = JavaVersion.VERSION_1_7
+ options.compilerArgs = ["-g", "-Xlint:none"]
+ }
+ task "compile_examples_debuginfo_none"(type: JavaCompile) {
+ source examplesDir
+ include "**/*.java"
+ destinationDir = file("build/test/examples/classes_debuginfo_none")
+ classpath = sourceSets.examples.compileClasspath
+ sourceCompatibility = JavaVersion.VERSION_1_7
+ targetCompatibility = JavaVersion.VERSION_1_7
+ options.compilerArgs = ["-g:none", "-Xlint:none"]
+ }
+ examplesDir.eachDir { dir ->
+ def name = dir.getName();
+ def exampleOutputDir = file("build/test/examples");
+ def jarName = "${name}.jar"
+ dependsOn "jar_example_${name}"
+ dependsOn "jar_example_${name}_debuginfo_all"
+ dependsOn "jar_example_${name}_debuginfo_none"
+ dependsOn "extractExamplesRuntime"
+ def runtimeDependencies = copySpec { }
+ task "jar_example_${name}"(type: Jar, dependsOn: "compile_examples") {
+ archiveName = "${name}.jar"
+ destinationDir = exampleOutputDir
+ from "build/test/examples/classes"
+ include name + "/**/*"
+ with runtimeDependencies
+ includeEmptyDirs true
+ }
+ task "jar_example_${name}_debuginfo_all"(type: Jar, dependsOn: "compile_examples_debuginfo_all") {
+ archiveName = "${name}_debuginfo_all.jar"
+ destinationDir = exampleOutputDir
+ from "build/test/examples/classes_debuginfo_all"
+ include name + "/**/*.class"
+ with runtimeDependencies
+ includeEmptyDirs false
+ }
+ task "jar_example_${name}_debuginfo_none"(type: Jar, dependsOn: "compile_examples_debuginfo_none") {
+ archiveName = "${name}_debuginfo_none.jar"
+ destinationDir = exampleOutputDir
+ from "build/test/examples/classes_debuginfo_none"
+ include name + "/**/*.class"
+ with runtimeDependencies
+ includeEmptyDirs false
+ }
+ }
+}
+
+task buildExampleAndroidNJars {
+ dependsOn downloadDeps
+ def examplesDir = file("src/test/examplesAndroidN")
+ task "compile_examplesAndroidN"(type: JavaCompile) {
+ source = fileTree(dir: examplesDir, include: '**/*.java')
+ destinationDir = file("build/test/examplesAndroidN/classes")
+ classpath = sourceSets.main.compileClasspath
+ sourceCompatibility = JavaVersion.VERSION_1_8
+ targetCompatibility = JavaVersion.VERSION_1_8
+ options.compilerArgs += ["-Xlint:-options"]
+ }
+ examplesDir.eachDir { dir ->
+ def name = dir.getName();
+ def exampleOutputDir = file("build/test/examplesAndroidN");
+ def jarName = "${name}.jar"
+ dependsOn "jar_examplesAndroidN_${name}"
+ task "jar_examplesAndroidN_${name}"(type: Jar, dependsOn: "compile_examplesAndroidN") {
+ archiveName = jarName
+ destinationDir = exampleOutputDir
+ from "build/test/examplesAndroidN/classes"
+ include "**/" + name + "/**/*.class"
+ }
+ }
+}
+
+
+task buildExampleAndroidOJars {
+ dependsOn downloadDeps
+ def examplesDir = file("src/test/examplesAndroidO")
+ // Compiling the rest of the files as Java 1.8 code.
+ task "compile_examplesAndroidO"(type: JavaCompile) {
+ source = fileTree(dir: examplesDir, include: '**/*.java', exclude: '**/legacy/**/*.java')
+ destinationDir = file("build/test/examplesAndroidO/classes")
+ classpath = sourceSets.main.compileClasspath
+ classpath += files("build/test/examplesAndroidOLegacy/classes")
+ classpath += files("third_party/android_jar/lib-v26/android.jar")
+ classpath += files("third_party/examplesAndroidOLegacy")
+ sourceCompatibility = JavaVersion.VERSION_1_8
+ targetCompatibility = JavaVersion.VERSION_1_8
+ options.compilerArgs += ["-Xlint:-options", "-parameters"]
+ }
+ examplesDir.eachDir { dir ->
+ def name = dir.getName();
+ def destinationDir = file("build/test/examplesAndroidO/classes");
+ if (file("src/test/examplesAndroidO/" + name + "/TestGenerator.java").isFile()) {
+ task "generate_examplesAndroidO_${name}"(type: JavaExec,
+ dependsOn: "compile_examplesAndroidO") {
+ main = name + ".TestGenerator"
+ classpath = files(destinationDir, sourceSets.main.compileClasspath)
+ args destinationDir, file("build/test/examplesAndroidO/classes/${name}").toString()
+ }
+ } else {
+ task "generate_examplesAndroidO_${name}" () {}
+ }
+ }
+ examplesDir.eachDir { dir ->
+ def name = dir.getName();
+ def exampleOutputDir = file("build/test/examplesAndroidO");
+ def jarName = "${name}.jar"
+ dependsOn "jar_examplesAndroidO_${name}"
+ task "jar_examplesAndroidO_${name}"(type: Jar, dependsOn: ["compile_examplesAndroidO",
+ "generate_examplesAndroidO_${name}"]) {
+ archiveName = jarName
+ destinationDir = exampleOutputDir
+ from "build/test/examplesAndroidO/classes" // Java 1.8 classes
+ from "build/test/examplesAndroidOLegacy/classes" // Java 1.6 classes
+ include "**/" + name + "/**/*.class"
+ // Do not include generator into the test runtime jar, it is not useful.
+ // Otherwise, shrinking will need ASM jars.
+ exclude "**/TestGenerator*"
+ }
+ }
+}
+
+task buildExampleAndroidPJars {
+ dependsOn downloadDeps
+ def examplesDir = file("src/test/examplesAndroidP")
+
+ task "compile_examplesAndroidP"(type: JavaCompile) {
+ source = fileTree(dir: examplesDir, include: '**/*.java')
+ destinationDir = file("build/test/examplesAndroidP/classes")
+ classpath = sourceSets.main.compileClasspath
+ sourceCompatibility = JavaVersion.VERSION_1_8
+ targetCompatibility = JavaVersion.VERSION_1_8
+ options.compilerArgs += ["-Xlint:-options"]
+ }
+ examplesDir.eachDir { dir ->
+ def name = dir.getName();
+ def destinationDir = file("build/test/examplesAndroidP/classes");
+ if (file("src/test/examplesAndroidP/" + name + "/TestGenerator.java").isFile()) {
+ task "generate_examplesAndroidP_${name}"(type: JavaExec,
+ dependsOn: "compile_examplesAndroidP") {
+ main = name + ".TestGenerator"
+ classpath = files(destinationDir.toString(), sourceSets.main.compileClasspath)
+ args destinationDir, file("build/test/examplesAndroidP/classes/${name}").toString()
+ }
+ } else {
+ task "generate_examplesAndroidP_${name}" () {}
+ }
+ }
+ examplesDir.eachDir { dir ->
+ def name = dir.getName();
+ def exampleOutputDir = file("build/test/examplesAndroidP");
+ def jarName = "${name}.jar"
+ dependsOn "jar_examplesAndroidP_${name}"
+ task "jar_examplesAndroidP_${name}"(type: Jar,
+ dependsOn: ["compile_examplesAndroidP",
+ "generate_examplesAndroidP_${name}"]) {
+ archiveName = jarName
+ destinationDir = exampleOutputDir
+ from "build/test/examplesAndroidP/classes" // Java 1.8 classes
+ include "**/" + name + "/**/*.class"
+ // Do not include generator into the test runtime jar, it is not useful.
+ // Otherwise, shrinking will need ASM jars.
+ exclude "**/TestGenerator*"
+ }
+ }
+}
+
def buildExampleJarsCreateTask(javaVersion, sourceSet) {
return tasks.create("buildExample${javaVersion}Jars") {
def examplesDir = file("src/test/examples${javaVersion}")
@@ -1137,6 +1376,32 @@
})
}
+task buildKotlinR8TestResources {
+ def examplesDir = file("src/test/kotlinR8TestResources")
+ examplesDir.eachDir { dir ->
+ def name = dir.getName()
+ def taskName = "jar_kotlinR8TestResources_${name}"
+ def javaOutput = "build/test/kotlinR8TestResources/${name}/java"
+ def javaOutputJarName = "${name}.jar"
+ def javaOutputJarDir = "build/test/kotlinR8TestResources"
+ task "${taskName}Java"(type: JavaCompile) {
+ source = fileTree(dir: file("${examplesDir}/${name}"), include: '**/*.java')
+ destinationDir = file(javaOutput)
+ classpath = sourceSets.main.compileClasspath
+ sourceCompatibility = JavaVersion.VERSION_1_8
+ targetCompatibility = JavaVersion.VERSION_1_8
+ options.compilerArgs += ["-g", "-Xlint:-options"]
+ }
+ task "${taskName}JavaJar"(type: Jar, dependsOn: "${taskName}Java") {
+ archiveName = javaOutputJarName
+ destinationDir = file(javaOutputJarDir)
+ from javaOutput
+ include "**/*.class"
+ }
+ dependsOn "${taskName}JavaJar"
+ }
+}
+
task buildExamples {
if (OperatingSystem.current().isMacOsX() || OperatingSystem.current().isWindows()) {
logger.lifecycle("WARNING: Testing (including building examples) is only partially supported on your " +
@@ -1146,11 +1411,22 @@
"It is fully supported on Linux and partially supported on Mac OS and Windows")
return;
}
+ dependsOn buildExampleJars
+ dependsOn buildExampleAndroidNJars
+ dependsOn buildExampleAndroidOJars
+ dependsOn buildExampleAndroidPJars
dependsOn buildExampleJava9Jars
dependsOn buildExampleJava10Jars
dependsOn buildExampleJava11Jars
dependsOn buildExampleJava17Jars
dependsOn buildExampleJava20Jars
+ def examplesDir = file("src/test/examples")
+ examplesDir.eachDir { dir ->
+ def exampleOutputDir = file("build/test/examples/" + dir.getName());
+ if (!exampleOutputDir.exists()) {
+ exampleOutputDir.mkdirs()
+ }
+ }
}
tasks.withType(Test) {
@@ -1747,6 +2023,7 @@
}
dependsOn downloadDeps
dependsOn buildExamples
+ dependsOn buildKotlinR8TestResources
dependsOn buildPreNJdwpTestsJar
dependsOn provideArtFrameworksDependencies
} else {
diff --git a/d8_r8/commonBuildSrc/src/main/kotlin/DependenciesPlugin.kt b/d8_r8/commonBuildSrc/src/main/kotlin/DependenciesPlugin.kt
index b11a532..11dde81 100644
--- a/d8_r8/commonBuildSrc/src/main/kotlin/DependenciesPlugin.kt
+++ b/d8_r8/commonBuildSrc/src/main/kotlin/DependenciesPlugin.kt
@@ -362,34 +362,10 @@
"ddmlib",
Paths.get("third_party", "ddmlib").toFile(),
Paths.get("third_party", "ddmlib.tar.gz.sha1").toFile())
- val examples = ThirdPartyDependency(
- "examples",
- Paths.get("third_party", "examples").toFile(),
- Paths.get("third_party", "examples.tar.gz.sha1").toFile())
- val examplesAndroidN = ThirdPartyDependency(
- "examplesAndroidN",
- Paths.get("third_party", "examplesAndroidN").toFile(),
- Paths.get("third_party", "examplesAndroidN.tar.gz.sha1").toFile())
- val examplesAndroidO = ThirdPartyDependency(
- "examplesAndroidO",
- Paths.get("third_party", "examplesAndroidO").toFile(),
- Paths.get("third_party", "examplesAndroidO.tar.gz.sha1").toFile())
- val examplesAndroidOGenerated = ThirdPartyDependency(
- "examplesAndroidOGenerated",
- Paths.get("third_party", "examplesAndroidOGenerated").toFile(),
- Paths.get("third_party", "examplesAndroidOGenerated.tar.gz.sha1").toFile())
val examplesAndroidOLegacy = ThirdPartyDependency(
"examplesAndroidOLegacy",
Paths.get("third_party", "examplesAndroidOLegacy").toFile(),
Paths.get("third_party", "examplesAndroidOLegacy.tar.gz.sha1").toFile())
- val examplesAndroidP = ThirdPartyDependency(
- "examplesAndroidP",
- Paths.get("third_party", "examplesAndroidP").toFile(),
- Paths.get("third_party", "examplesAndroidP.tar.gz.sha1").toFile())
- val examplesAndroidPGenerated = ThirdPartyDependency(
- "examplesAndroidPGenerated",
- Paths.get("third_party", "examplesAndroidPGenerated").toFile(),
- Paths.get("third_party", "examplesAndroidPGenerated.tar.gz.sha1").toFile())
val desugarJdkLibs = ThirdPartyDependency(
"desugar-jdk-libs",
Paths.get("third_party", "openjdk", "desugar_jdk_libs").toFile(),
@@ -445,10 +421,6 @@
Paths.get("third_party", "jdwp-tests").toFile(),
Paths.get("third_party", "jdwp-tests.tar.gz.sha1").toFile())
val kotlinCompilers = getThirdPartyKotlinCompilers()
- val kotlinR8TestResources = ThirdPartyDependency(
- "kotlinR8TestResources",
- Paths.get("third_party", "kotlinR8TestResources").toFile(),
- Paths.get("third_party", "kotlinR8TestResources.tar.gz.sha1").toFile())
val multidex = ThirdPartyDependency(
"multidex",
Paths.get("third_party", "multidex").toFile(),
diff --git a/d8_r8/library_desugar/build.gradle.kts b/d8_r8/library_desugar/build.gradle.kts
index 4094e64..2bba9c5 100644
--- a/d8_r8/library_desugar/build.gradle.kts
+++ b/d8_r8/library_desugar/build.gradle.kts
@@ -10,7 +10,7 @@
java {
sourceSets.main.configure {
java.srcDir(getRoot().resolveAll("src", "library_desugar", "java"))
- output.setResourcesDir(getRoot().resolveAll("build", "classes", "library_desugar_conversions"))
+ output.resourcesDir = getRoot().resolveAll("build", "classes", "library_desugar_conversions")
}
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
diff --git a/d8_r8/test_modules/tests_java_8/build.gradle.kts b/d8_r8/test_modules/tests_java_8/build.gradle.kts
index 881089b..d0ef602 100644
--- a/d8_r8/test_modules/tests_java_8/build.gradle.kts
+++ b/d8_r8/test_modules/tests_java_8/build.gradle.kts
@@ -59,11 +59,16 @@
}
val sourceSetDependenciesTasks = arrayOf(
+ projectTask("tests_java_examples", getExampleJarsTaskName("examples")),
projectTask("tests_java_9", getExampleJarsTaskName("examplesJava9")),
projectTask("tests_java_10", getExampleJarsTaskName("examplesJava10")),
projectTask("tests_java_11", getExampleJarsTaskName("examplesJava11")),
projectTask("tests_java_17", getExampleJarsTaskName("examplesJava17")),
projectTask("tests_java_20", getExampleJarsTaskName("examplesJava20")),
+ projectTask("tests_java_examplesAndroidN", getExampleJarsTaskName("examplesAndroidN")),
+ projectTask("tests_java_examplesAndroidO", getExampleJarsTaskName("examplesAndroidO")),
+ projectTask("tests_java_examplesAndroidP", getExampleJarsTaskName("examplesAndroidP")),
+ projectTask("tests_java_kotlinR8TestResources", getExampleJarsTaskName("kotlinR8TestResources")),
)
fun testDependencies() : FileCollection {
diff --git a/d8_r8/test_modules/tests_java_8/settings.gradle.kts b/d8_r8/test_modules/tests_java_8/settings.gradle.kts
index a0cc31c..f5ac288 100644
--- a/d8_r8/test_modules/tests_java_8/settings.gradle.kts
+++ b/d8_r8/test_modules/tests_java_8/settings.gradle.kts
@@ -39,3 +39,9 @@
includeBuild(root.resolve("test_modules").resolve("tests_java_11"))
includeBuild(root.resolve("test_modules").resolve("tests_java_17"))
includeBuild(root.resolve("test_modules").resolve("tests_java_20"))
+includeBuild(root.resolve("test_modules").resolve("tests_java_examples"))
+includeBuild(root.resolve("test_modules").resolve("tests_java_examplesAndroidN"))
+includeBuild(root.resolve("test_modules").resolve("tests_java_examplesAndroidO"))
+includeBuild(root.resolve("test_modules").resolve("tests_java_examplesAndroidP"))
+includeBuild(root.resolve("test_modules").resolve("tests_java_kotlinR8TestResources"))
+
diff --git a/d8_r8/test_modules/tests_java_examples/build.gradle.kts b/d8_r8/test_modules/tests_java_examples/build.gradle.kts
new file mode 100644
index 0000000..63584d2
--- /dev/null
+++ b/d8_r8/test_modules/tests_java_examples/build.gradle.kts
@@ -0,0 +1,57 @@
+// Copyright (c) 2023, the R8 project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import org.gradle.api.JavaVersion
+import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
+
+plugins {
+ `kotlin-dsl`
+ `java-library`
+ id("dependencies-plugin")
+}
+
+val root = getRoot()
+
+java {
+ sourceSets.test.configure {
+ java.srcDirs.clear()
+ java.srcDir(root.resolveAll("src", "test", "examples"))
+ }
+ sourceCompatibility = JavaVersion.VERSION_1_8
+ targetCompatibility = JavaVersion.VERSION_1_8
+}
+
+dependencies {
+ testCompileOnly(Deps.mockito)
+}
+
+tasks {
+ withType<JavaCompile> {
+ dependsOn(gradle.includedBuild("shared").task(":downloadDeps"))
+ }
+
+ compileTestJava {
+ options.compilerArgs = listOf("-g:source,lines")
+ }
+
+ register<JavaCompile>("debuginfo-all") {
+ source = sourceSets.test.get().allSource
+ include("**/*.java")
+ classpath = sourceSets.test.get().compileClasspath
+ destinationDirectory.set(getRoot().resolveAll("build","test","examples","classes_debuginfo_all"))
+ options.compilerArgs = listOf("-g")
+ }
+
+ register<JavaCompile>("debuginfo-none") {
+ source = sourceSets.test.get().allSource
+ include("**/*.java")
+ classpath = sourceSets.test.get().compileClasspath
+ destinationDirectory.set(getRoot().resolveAll("build","test","examples","classes_debuginfo_none"))
+ options.compilerArgs = listOf("-g:none")
+ }
+}
+
+// We just need to register the examples jars for it to be referenced by other modules. This should
+// be placed after all task registrations.
+val buildExampleJars = buildExampleJars("examples")
diff --git a/d8_r8/test_modules/tests_java_examples/gradle.properties b/d8_r8/test_modules/tests_java_examples/gradle.properties
new file mode 100644
index 0000000..a82d85e
--- /dev/null
+++ b/d8_r8/test_modules/tests_java_examples/gradle.properties
@@ -0,0 +1,18 @@
+# Copyright (c) 2023, the R8 project authors. Please see the AUTHORS file
+# for details. All rights reserved. Use of this source code is governed by a
+# BSD-style license that can be found in the LICENSE file.
+
+org.gradle.jvmargs=-Xmx2048M -Dfile.encoding=UTF-8
+kotlin.daemon.jvmargs=-Xmx3g -Dkotlin.js.compiler.legacy.force_enabled=true
+systemProp.file.encoding=UTF-8
+
+# Enable new incremental compilation
+kotlin.incremental.useClasspathSnapshot=true
+
+org.gradle.parallel=true
+org.gradle.caching=false
+org.gradle.configuration-cache=true
+
+# Do not download any jdks or detect them. We provide them.
+org.gradle.java.installations.auto-detect=false
+org.gradle.java.installations.auto-download=false
diff --git a/d8_r8/test_modules/tests_java_examples/settings.gradle.kts b/d8_r8/test_modules/tests_java_examples/settings.gradle.kts
new file mode 100644
index 0000000..8b0fe4e
--- /dev/null
+++ b/d8_r8/test_modules/tests_java_examples/settings.gradle.kts
@@ -0,0 +1,29 @@
+// Copyright (c) 2023, the R8 project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+pluginManagement {
+ repositories {
+ maven {
+ url = uri("file:../../../third_party/dependencies")
+ }
+ maven {
+ url = uri("file:../../../third_party/dependencies_new")
+ }
+ }
+}
+
+dependencyResolutionManagement {
+ repositories {
+ maven {
+ url = uri("file:../../../third_party/dependencies")
+ }
+ maven {
+ url = uri("file:../../../third_party/dependencies_new")
+ }
+ }
+}
+
+rootProject.name = "tests_java_examples"
+val root = rootProject.projectDir.parentFile.parentFile
+includeBuild(root.resolve("shared"))
diff --git a/d8_r8/test_modules/tests_java_examplesAndroidN/build.gradle.kts b/d8_r8/test_modules/tests_java_examplesAndroidN/build.gradle.kts
new file mode 100644
index 0000000..38406dc
--- /dev/null
+++ b/d8_r8/test_modules/tests_java_examplesAndroidN/build.gradle.kts
@@ -0,0 +1,36 @@
+// Copyright (c) 2023, the R8 project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import org.gradle.api.JavaVersion
+import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
+
+plugins {
+ `kotlin-dsl`
+ `java-library`
+ id("dependencies-plugin")
+}
+
+val root = getRoot()
+
+java {
+ sourceSets.test.configure {
+ java.srcDirs.clear()
+ java.srcDir(root.resolveAll("src", "test", "examplesAndroidN"))
+ }
+ sourceCompatibility = JavaVersion.VERSION_1_8
+ targetCompatibility = JavaVersion.VERSION_1_8
+}
+
+dependencies {
+ testCompileOnly(Deps.asm)
+}
+
+// We just need to register the examples jars for it to be referenced by other modules.
+val buildExampleJars = buildExampleJars("examplesAndroidN")
+
+tasks {
+ withType<JavaCompile> {
+ dependsOn(gradle.includedBuild("shared").task(":downloadDeps"))
+ }
+}
diff --git a/d8_r8/test_modules/tests_java_examplesAndroidN/gradle.properties b/d8_r8/test_modules/tests_java_examplesAndroidN/gradle.properties
new file mode 100644
index 0000000..a82d85e
--- /dev/null
+++ b/d8_r8/test_modules/tests_java_examplesAndroidN/gradle.properties
@@ -0,0 +1,18 @@
+# Copyright (c) 2023, the R8 project authors. Please see the AUTHORS file
+# for details. All rights reserved. Use of this source code is governed by a
+# BSD-style license that can be found in the LICENSE file.
+
+org.gradle.jvmargs=-Xmx2048M -Dfile.encoding=UTF-8
+kotlin.daemon.jvmargs=-Xmx3g -Dkotlin.js.compiler.legacy.force_enabled=true
+systemProp.file.encoding=UTF-8
+
+# Enable new incremental compilation
+kotlin.incremental.useClasspathSnapshot=true
+
+org.gradle.parallel=true
+org.gradle.caching=false
+org.gradle.configuration-cache=true
+
+# Do not download any jdks or detect them. We provide them.
+org.gradle.java.installations.auto-detect=false
+org.gradle.java.installations.auto-download=false
diff --git a/d8_r8/test_modules/tests_java_examplesAndroidN/settings.gradle.kts b/d8_r8/test_modules/tests_java_examplesAndroidN/settings.gradle.kts
new file mode 100644
index 0000000..8a41fce
--- /dev/null
+++ b/d8_r8/test_modules/tests_java_examplesAndroidN/settings.gradle.kts
@@ -0,0 +1,29 @@
+// Copyright (c) 2023, the R8 project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+pluginManagement {
+ repositories {
+ maven {
+ url = uri("file:../../../third_party/dependencies")
+ }
+ maven {
+ url = uri("file:../../../third_party/dependencies_new")
+ }
+ }
+}
+
+dependencyResolutionManagement {
+ repositories {
+ maven {
+ url = uri("file:../../../third_party/dependencies")
+ }
+ maven {
+ url = uri("file:../../../third_party/dependencies_new")
+ }
+ }
+}
+
+rootProject.name = "tests_java_examplesAndroidN"
+val root = rootProject.projectDir.parentFile.parentFile
+includeBuild(root.resolve("shared"))
diff --git a/d8_r8/test_modules/tests_java_examplesAndroidO/build.gradle.kts b/d8_r8/test_modules/tests_java_examplesAndroidO/build.gradle.kts
new file mode 100644
index 0000000..2f8a9a0
--- /dev/null
+++ b/d8_r8/test_modules/tests_java_examplesAndroidO/build.gradle.kts
@@ -0,0 +1,45 @@
+// Copyright (c) 2023, the R8 project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import org.gradle.api.JavaVersion
+import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
+
+plugins {
+ `kotlin-dsl`
+ `java-library`
+ id("dependencies-plugin")
+}
+
+val root = getRoot()
+
+java {
+ sourceSets.test.configure {
+ java.srcDirs.clear()
+ java.srcDir(root.resolveAll("src", "test", "examplesAndroidO"))
+ }
+ sourceCompatibility = JavaVersion.VERSION_1_8
+ targetCompatibility = JavaVersion.VERSION_1_8
+}
+
+// NOTE: we want to enable a scenario when test needs to reference some classes generated by legacy
+// (1.6) Java compiler to test some specific behaviour. To do so we compile all the java files
+// located in a sub-directory called 'legacy' with Java 1.6, then compile the rest of the files with
+// Java 1.8 and a reference to previously generated 1.6 classes.
+
+dependencies {
+ testCompileOnly(Deps.asm)
+ testCompileOnly(resolve(ThirdPartyDeps.examplesAndroidOLegacy))
+ testCompileOnly(resolve(getThirdPartyAndroidJar("lib-v26"),"android.jar"))
+}
+
+// We just need to register the examples jars for it to be referenced by other modules.
+val buildExampleJars = buildExampleJars("examplesAndroidO")
+
+tasks {
+ withType<JavaCompile> {
+ dependsOn(gradle.includedBuild("shared").task(":downloadDeps"))
+ options.compilerArgs.add("-Xlint:-options")
+ options.compilerArgs.add("-parameters")
+ }
+}
diff --git a/d8_r8/test_modules/tests_java_examplesAndroidO/gradle.properties b/d8_r8/test_modules/tests_java_examplesAndroidO/gradle.properties
new file mode 100644
index 0000000..a82d85e
--- /dev/null
+++ b/d8_r8/test_modules/tests_java_examplesAndroidO/gradle.properties
@@ -0,0 +1,18 @@
+# Copyright (c) 2023, the R8 project authors. Please see the AUTHORS file
+# for details. All rights reserved. Use of this source code is governed by a
+# BSD-style license that can be found in the LICENSE file.
+
+org.gradle.jvmargs=-Xmx2048M -Dfile.encoding=UTF-8
+kotlin.daemon.jvmargs=-Xmx3g -Dkotlin.js.compiler.legacy.force_enabled=true
+systemProp.file.encoding=UTF-8
+
+# Enable new incremental compilation
+kotlin.incremental.useClasspathSnapshot=true
+
+org.gradle.parallel=true
+org.gradle.caching=false
+org.gradle.configuration-cache=true
+
+# Do not download any jdks or detect them. We provide them.
+org.gradle.java.installations.auto-detect=false
+org.gradle.java.installations.auto-download=false
diff --git a/d8_r8/test_modules/tests_java_examplesAndroidO/settings.gradle.kts b/d8_r8/test_modules/tests_java_examplesAndroidO/settings.gradle.kts
new file mode 100644
index 0000000..0c63913
--- /dev/null
+++ b/d8_r8/test_modules/tests_java_examplesAndroidO/settings.gradle.kts
@@ -0,0 +1,29 @@
+// Copyright (c) 2023, the R8 project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+pluginManagement {
+ repositories {
+ maven {
+ url = uri("file:../../../third_party/dependencies")
+ }
+ maven {
+ url = uri("file:../../../third_party/dependencies_new")
+ }
+ }
+}
+
+dependencyResolutionManagement {
+ repositories {
+ maven {
+ url = uri("file:../../../third_party/dependencies")
+ }
+ maven {
+ url = uri("file:../../../third_party/dependencies_new")
+ }
+ }
+}
+
+rootProject.name = "tests_java_examplesAndroidO"
+val root = rootProject.projectDir.parentFile.parentFile
+includeBuild(root.resolve("shared"))
diff --git a/d8_r8/test_modules/tests_java_examplesAndroidP/build.gradle.kts b/d8_r8/test_modules/tests_java_examplesAndroidP/build.gradle.kts
new file mode 100644
index 0000000..7b418461
--- /dev/null
+++ b/d8_r8/test_modules/tests_java_examplesAndroidP/build.gradle.kts
@@ -0,0 +1,37 @@
+// Copyright (c) 2023, the R8 project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import org.gradle.api.JavaVersion
+import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
+
+plugins {
+ `kotlin-dsl`
+ `java-library`
+ id("dependencies-plugin")
+}
+
+val root = getRoot()
+
+java {
+ sourceSets.test.configure {
+ java.srcDirs.clear()
+ java.srcDir(root.resolveAll("src", "test", "examplesAndroidP"))
+ }
+ sourceCompatibility = JavaVersion.VERSION_1_8
+ targetCompatibility = JavaVersion.VERSION_1_8
+}
+
+dependencies {
+ testCompileOnly(Deps.asm)
+}
+
+// We just need to register the examples jars for it to be referenced by other modules.
+val buildExampleJars = buildExampleJars("examplesAndroidP")
+
+
+tasks {
+ withType<JavaCompile> {
+ dependsOn(gradle.includedBuild("shared").task(":downloadDeps"))
+ }
+}
diff --git a/d8_r8/test_modules/tests_java_examplesAndroidP/gradle.properties b/d8_r8/test_modules/tests_java_examplesAndroidP/gradle.properties
new file mode 100644
index 0000000..a82d85e
--- /dev/null
+++ b/d8_r8/test_modules/tests_java_examplesAndroidP/gradle.properties
@@ -0,0 +1,18 @@
+# Copyright (c) 2023, the R8 project authors. Please see the AUTHORS file
+# for details. All rights reserved. Use of this source code is governed by a
+# BSD-style license that can be found in the LICENSE file.
+
+org.gradle.jvmargs=-Xmx2048M -Dfile.encoding=UTF-8
+kotlin.daemon.jvmargs=-Xmx3g -Dkotlin.js.compiler.legacy.force_enabled=true
+systemProp.file.encoding=UTF-8
+
+# Enable new incremental compilation
+kotlin.incremental.useClasspathSnapshot=true
+
+org.gradle.parallel=true
+org.gradle.caching=false
+org.gradle.configuration-cache=true
+
+# Do not download any jdks or detect them. We provide them.
+org.gradle.java.installations.auto-detect=false
+org.gradle.java.installations.auto-download=false
diff --git a/d8_r8/test_modules/tests_java_examplesAndroidP/settings.gradle.kts b/d8_r8/test_modules/tests_java_examplesAndroidP/settings.gradle.kts
new file mode 100644
index 0000000..bf31cb9
--- /dev/null
+++ b/d8_r8/test_modules/tests_java_examplesAndroidP/settings.gradle.kts
@@ -0,0 +1,29 @@
+// Copyright (c) 2023, the R8 project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+pluginManagement {
+ repositories {
+ maven {
+ url = uri("file:../../../third_party/dependencies")
+ }
+ maven {
+ url = uri("file:../../../third_party/dependencies_new")
+ }
+ }
+}
+
+dependencyResolutionManagement {
+ repositories {
+ maven {
+ url = uri("file:../../../third_party/dependencies")
+ }
+ maven {
+ url = uri("file:../../../third_party/dependencies_new")
+ }
+ }
+}
+
+rootProject.name = "tests_java_examplesAndroidP"
+val root = rootProject.projectDir.parentFile.parentFile
+includeBuild(root.resolve("shared"))
diff --git a/d8_r8/test_modules/tests_java_kotlinR8TestResources/build.gradle.kts b/d8_r8/test_modules/tests_java_kotlinR8TestResources/build.gradle.kts
new file mode 100644
index 0000000..2ca6560
--- /dev/null
+++ b/d8_r8/test_modules/tests_java_kotlinR8TestResources/build.gradle.kts
@@ -0,0 +1,43 @@
+// Copyright (c) 2023, the R8 project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import org.gradle.api.JavaVersion
+import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
+
+plugins {
+ `kotlin-dsl`
+ `java-library`
+ id("dependencies-plugin")
+}
+
+val root = getRoot()
+
+java {
+ sourceSets.test.configure {
+ java.srcDirs.clear()
+ java.srcDir(root.resolveAll("src", "test", "kotlinR8TestResources"))
+ }
+ sourceCompatibility = JavaVersion.VERSION_1_8
+ targetCompatibility = JavaVersion.VERSION_1_8
+}
+
+dependencies {
+ testCompileOnly(Deps.asm)
+}
+
+// We just need to register the examples jars for it to be referenced by other modules.
+val buildExampleJars = buildExampleJars("kotlinR8TestResources")
+
+tasks {
+ withType<JavaCompile> {
+ dependsOn(gradle.includedBuild("shared").task(":downloadDeps"))
+ }
+
+ withType<KotlinCompile> {
+ dependsOn(gradle.includedBuild("shared").task(":downloadDeps"))
+ kotlinOptions {
+ jvmTarget = "1.8"
+ }
+ }
+}
diff --git a/d8_r8/test_modules/tests_java_kotlinR8TestResources/gradle.properties b/d8_r8/test_modules/tests_java_kotlinR8TestResources/gradle.properties
new file mode 100644
index 0000000..a82d85e
--- /dev/null
+++ b/d8_r8/test_modules/tests_java_kotlinR8TestResources/gradle.properties
@@ -0,0 +1,18 @@
+# Copyright (c) 2023, the R8 project authors. Please see the AUTHORS file
+# for details. All rights reserved. Use of this source code is governed by a
+# BSD-style license that can be found in the LICENSE file.
+
+org.gradle.jvmargs=-Xmx2048M -Dfile.encoding=UTF-8
+kotlin.daemon.jvmargs=-Xmx3g -Dkotlin.js.compiler.legacy.force_enabled=true
+systemProp.file.encoding=UTF-8
+
+# Enable new incremental compilation
+kotlin.incremental.useClasspathSnapshot=true
+
+org.gradle.parallel=true
+org.gradle.caching=false
+org.gradle.configuration-cache=true
+
+# Do not download any jdks or detect them. We provide them.
+org.gradle.java.installations.auto-detect=false
+org.gradle.java.installations.auto-download=false
diff --git a/d8_r8/test_modules/tests_java_kotlinR8TestResources/settings.gradle.kts b/d8_r8/test_modules/tests_java_kotlinR8TestResources/settings.gradle.kts
new file mode 100644
index 0000000..f5d5e59
--- /dev/null
+++ b/d8_r8/test_modules/tests_java_kotlinR8TestResources/settings.gradle.kts
@@ -0,0 +1,29 @@
+// Copyright (c) 2023, the R8 project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+pluginManagement {
+ repositories {
+ maven {
+ url = uri("file:../../../third_party/dependencies")
+ }
+ maven {
+ url = uri("file:../../../third_party/dependencies_new")
+ }
+ }
+}
+
+dependencyResolutionManagement {
+ repositories {
+ maven {
+ url = uri("file:../../../third_party/dependencies")
+ }
+ maven {
+ url = uri("file:../../../third_party/dependencies_new")
+ }
+ }
+}
+
+rootProject.name = "tests_java_kotlinR8TestResources"
+val root = rootProject.projectDir.parentFile.parentFile
+includeBuild(root.resolve("shared"))
diff --git a/src/test/java/com/android/tools/r8/D8IncrementalRunExamplesAndroidOTest.java b/src/test/java/com/android/tools/r8/D8IncrementalRunExamplesAndroidOTest.java
index 1d09697..d3a155f 100644
--- a/src/test/java/com/android/tools/r8/D8IncrementalRunExamplesAndroidOTest.java
+++ b/src/test/java/com/android/tools/r8/D8IncrementalRunExamplesAndroidOTest.java
@@ -156,7 +156,8 @@
Path getGeneratedRoot(Path testJarFile) {
String sourceSet = testJarFile.getParent().toFile().getName();
- return Paths.get(ToolHelper.THIRD_PARTY_DIR, sourceSet + "Generated", packageName);
+ Path parent = testJarFile.getParent().getParent().getParent();
+ return parent.resolve(Paths.get("generated", sourceSet, packageName));
}
AndroidApp compileClassFilesInIntermediate(
diff --git a/src/test/java/com/android/tools/r8/D8NonLazyRunExamplesAndroidOTest.java b/src/test/java/com/android/tools/r8/D8NonLazyRunExamplesAndroidOTest.java
index 7fc01c3..c87ad97 100644
--- a/src/test/java/com/android/tools/r8/D8NonLazyRunExamplesAndroidOTest.java
+++ b/src/test/java/com/android/tools/r8/D8NonLazyRunExamplesAndroidOTest.java
@@ -6,7 +6,8 @@
import java.nio.file.Path;
-public class D8NonLazyRunExamplesAndroidOTest extends D8IncrementalRunExamplesAndroidOTest {
+public class D8NonLazyRunExamplesAndroidOTest
+ extends D8IncrementalRunExamplesAndroidOTest {
class D8LazyTestRunner extends D8IncrementalTestRunner {
D8LazyTestRunner(String testName, String packageName, String mainClass) {
diff --git a/src/test/java/com/android/tools/r8/KotlinTestBase.java b/src/test/java/com/android/tools/r8/KotlinTestBase.java
index a98d7f0..f314547 100644
--- a/src/test/java/com/android/tools/r8/KotlinTestBase.java
+++ b/src/test/java/com/android/tools/r8/KotlinTestBase.java
@@ -24,6 +24,7 @@
import java.util.Map;
import java.util.function.Consumer;
import java.util.stream.Collectors;
+import org.hamcrest.Matcher;
import org.junit.rules.TemporaryFolder;
public abstract class KotlinTestBase extends TestBase {
@@ -90,7 +91,15 @@
}
protected Path getJavaJarFile(String folder) {
- return Paths.get(ToolHelper.THIRD_PARTY_DIR, RSRC, folder + FileUtils.JAR_EXTENSION);
+ return Paths.get(ToolHelper.TESTS_BUILD_DIR, RSRC, folder + FileUtils.JAR_EXTENSION);
+ }
+
+ protected Path getMappingfile(String folder, String mappingFileName) {
+ return Paths.get(ToolHelper.TESTS_DIR, RSRC, folder, mappingFileName);
+ }
+
+ protected static Matcher<String> expectedInfoMessagesFromKotlinStdLib() {
+ return containsString("No VersionRequirement");
}
protected KotlinCompilerTool kotlinCompilerTool() {
diff --git a/src/test/java/com/android/tools/r8/ToolHelper.java b/src/test/java/com/android/tools/r8/ToolHelper.java
index b223f76..11e546d 100644
--- a/src/test/java/com/android/tools/r8/ToolHelper.java
+++ b/src/test/java/com/android/tools/r8/ToolHelper.java
@@ -153,6 +153,7 @@
public static final String MAIN_SOURCE_DIR = getProjectRoot() + "src/main/java/";
public static final String LIBRARY_DESUGAR_SOURCE_DIR = getProjectRoot() + "src/library_desugar/";
public static final String BUILD_DIR = getProjectRoot() + "build/";
+ public static final String GENERATED_TEST_BUILD_DIR = BUILD_DIR + "generated/test/";
public static final String LIBS_DIR = BUILD_DIR + "libs/";
public static final String THIRD_PARTY_DIR = getProjectRoot() + "third_party/";
public static final String DEPENDENCIES = THIRD_PARTY_DIR + "dependencies/";
@@ -163,15 +164,17 @@
public static final String EXAMPLES_DIR = TESTS_DIR + "examples/";
public static final String EXAMPLES_ANDROID_O_DIR = TESTS_DIR + "examplesAndroidO/";
public static final String EXAMPLES_ANDROID_P_DIR = TESTS_DIR + "examplesAndroidP/";
- public static final String EXAMPLES_BUILD_DIR = THIRD_PARTY_DIR + "examples/";
- public static final String EXAMPLES_CF_DIR = EXAMPLES_BUILD_DIR + "classes/";
- public static final String EXAMPLES_ANDROID_N_BUILD_DIR = THIRD_PARTY_DIR + "examplesAndroidN/";
- public static final String EXAMPLES_ANDROID_O_BUILD_DIR = THIRD_PARTY_DIR + "examplesAndroidO/";
- public static final String EXAMPLES_ANDROID_P_BUILD_DIR = THIRD_PARTY_DIR + "examplesAndroidP/";
public static final String TESTS_BUILD_DIR = BUILD_DIR + "test/";
+ public static final String EXAMPLES_BUILD_DIR = TESTS_BUILD_DIR + "examples/";
+ public static final String EXAMPLES_CF_DIR = EXAMPLES_BUILD_DIR + "classes/";
+ public static final String EXAMPLES_ANDROID_N_BUILD_DIR = TESTS_BUILD_DIR + "examplesAndroidN/";
+ public static final String EXAMPLES_ANDROID_O_BUILD_DIR = TESTS_BUILD_DIR + "examplesAndroidO/";
+ public static final String EXAMPLES_ANDROID_P_BUILD_DIR = TESTS_BUILD_DIR + "examplesAndroidP/";
public static final String EXAMPLES_JAVA9_BUILD_DIR = TESTS_BUILD_DIR + "examplesJava9/";
public static final String EXAMPLES_JAVA10_BUILD_DIR = TESTS_BUILD_DIR + "examplesJava10/";
public static final String EXAMPLES_JAVA11_JAR_DIR = TESTS_BUILD_DIR + "examplesJava11/";
+ public static final String EXAMPLES_PROTO_BUILD_DIR = TESTS_BUILD_DIR + "examplesProto/";
+ public static final String GENERATED_PROTO_BUILD_DIR = GENERATED_TEST_BUILD_DIR + "proto/";
public static final String SMALI_BUILD_DIR = THIRD_PARTY_DIR + "smali/";
public static String getExamplesJava11BuildDir() {
diff --git a/src/test/java/com/android/tools/r8/shaking/TreeShakingSpecificTest.java b/src/test/java/com/android/tools/r8/shaking/TreeShakingSpecificTest.java
index 1afb1c3..1dba3c9 100644
--- a/src/test/java/com/android/tools/r8/shaking/TreeShakingSpecificTest.java
+++ b/src/test/java/com/android/tools/r8/shaking/TreeShakingSpecificTest.java
@@ -52,6 +52,10 @@
return Paths.get(EXAMPLES_BUILD_DIR, test + ".jar");
}
+ private byte[] getProgramDexFileData(String test) throws IOException {
+ return Files.readAllBytes(Paths.get(EXAMPLES_BUILD_DIR, test, "classes.dex"));
+ }
+
@Test
public void testIgnoreWarnings() throws Exception {
// Generate R8 processed version without library option.
diff --git a/third_party/examples.tar.gz.sha1 b/third_party/examples.tar.gz.sha1
deleted file mode 100644
index 7cc4607..0000000
--- a/third_party/examples.tar.gz.sha1
+++ /dev/null
@@ -1 +0,0 @@
-a64a830bad847a8bcb1b1d441b16876882951960
\ No newline at end of file
diff --git a/third_party/examplesAndroidN.tar.gz.sha1 b/third_party/examplesAndroidN.tar.gz.sha1
deleted file mode 100644
index c7c48ab..0000000
--- a/third_party/examplesAndroidN.tar.gz.sha1
+++ /dev/null
@@ -1 +0,0 @@
-3b4abfc288b97b2f592de1528162ffdfa4db76c2
\ No newline at end of file
diff --git a/third_party/examplesAndroidO.tar.gz.sha1 b/third_party/examplesAndroidO.tar.gz.sha1
deleted file mode 100644
index 7d28b20..0000000
--- a/third_party/examplesAndroidO.tar.gz.sha1
+++ /dev/null
@@ -1 +0,0 @@
-05367865efe55fcbf75c782deddab15ae7c40dad
\ No newline at end of file
diff --git a/third_party/examplesAndroidOGenerated.tar.gz.sha1 b/third_party/examplesAndroidOGenerated.tar.gz.sha1
deleted file mode 100644
index 832286b..0000000
--- a/third_party/examplesAndroidOGenerated.tar.gz.sha1
+++ /dev/null
@@ -1 +0,0 @@
-ea9220ee4f864517540f693ab0fd371a24607bf2
\ No newline at end of file
diff --git a/third_party/examplesAndroidP.tar.gz.sha1 b/third_party/examplesAndroidP.tar.gz.sha1
deleted file mode 100644
index 8b2db07..0000000
--- a/third_party/examplesAndroidP.tar.gz.sha1
+++ /dev/null
@@ -1 +0,0 @@
-591f8ee9f40e7a433e951908a22367d2001ff80e
\ No newline at end of file
diff --git a/third_party/examplesAndroidPGenerated.tar.gz.sha1 b/third_party/examplesAndroidPGenerated.tar.gz.sha1
deleted file mode 100644
index 28762a8..0000000
--- a/third_party/examplesAndroidPGenerated.tar.gz.sha1
+++ /dev/null
@@ -1 +0,0 @@
-8c0a039c70b4b335a017a818d286a9ace420a7ef
\ No newline at end of file
diff --git a/third_party/kotlinR8TestResources.tar.gz.sha1 b/third_party/kotlinR8TestResources.tar.gz.sha1
deleted file mode 100644
index 44d30c5..0000000
--- a/third_party/kotlinR8TestResources.tar.gz.sha1
+++ /dev/null
@@ -1 +0,0 @@
-4d5ea5f132e98018c5e3ef73ce478e0745d7f998
\ No newline at end of file