blob: 062128c4d7c976848c533f852a78d6a912cb6347 [file] [log] [blame]
// 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")
val thirdPartyCompileDependenciesTask = ensureThirdPartyDependencies(
"compileDeps",
listOf(
ThirdPartyDeps.examplesAndroidOLegacy,
Jdk.JDK_11.getThirdPartyDependency(),
getThirdPartyAndroidJar("lib-v26")))
tasks {
withType<JavaCompile> {
dependsOn(thirdPartyCompileDependenciesTask)
options.compilerArgs.add("-Xlint:-options")
options.compilerArgs.add("-parameters")
}
}