Add remaining simple examples
Bug: b/270105162
Change-Id: Iee14451d895acea5621656772eef5c1faab75dc1
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..05798be
--- /dev/null
+++ b/d8_r8/test_modules/tests_java_examples/build.gradle.kts
@@ -0,0 +1,41 @@
+// 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)
+}
+
+// We just need to register the examples jars for it to be referenced by other modules.
+val buildExampleJars = buildJavaExamplesJars("")
+
+tasks {
+ withType<JavaCompile> {
+ options.setFork(true)
+ options.forkOptions.memoryMaximumSize = "3g"
+ options.forkOptions.jvmArgs = listOf(
+ "-Xss256m",
+ // Set the bootclass path so compilation is consistent with 1.8 target compatibility.
+ "-Xbootclasspath/a:third_party/openjdk/openjdk-rt-1.8/rt.jar")
+ }
+}
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..1de43f9
--- /dev/null
+++ b/d8_r8/test_modules/tests_java_examples/gradle.properties
@@ -0,0 +1,17 @@
+# 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=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..89c7a6f
--- /dev/null
+++ b/d8_r8/test_modules/tests_java_examples/settings.gradle.kts
@@ -0,0 +1,5 @@
+// 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.
+
+rootProject.name = "tests_java_examples"