Repository: JetBrains/compose-multiplatform
File: gradle-plugins/compose/src/test/kotlin/org/jetbrains/compose/test/tests/integration/GradlePluginTest.kt (Kotlin)

Code before:
        with(nativeCacheKindProject(kotlinVersion = TestKotlinVersions.v1_9_0) ) {
            gradle(task, "--info").checks {
                check.taskSuccessful(task)
                check.logDoesntContain("-Xauto-cache-from=")
            }
        }
    }

    @Test
    fun nativeCacheKindWarning() {
        Assumptions.assumeTrue(currentOS == OS.MacOS)
        fun withNativeCacheKindWarningProject(kotlinVersion: String, fn: TestProject.() -> Unit) {
            with(testProject(
                TestProjects.nativeCacheKindWarning,
                defaultTestEnvironment.copy(kotlinVersion = kotlinVersion)
            )) {
                fn()
                testWorkDir.deleteRecursively()
                testWorkDir.mkdirs()
            }
        }

        fun testKotlinVersion(kotlinVersion: String) {
            val args = arrayOf("build", "--dry-run")
            val commonPartOfWarning = "Compose Multiplatform Gradle plugin manages this property automatically"
            withNativeCacheKindWarningProject(kotlinVersion = kotlinVersion) {
                gradle(*args, "-Pkotlin.native.cacheKind=none").checks {
                    check.logContainsOnce("'kotlin.native.cacheKind' is explicitly set to 'none'")
                    check.logContainsOnce(commonPartOfWarning)
                }
            }
            withNativeCacheKindWarningProject(kotlinVersion = kotlinVersion) {
                gradle(*args, "-Pkotlin.native.cacheKind=static").checks {
                    check.logContainsOnce("'kotlin.native.cacheKind' is explicitly set to 'static'")
                    check.logContainsOnce(commonPartOfWarning)
                }
            }
            withNativeCacheKindWarningProject(kotlinVersion = kotlinVersion) {
                gradle(*args, "-Pkotlin.native.cacheKind.iosX64=none").checks {
                    check.logContainsOnce("'kotlin.native.cacheKind.iosX64' is explicitly set to 'none'")
                    check.logContainsOnce(commonPartOfWarning)
                }
            }
            withNativeCacheKindWarningProject(kotlinVersion = kotlinVersion) {
                gradle(*args, "-Pkotlin.native.cacheKind.iosX64=static").checks {
                    check.logContainsOnce("'kotlin.native.cacheKind.iosX64' is explicitly set to 'static'")
                    check.logContainsOnce(commonPartOfWarning)
                }
            }
        }


Review comment (bug):
May we add a test for the case :"Warnings were also handled incorrectly in this case, because during the configuration of compose-subproject-1 we might set kotlin.native.cacheKind.ios*=none,
which would then cause a warning during the configuration of compose-subproject-2"

Code after:
        with(nativeCacheKindProject(kotlinVersion = TestKotlinVersions.v1_9_0) ) {
            gradle(task, "--info").checks {
                check.taskSuccessful(task)
                check.logDoesntContain("-Xauto-cache-from=")
            }
        }
    }

    @Test
    fun nativeCacheKindWarning() {
        Assumptions.assumeTrue(currentOS == OS.MacOS)
        fun withNativeCacheKindWarningProject(kotlinVersion: String, fn: TestProject.() -> Unit) {
            with(testProject(
                TestProjects.nativeCacheKindWarning,
                defaultTestEnvironment.copy(kotlinVersion = kotlinVersion)
            )) {
                fn()
                testWorkDir.deleteRecursively()
                testWorkDir.mkdirs()
            }
        }

        fun testKotlinVersion(kotlinVersion: String) {
            val args = arrayOf("build", "--dry-run")
            val commonPartOfWarning = "Compose Multiplatform Gradle plugin manages this property automatically"
            withNativeCacheKindWarningProject(kotlinVersion = kotlinVersion) {
                gradle(*args).checks {
                    check.logDoesntContain("Warning: '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)
                }
            }
            withNativeCacheKindWarningProject(kotlinVersion = kotlinVersion) {
                gradle(*args, "-Pkotlin.native.cacheKind=static").checks {
                    check.logContainsOnce("Warning: 'kotlin.native.cacheKind' is explicitly set to 'static'")
                    check.logContainsOnce(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)
                }
            }
            withNativeCacheKindWarningProject(kotlinVersion = kotlinVersion) {
                gradle(*args, "-Pkotlin.native.cacheKind.iosX64=static").checks {