From 1b0fd835b9c597ef0c15fe28202fda8aa10197ca Mon Sep 17 00:00:00 2001 From: Jiaxiang Chen Date: Tue, 10 May 2022 22:24:59 -0700 Subject: [PATCH] UPDATE_KOTLIN_VERSION: 1.7.0-RC --- .../com/google/devtools/ksp/gradle/KspSubplugin.kt | 10 +++++----- gradle.properties | 2 +- .../com/google/devtools/ksp/test/PlaygroundIT.kt | 9 ++++++--- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/gradle-plugin/src/main/kotlin/com/google/devtools/ksp/gradle/KspSubplugin.kt b/gradle-plugin/src/main/kotlin/com/google/devtools/ksp/gradle/KspSubplugin.kt index 7019a08488..a6714f5089 100644 --- a/gradle-plugin/src/main/kotlin/com/google/devtools/ksp/gradle/KspSubplugin.kt +++ b/gradle-plugin/src/main/kotlin/com/google/devtools/ksp/gradle/KspSubplugin.kt @@ -78,10 +78,10 @@ internal class Configurator : AbstractKotlinCompileConfig, kotlinCompile: AbstractKotlinCompile<*>) : super(compilation) { configureTask { task -> if (task is KspTaskJvm) { - // Assign moduleName different from kotlin compilation to + // Assign ownModuleName different from kotlin compilation to // work around https://github.com/google/ksp/issues/647 // This will not be necessary once https://youtrack.jetbrains.com/issue/KT-45777 lands - task.moduleName.value(kotlinCompile.moduleName.map { "$it-ksp" }) + task.ownModuleName.value(kotlinCompile.ownModuleName.map { "$it-ksp" }) } if (task is KspTaskJS) { val libraryCacheService = project.rootProject.gradle.sharedServices.registerIfAbsent( @@ -624,7 +624,7 @@ abstract class KspTaskJvm @Inject constructor( args.addPluginOptions(options.get()) args.destinationAsFile = destination args.allowNoSourceFiles = true - args.useFir = false + args.useK2 = false } // Overrding an internal function is hacky. @@ -743,7 +743,7 @@ abstract class KspTaskJS @Inject constructor( args.addPluginOptions(options.get()) args.outputFile = File(destination, "dummyOutput.js").canonicalPath kotlinOptions.copyFreeCompilerArgsToArgs(args) - args.useFir = false + args.useK2 = false } // Overrding an internal function is hacky. @@ -832,7 +832,7 @@ abstract class KspTaskMetadata @Inject constructor( args.friendPaths = friendPaths.files.map { it.absolutePath }.toTypedArray() args.refinesPaths = refinesMetadataPaths.map { it.absolutePath }.toTypedArray() args.expectActualLinker = true - args.useFir = false + args.useK2 = false } // Overrding an internal function is hacky. diff --git a/gradle.properties b/gradle.properties index 8fd7d56235..0a55593ce0 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,7 +1,7 @@ # Copied from kotlinc org.gradle.jvmargs=-Duser.country=US -Dkotlin.daemon.jvm.options=-Xmx2200m -Dfile.encoding=UTF-8 -kotlinBaseVersion=1.7.0-Beta +kotlinBaseVersion=1.7.0-RC agpBaseVersion=7.0.0 intellijVersion=203.8084.24 junitVersion=4.12 diff --git a/integration-tests/src/test/kotlin/com/google/devtools/ksp/test/PlaygroundIT.kt b/integration-tests/src/test/kotlin/com/google/devtools/ksp/test/PlaygroundIT.kt index 36f9510d01..0e3d0fe35e 100644 --- a/integration-tests/src/test/kotlin/com/google/devtools/ksp/test/PlaygroundIT.kt +++ b/integration-tests/src/test/kotlin/com/google/devtools/ksp/test/PlaygroundIT.kt @@ -5,6 +5,7 @@ import org.gradle.testkit.runner.GradleRunner import org.gradle.testkit.runner.TaskOutcome import org.junit.Assert import org.junit.Assume +import org.junit.Ignore import org.junit.Rule import org.junit.Test import java.io.File @@ -147,15 +148,17 @@ class PlaygroundIT { } } + // Disabled for now: ERROR: K2 does not support plugins yet, so please remove -Xuse-k2 flag // Test -Xuse-fir for compilation; KSP still uses FE1.0 + @Ignore @Test fun testFirPreview() { val gradleProperties = File(project.root, "gradle.properties") - gradleProperties.appendText("\nkotlin.useFir=true") + gradleProperties.appendText("\nkotlin.useK2=true") val gradleRunner = GradleRunner.create().withProjectDir(project.root) gradleRunner.buildAndCheck("clean", "build") { result -> - Assert.assertTrue(result.output.contains("This build uses in-dev FIR")) - Assert.assertTrue(result.output.contains("-Xuse-fir")) + Assert.assertTrue(result.output.contains("This build uses experimental K2 compiler")) + Assert.assertTrue(result.output.contains("-Xuse-k2")) } project.restore(gradleProperties.path) }