Remove compose compatibility version check ^KT-67216
diff --git a/libraries/tools/kotlin-compose-compiler/src/common/kotlin/org/jetbrains/kotlin/compose/compiler/gradle/ComposeCompilerGradlePluginExtension.kt b/libraries/tools/kotlin-compose-compiler/src/common/kotlin/org/jetbrains/kotlin/compose/compiler/gradle/ComposeCompilerGradlePluginExtension.kt index 336646c..61b0220 100644 --- a/libraries/tools/kotlin-compose-compiler/src/common/kotlin/org/jetbrains/kotlin/compose/compiler/gradle/ComposeCompilerGradlePluginExtension.kt +++ b/libraries/tools/kotlin-compose-compiler/src/common/kotlin/org/jetbrains/kotlin/compose/compiler/gradle/ComposeCompilerGradlePluginExtension.kt
@@ -85,19 +85,6 @@ val enableNonSkippingGroupOptimization: Property<Boolean> = objectFactory.property(Boolean::class.java).convention(false) /** - * Suppress Kotlin version compatibility check. - * - * By default, this compatibility check verifies that the specified version of Compose Compiler is compatible with the specified - * version of Kotlin. In most cases, users should only be using versions that are known to be compatible, and so setting this flag - * should be unnecessary. However, in rare cases (such as custom compiler builds, or to take a fix in one compiler without upgrading - * the other compiler), users may wish to suppress the compatibility check in order to use a combination of Compose Compiler and Kotlin - * Compiler that is not officially supported. - * - * As a value, you should provide a Kotlin version which is used with the compose compiler. - */ - abstract val suppressKotlinVersionCompatibilityCheck: Property<String> - - /** * Enable experimental strong skipping mode. * * Strong Skipping is an experimental mode that improves the runtime performance of your application by skipping unnecessary
diff --git a/libraries/tools/kotlin-compose-compiler/src/common/kotlin/org/jetbrains/kotlin/compose/compiler/gradle/ComposeCompilerSubplugin.kt b/libraries/tools/kotlin-compose-compiler/src/common/kotlin/org/jetbrains/kotlin/compose/compiler/gradle/ComposeCompilerSubplugin.kt index 5e3ad3a..35979d1 100644 --- a/libraries/tools/kotlin-compose-compiler/src/common/kotlin/org/jetbrains/kotlin/compose/compiler/gradle/ComposeCompilerSubplugin.kt +++ b/libraries/tools/kotlin-compose-compiler/src/common/kotlin/org/jetbrains/kotlin/compose/compiler/gradle/ComposeCompilerSubplugin.kt
@@ -79,9 +79,6 @@ add(composeCompilerExtension.enableNonSkippingGroupOptimization.map { SubpluginOption("nonSkippingGroupOptimization", it.toString()) }) - add(composeCompilerExtension.suppressKotlinVersionCompatibilityCheck.map { - SubpluginOption("suppressKotlinVersionCompatibilityCheck", it) - }.orElse(EMPTY_OPTION)) add(composeCompilerExtension.enableExperimentalStrongSkippingMode.map { SubpluginOption("experimentalStrongSkipping", it.toString()) })
diff --git a/libraries/tools/kotlin-compose-compiler/src/functionalTest/kotlin/org/jetbrains/kotlin/compose/compiler/gradle/ExtensionConfigurationTest.kt b/libraries/tools/kotlin-compose-compiler/src/functionalTest/kotlin/org/jetbrains/kotlin/compose/compiler/gradle/ExtensionConfigurationTest.kt index 990fb6f..e16f87e 100644 --- a/libraries/tools/kotlin-compose-compiler/src/functionalTest/kotlin/org/jetbrains/kotlin/compose/compiler/gradle/ExtensionConfigurationTest.kt +++ b/libraries/tools/kotlin-compose-compiler/src/functionalTest/kotlin/org/jetbrains/kotlin/compose/compiler/gradle/ExtensionConfigurationTest.kt
@@ -85,19 +85,6 @@ } @Test - fun testSuppressKotlinVersionCompatibilityCheck() { - testComposeOptions( - { extension, _ -> - extension.suppressKotlinVersionCompatibilityCheck.value("2.0.5") - } - ) { options, _ -> - assertTrue( - options.contains("suppressKotlinVersionCompatibilityCheck" to "2.0.5") - ) - } - } - - @Test fun notIncludeSourceInformationOnAgpPresence() { testComposeOptions( { _, project ->
diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/ComposeIT.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/ComposeIT.kt index 5952f3d..920b079 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/ComposeIT.kt +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/ComposeIT.kt
@@ -37,10 +37,6 @@ | id "org.jetbrains.kotlin.plugin.compose" |${originalBuildScript.substringAfter("plugins {")} | - |composeCompiler { - | suppressKotlinVersionCompatibilityCheck.set("${buildOptions.kotlinVersion}") - |} - | |dependencies { | implementation "androidx.compose.runtime:runtime:1.6.4" |} @@ -61,7 +57,6 @@ "plugin:androidx.compose.compiler.plugins.kotlin:sourceInformation=false," + "plugin:androidx.compose.compiler.plugins.kotlin:intrinsicRemember=false," + "plugin:androidx.compose.compiler.plugins.kotlin:nonSkippingGroupOptimization=false," + - "plugin:androidx.compose.compiler.plugins.kotlin:suppressKotlinVersionCompatibilityCheck=${buildOptions.kotlinVersion}," + "plugin:androidx.compose.compiler.plugins.kotlin:experimentalStrongSkipping=false," + "plugin:androidx.compose.compiler.plugins.kotlin:traceMarkersEnabled=false", LogLevel.INFO @@ -84,15 +79,6 @@ buildJdk = providedJdk.location, buildOptions = defaultBuildOptions.copy(androidVersion = agpVersion) ) { - buildGradleKts.appendText( - """ - | - |composeCompiler { - | suppressKotlinVersionCompatibilityCheck.set("${buildOptions.kotlinVersion}") - |} - """.trimMargin() - ) - build("assembleDebug") { assertOutputContains("Detected Android Gradle Plugin compose compiler configuration") } @@ -158,7 +144,6 @@ """ | |composeCompiler { - | suppressKotlinVersionCompatibilityCheck.set("${buildOptions.kotlinVersion}") | metricsDestination.set(project.layout.buildDirectory.dir("metrics")) | reportsDestination.set(project.layout.buildDirectory.dir("reports")) | stabilityConfigurationFile.set(project.layout.projectDirectory.file("stability-configuration.conf"))
diff --git a/plugins/compose/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/ComposePlugin.kt b/plugins/compose/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/ComposePlugin.kt index 1d06f59..ca488fb 100644 --- a/plugins/compose/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/ComposePlugin.kt +++ b/plugins/compose/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/ComposePlugin.kt
@@ -73,7 +73,7 @@ "Enabled optimization to remove groups around non-skipping functions" ) val SUPPRESS_KOTLIN_VERSION_COMPATIBILITY_CHECK = CompilerConfigurationKey<String?>( - "Version of Kotlin for which version compatibility check should be suppressed" + "Deprecated. Version of Kotlin for which version compatibility check should be suppressed" ) val DECOYS_ENABLED_KEY = CompilerConfigurationKey<Boolean>("Generate decoy methods in IR transform") @@ -158,7 +158,7 @@ val SUPPRESS_KOTLIN_VERSION_CHECK_ENABLED_OPTION = CliOption( "suppressKotlinVersionCompatibilityCheck", "<kotlin_version>", - "Suppress Kotlin version compatibility check", + "Deprecated. Suppress Kotlin version compatibility check", required = false, allowMultipleOccurrences = false ) @@ -300,80 +300,15 @@ companion object { fun checkCompilerVersion(configuration: CompilerConfiguration): Boolean { - try { - val KOTLIN_VERSION_EXPECTATION = "2.0.0-Beta4" - KotlinCompilerVersion.getVersion()?.let { version -> - val msgCollector = configuration.get(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY) - val suppressKotlinVersionCheck = configuration.get( - ComposeConfiguration.SUPPRESS_KOTLIN_VERSION_COMPATIBILITY_CHECK - ) - if ( - suppressKotlinVersionCheck != null && - suppressKotlinVersionCheck != version - ) { - if (suppressKotlinVersionCheck == "true") { - msgCollector?.report( - CompilerMessageSeverity.STRONG_WARNING, - " `suppressKotlinVersionCompatibilityCheck` should" + - " specify the version of Kotlin for which you want the" + - " compatibility check to be disabled. For example," + - " `suppressKotlinVersionCompatibilityCheck=$version`" - ) - } else { - msgCollector?.report( - CompilerMessageSeverity.STRONG_WARNING, - " `suppressKotlinVersionCompatibilityCheck` is set to a" + - " version of Kotlin ($suppressKotlinVersionCheck) that you" + - " are not using and should be set properly. (you are using" + - " Kotlin $version)" - ) - } - } - if (suppressKotlinVersionCheck == KOTLIN_VERSION_EXPECTATION) { - msgCollector?.report( - CompilerMessageSeverity.STRONG_WARNING, - " `suppressKotlinVersionCompatibilityCheck` is set to the" + - " same version of Kotlin that the Compose Compiler was already" + - " expecting (Kotlin $suppressKotlinVersionCheck), and thus has" + - " no effect and should be removed." - ) - } - if (suppressKotlinVersionCheck != "true" && - version != KOTLIN_VERSION_EXPECTATION && - version != suppressKotlinVersionCheck - ) { - msgCollector?.report( - CompilerMessageSeverity.ERROR, - "This version (${VersionChecker.compilerVersion}) of the" + - " Compose Compiler requires Kotlin version" + - " $KOTLIN_VERSION_EXPECTATION but you appear to be using Kotlin" + - " version $version which is not known to be compatible. Please" + - " consult the Compose-Kotlin compatibility map located at" + - " https://developer.android.com" + - "/jetpack/androidx/releases/compose-kotlin" + - " to choose a compatible version pair (or" + - " `suppressKotlinVersionCompatibilityCheck` but don't say I" + - " didn't warn you!)." - ) - - // Return without registering the Compose plugin because the registration - // APIs may have changed and thus throw an exception during registration, - // preventing the diagnostic from being emitted. - return false - } - } - return true - } catch (t: Throwable) { - throw Error( - "Something went wrong while checking for version compatibility" + - " between the Compose Compiler and the Kotlin Compiler. It is possible" + - " that the versions are incompatible. Please verify your kotlin version " + - " and consult the Compose-Kotlin compatibility map located at" + - " https://developer.android.com" + - "/jetpack/androidx/releases/compose-kotlin", - t + val msgCollector = configuration.get(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY) + val suppressKotlinVersionCheck = configuration.get(ComposeConfiguration.SUPPRESS_KOTLIN_VERSION_COMPATIBILITY_CHECK) + if (suppressKotlinVersionCheck != null) { + msgCollector?.report( + CompilerMessageSeverity.WARNING, + "suppressKotlinVersionCompatibilityCheck flag is deprecated for Compose compiler bundled with Kotlin releases." ) } + return true } fun registerCommonExtensions(project: Project) {