diff --git a/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/experimental/internal/configureNativeCompilerCaching.kt b/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/experimental/internal/configureNativeCompilerCaching.kt index c8aa8b5e2d..99a9efbd0c 100644 --- a/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/experimental/internal/configureNativeCompilerCaching.kt +++ b/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/experimental/internal/configureNativeCompilerCaching.kt @@ -8,7 +8,6 @@ package org.jetbrains.compose.experimental.internal import org.gradle.api.Project import org.jetbrains.compose.internal.KOTLIN_MPP_PLUGIN_ID import org.jetbrains.compose.internal.mppExt -import org.jetbrains.compose.internal.service.ConfigurationProblemReporterService import org.jetbrains.compose.internal.utils.KGPPropertyProvider import org.jetbrains.compose.internal.utils.configureEachWithType import org.jetbrains.kotlin.gradle.plugin.getKotlinPluginVersion @@ -65,24 +64,20 @@ private fun KotlinNativeTarget.checkExplicitCacheKind() { for (provider in propertyProviders) { val value = provider.valueOrNull(cacheKindProperty) if (value != null) { - ConfigurationProblemReporterService.reportProblem( - project, - explicitCacheKindWarningMessage(cacheKindProperty, value, provider) - ) - return + error(explicitCacheKindErrorMessage(cacheKindProperty, value, provider)) } } } } -private fun explicitCacheKindWarningMessage( +private fun explicitCacheKindErrorMessage( cacheKindProperty: String, value: String, provider: KGPPropertyProvider ) = """ - |Warning: '$cacheKindProperty' is explicitly set to '$value'. + |Error: '$cacheKindProperty' is explicitly set to '$value'. + |This option significantly slows the Kotlin/Native compiler. |Compose Multiplatform Gradle plugin manages this property automatically based on a Kotlin compiler version being used. - |In future versions of Compose Multiplatform this warning will become an error. | * Recommended action: remove explicit '$cacheKindProperty=$value' from ${provider.location}. | * Alternative action: disable cache kind management by adding '$COMPOSE_NATIVE_MANAGE_CACHE_KIND=false' to your 'gradle.properties'. """.trimMargin() diff --git a/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/internal/service/ConfigurationProblemReporterService.kt b/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/internal/service/ConfigurationProblemReporterService.kt index a13cf45a6d..43d103afb3 100644 --- a/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/internal/service/ConfigurationProblemReporterService.kt +++ b/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/internal/service/ConfigurationProblemReporterService.kt @@ -51,7 +51,7 @@ abstract class ConfigurationProblemReporterService : AbstractComposeMultiplatfor .parameters.fn() } - fun reportProblem(project: Project, message: String) { + fun reportWarning(project: Project, message: String) { configureParameters(project) { warnings.add(message) } } diff --git a/gradle-plugins/compose/src/test/kotlin/org/jetbrains/compose/test/tests/integration/GradlePluginTest.kt b/gradle-plugins/compose/src/test/kotlin/org/jetbrains/compose/test/tests/integration/GradlePluginTest.kt index 4db2446e4a..24a7d27f00 100644 --- a/gradle-plugins/compose/src/test/kotlin/org/jetbrains/compose/test/tests/integration/GradlePluginTest.kt +++ b/gradle-plugins/compose/src/test/kotlin/org/jetbrains/compose/test/tests/integration/GradlePluginTest.kt @@ -148,11 +148,11 @@ class GradlePluginTest : GradlePluginTestBase() { } @Test - fun nativeCacheKindWarning() { + fun nativeCacheKindError() { Assumptions.assumeTrue(currentOS == OS.MacOS) - fun withNativeCacheKindWarningProject(kotlinVersion: String, fn: TestProject.() -> Unit) { + fun withNativeCacheKindErrorProject(kotlinVersion: String, fn: TestProject.() -> Unit) { with(testProject( - TestProjects.nativeCacheKindWarning, + TestProjects.nativeCacheKindError, defaultTestEnvironment.copy(kotlinVersion = kotlinVersion) )) { fn() @@ -164,46 +164,44 @@ class GradlePluginTest : GradlePluginTestBase() { fun testKotlinVersion(kotlinVersion: String) { val args = arrayOf("help") val commonPartOfWarning = "Compose Multiplatform Gradle plugin manages this property automatically" - withNativeCacheKindWarningProject(kotlinVersion = kotlinVersion) { + withNativeCacheKindErrorProject(kotlinVersion = kotlinVersion) { gradle(*args).checks { - check.logDoesntContain("Warning: 'kotlin.native.cacheKind") + check.logDoesntContain("Error: 'kotlin.native.cacheKind") check.logDoesntContain(commonPartOfWarning) } } - withNativeCacheKindWarningProject(kotlinVersion = kotlinVersion) { - gradle(*args, "-Pkotlin.native.cacheKind=none").checks { - check.logContainsOnce("Warning: 'kotlin.native.cacheKind' is explicitly set to 'none'") - check.logContainsOnce(commonPartOfWarning) + withNativeCacheKindErrorProject(kotlinVersion = kotlinVersion) { + gradleFailure(*args, "-Pkotlin.native.cacheKind=none").checks { + check.logContains("Error: 'kotlin.native.cacheKind' is explicitly set to 'none'") + check.logContains(commonPartOfWarning) } - gradle(*args, "-Pkotlin.native.cacheKind=none").checks { - check.logContainsOnce("Warning: 'kotlin.native.cacheKind' is explicitly set to 'none'") - check.logContainsOnce(commonPartOfWarning) + gradleFailure(*args, "-Pkotlin.native.cacheKind=none").checks { + check.logContains("Error: 'kotlin.native.cacheKind' is explicitly set to 'none'") + check.logContains(commonPartOfWarning) } } - withNativeCacheKindWarningProject(kotlinVersion = kotlinVersion) { - gradle(*args, "-Pkotlin.native.cacheKind=static").checks { - check.logContainsOnce("Warning: 'kotlin.native.cacheKind' is explicitly set to 'static'") - check.logContainsOnce(commonPartOfWarning) + withNativeCacheKindErrorProject(kotlinVersion = kotlinVersion) { + gradleFailure(*args, "-Pkotlin.native.cacheKind=static").checks { + check.logContains("Error: 'kotlin.native.cacheKind' is explicitly set to 'static'") + check.logContains(commonPartOfWarning) } } - withNativeCacheKindWarningProject(kotlinVersion = kotlinVersion) { - gradle(*args, "-Pkotlin.native.cacheKind.iosX64=none").checks { - check.logContainsOnce("Warning: 'kotlin.native.cacheKind.iosX64' is explicitly set to 'none'") - check.logContainsOnce(commonPartOfWarning) + withNativeCacheKindErrorProject(kotlinVersion = kotlinVersion) { + gradleFailure(*args, "-Pkotlin.native.cacheKind.iosX64=none").checks { + check.logContains("Error: 'kotlin.native.cacheKind.iosX64' is explicitly set to 'none'") + check.logContains(commonPartOfWarning) } } - withNativeCacheKindWarningProject(kotlinVersion = kotlinVersion) { - gradle(*args, "-Pkotlin.native.cacheKind.iosX64=static").checks { - check.logContainsOnce("Warning: 'kotlin.native.cacheKind.iosX64' is explicitly set to 'static'") - check.logContainsOnce(commonPartOfWarning) + withNativeCacheKindErrorProject(kotlinVersion = kotlinVersion) { + gradleFailure(*args, "-Pkotlin.native.cacheKind.iosX64=static").checks { + check.logContains("Error: 'kotlin.native.cacheKind.iosX64' is explicitly set to 'static'") + check.logContains(commonPartOfWarning) } } } - - testKotlinVersion(TestKotlinVersions.v1_8_20) - testKotlinVersion(TestKotlinVersions.v1_9_0) + testKotlinVersion(TestKotlinVersions.v1_9_20_Beta) } @Test diff --git a/gradle-plugins/compose/src/test/kotlin/org/jetbrains/compose/test/utils/TestKotlinVersions.kt b/gradle-plugins/compose/src/test/kotlin/org/jetbrains/compose/test/utils/TestKotlinVersions.kt index 5dc8a2c555..d5803b60bf 100644 --- a/gradle-plugins/compose/src/test/kotlin/org/jetbrains/compose/test/utils/TestKotlinVersions.kt +++ b/gradle-plugins/compose/src/test/kotlin/org/jetbrains/compose/test/utils/TestKotlinVersions.kt @@ -9,4 +9,5 @@ object TestKotlinVersions { val Default = TestProperties.composeCompilerCompatibleKotlinVersion val v1_8_20 = "1.8.20" val v1_9_0 = "1.9.0" + val v1_9_20_Beta = "1.9.20-Beta" } \ No newline at end of file diff --git a/gradle-plugins/compose/src/test/kotlin/org/jetbrains/compose/test/utils/TestProjects.kt b/gradle-plugins/compose/src/test/kotlin/org/jetbrains/compose/test/utils/TestProjects.kt index f29517b111..24f59310ed 100644 --- a/gradle-plugins/compose/src/test/kotlin/org/jetbrains/compose/test/utils/TestProjects.kt +++ b/gradle-plugins/compose/src/test/kotlin/org/jetbrains/compose/test/utils/TestProjects.kt @@ -29,5 +29,5 @@ object TestProjects { const val iosResources = "misc/iosResources" const val iosMokoResources = "misc/iosMokoResources" const val nativeCacheKind = "misc/nativeCacheKind" - const val nativeCacheKindWarning = "misc/nativeCacheKindWarning" + const val nativeCacheKindError = "misc/nativeCacheKindError" } \ No newline at end of file diff --git a/gradle-plugins/compose/src/test/test-projects/misc/nativeCacheKindWarning/build.gradle b/gradle-plugins/compose/src/test/test-projects/misc/nativeCacheKindError/build.gradle similarity index 100% rename from gradle-plugins/compose/src/test/test-projects/misc/nativeCacheKindWarning/build.gradle rename to gradle-plugins/compose/src/test/test-projects/misc/nativeCacheKindError/build.gradle diff --git a/gradle-plugins/compose/src/test/test-projects/misc/nativeCacheKindWarning/gradle.properties b/gradle-plugins/compose/src/test/test-projects/misc/nativeCacheKindError/gradle.properties similarity index 100% rename from gradle-plugins/compose/src/test/test-projects/misc/nativeCacheKindWarning/gradle.properties rename to gradle-plugins/compose/src/test/test-projects/misc/nativeCacheKindError/gradle.properties diff --git a/gradle-plugins/compose/src/test/test-projects/misc/nativeCacheKindWarning/settings.gradle b/gradle-plugins/compose/src/test/test-projects/misc/nativeCacheKindError/settings.gradle similarity index 100% rename from gradle-plugins/compose/src/test/test-projects/misc/nativeCacheKindWarning/settings.gradle rename to gradle-plugins/compose/src/test/test-projects/misc/nativeCacheKindError/settings.gradle diff --git a/gradle-plugins/compose/src/test/test-projects/misc/nativeCacheKindWarning/src/commonMain/kotlin/App.kt b/gradle-plugins/compose/src/test/test-projects/misc/nativeCacheKindError/src/commonMain/kotlin/App.kt similarity index 100% rename from gradle-plugins/compose/src/test/test-projects/misc/nativeCacheKindWarning/src/commonMain/kotlin/App.kt rename to gradle-plugins/compose/src/test/test-projects/misc/nativeCacheKindError/src/commonMain/kotlin/App.kt diff --git a/gradle-plugins/compose/src/test/test-projects/misc/nativeCacheKindWarning/subproject/build.gradle b/gradle-plugins/compose/src/test/test-projects/misc/nativeCacheKindError/subproject/build.gradle similarity index 100% rename from gradle-plugins/compose/src/test/test-projects/misc/nativeCacheKindWarning/subproject/build.gradle rename to gradle-plugins/compose/src/test/test-projects/misc/nativeCacheKindError/subproject/build.gradle diff --git a/gradle-plugins/compose/src/test/test-projects/misc/nativeCacheKindWarning/subproject/src/commonMain/kotlin/App.kt b/gradle-plugins/compose/src/test/test-projects/misc/nativeCacheKindError/subproject/src/commonMain/kotlin/App.kt similarity index 100% rename from gradle-plugins/compose/src/test/test-projects/misc/nativeCacheKindWarning/subproject/src/commonMain/kotlin/App.kt rename to gradle-plugins/compose/src/test/test-projects/misc/nativeCacheKindError/subproject/src/commonMain/kotlin/App.kt