From db806d6b93225778943987357eeee14f4ac60f7f Mon Sep 17 00:00:00 2001 From: Ting-Yuan Huang Date: Thu, 24 Oct 2024 14:03:47 -0700 Subject: [PATCH] Set JVM target back to Java 8. Newer AGP is only available with Java 11 variants. Therefore: * KSP is compiled with older AGP and targeting Java 8. * Gradle tests and integration tests run with newer AGP. (cherry picked from commit 579c9daf5227d736520b9bbd07dd5de962e9f138) --- build.gradle.kts | 6 +++--- common-deps/build.gradle.kts | 1 - .../google/devtools/ksp/gradle/AndroidPluginIntegration.kt | 2 +- .../com/google/devtools/ksp/gradle/testing/TestConfig.kt | 2 +- gradle.properties | 3 ++- integration-tests/build.gradle.kts | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index f91c394941..e12dd01fa3 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -102,12 +102,12 @@ subprojects { pluginManager.withPlugin("org.jetbrains.kotlin.jvm") { configure { toolchain.languageVersion.set(compileJavaVersion) - sourceCompatibility = JavaVersion.VERSION_11 - targetCompatibility = JavaVersion.VERSION_11 + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 } configure { compilerOptions { - jvmTarget = JvmTarget.JVM_11 + jvmTarget = JvmTarget.JVM_1_8 languageVersion.set(KotlinVersion.KOTLIN_1_9) apiVersion.set(languageVersion) } diff --git a/common-deps/build.gradle.kts b/common-deps/build.gradle.kts index 88f0418b39..5b90471f51 100644 --- a/common-deps/build.gradle.kts +++ b/common-deps/build.gradle.kts @@ -5,7 +5,6 @@ description = "Kotlin Symbol Processor" val kotlinBaseVersion: String by project val junitVersion: String by project val googleTruthVersion: String by project -val agpBaseVersion: String by project val signingKey: String? by project val signingPassword: String? by project diff --git a/gradle-plugin/src/main/kotlin/com/google/devtools/ksp/gradle/AndroidPluginIntegration.kt b/gradle-plugin/src/main/kotlin/com/google/devtools/ksp/gradle/AndroidPluginIntegration.kt index 9647ce6eaa..8c7a006c53 100644 --- a/gradle-plugin/src/main/kotlin/com/google/devtools/ksp/gradle/AndroidPluginIntegration.kt +++ b/gradle-plugin/src/main/kotlin/com/google/devtools/ksp/gradle/AndroidPluginIntegration.kt @@ -53,7 +53,7 @@ object AndroidPluginIntegration { private fun decorateAndroidExtension(project: Project, onSourceSet: (String) -> Unit) { val sourceSets = when (val androidExt = project.extensions.getByName("android")) { is BaseExtension -> androidExt.sourceSets - is CommonExtension<*, *, *, *, *, *> -> androidExt.sourceSets + is CommonExtension<*, *, *, *> -> androidExt.sourceSets else -> throw RuntimeException("Unsupported Android Gradle plugin version.") } sourceSets.all { diff --git a/gradle-plugin/src/test/kotlin/com/google/devtools/ksp/gradle/testing/TestConfig.kt b/gradle-plugin/src/test/kotlin/com/google/devtools/ksp/gradle/testing/TestConfig.kt index 1c048da64d..de975ad2ac 100644 --- a/gradle-plugin/src/test/kotlin/com/google/devtools/ksp/gradle/testing/TestConfig.kt +++ b/gradle-plugin/src/test/kotlin/com/google/devtools/ksp/gradle/testing/TestConfig.kt @@ -55,7 +55,7 @@ data class TestConfig( } val androidBaseVersion by lazy { - kspProjectProperties["agpBaseVersion"] as String + kspProjectProperties["agpTestVersion"] as String } val mavenRepoPath = mavenRepoDir.path.replace(File.separatorChar, '/') diff --git a/gradle.properties b/gradle.properties index a43bc6b556..49cd1ca104 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,7 +2,8 @@ org.gradle.jvmargs=-Duser.country=US -Dkotlin.daemon.jvm.options=-Xmx4096m -Dfile.encoding=UTF-8 kotlinBaseVersion=2.0.21 -agpBaseVersion=8.7.0 +agpBaseVersion=7.3.1 +agpTestVersion=8.7.1 intellijVersion=233.13135.103 junitVersion=4.13.1 junit5Version=5.8.2 diff --git a/integration-tests/build.gradle.kts b/integration-tests/build.gradle.kts index 3d238281d0..3e900aa0b1 100644 --- a/integration-tests/build.gradle.kts +++ b/integration-tests/build.gradle.kts @@ -3,7 +3,7 @@ import kotlin.math.max val junitVersion: String by project val kotlinBaseVersion: String by project -val agpBaseVersion: String by project +val agpTestVersion: String by project plugins { kotlin("jvm") @@ -23,7 +23,7 @@ dependencies { fun Test.configureCommonSettings() { systemProperty("kotlinVersion", kotlinBaseVersion) systemProperty("kspVersion", version) - systemProperty("agpVersion", agpBaseVersion) + systemProperty("agpVersion", agpTestVersion) jvmArgumentProviders.add( RelativizingInternalPathProvider( "testRepo",