Browse Source

Replace warnings with errors (#3496)

pull/3498/head
Alexey Tsvetkov 1 year ago committed by GitHub
parent
commit
fa2df40e11
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      examples/chat/gradle.properties
  2. 1
      examples/chat/shared/build.gradle.kts
  3. 3
      examples/codeviewer/gradle.properties
  4. 1
      examples/codeviewer/shared/build.gradle.kts
  5. 3
      examples/falling-balls/gradle.properties
  6. 1
      examples/falling-balls/shared/build.gradle.kts
  7. 3
      examples/imageviewer/gradle.properties
  8. 2
      examples/imageviewer/shared/build.gradle.kts
  9. 3
      examples/minesweeper/gradle.properties
  10. 12
      examples/minesweeper/shared/build.gradle.kts
  11. 3
      examples/todoapp-lite/gradle.properties
  12. 1
      examples/todoapp-lite/shared/build.gradle.kts
  13. 3
      examples/visual-effects/gradle.properties
  14. 1
      examples/visual-effects/shared/build.gradle.kts
  15. 3
      examples/widgets-gallery/gradle.properties
  16. 1
      examples/widgets-gallery/shared/build.gradle.kts
  17. 8
      gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/experimental/internal/configureNativeCompilerCaching.kt
  18. 6
      gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/experimental/uikit/internal/resources/configureSyncIosResources.kt
  19. 14
      gradle-plugins/compose/src/test/kotlin/org/jetbrains/compose/test/tests/integration/GradlePluginTest.kt

3
examples/chat/gradle.properties

@ -6,11 +6,10 @@ org.gradle.jvmargs=-Xmx3g
org.jetbrains.compose.experimental.jscanvas.enabled=true org.jetbrains.compose.experimental.jscanvas.enabled=true
org.jetbrains.compose.experimental.macos.enabled=true org.jetbrains.compose.experimental.macos.enabled=true
org.jetbrains.compose.experimental.uikit.enabled=true org.jetbrains.compose.experimental.uikit.enabled=true
kotlin.native.cacheKind=none
kotlin.native.useEmbeddableCompilerJar=true kotlin.native.useEmbeddableCompilerJar=true
kotlin.mpp.androidSourceSetLayoutVersion=2 kotlin.mpp.androidSourceSetLayoutVersion=2
# Enable kotlin/native experimental memory model # Enable kotlin/native experimental memory model
kotlin.native.binary.memoryModel=experimental kotlin.native.binary.memoryModel=experimental
kotlin.version=1.9.0 kotlin.version=1.9.0
agp.version=7.1.3 agp.version=7.1.3
compose.version=1.4.3 compose.version=1.5.0-beta02

1
examples/chat/shared/build.gradle.kts

@ -45,7 +45,6 @@ kotlin {
baseName = "shared" baseName = "shared"
isStatic = true isStatic = true
} }
extraSpecAttributes["resources"] = "['src/commonMain/resources/**', 'src/iosMain/resources/**']"
} }
sourceSets { sourceSets {

3
examples/codeviewer/gradle.properties

@ -6,11 +6,10 @@ org.gradle.jvmargs=-Xmx3g
org.jetbrains.compose.experimental.jscanvas.enabled=true org.jetbrains.compose.experimental.jscanvas.enabled=true
org.jetbrains.compose.experimental.macos.enabled=true org.jetbrains.compose.experimental.macos.enabled=true
org.jetbrains.compose.experimental.uikit.enabled=true org.jetbrains.compose.experimental.uikit.enabled=true
kotlin.native.cacheKind=none
kotlin.native.useEmbeddableCompilerJar=true kotlin.native.useEmbeddableCompilerJar=true
kotlin.mpp.androidSourceSetLayoutVersion=2 kotlin.mpp.androidSourceSetLayoutVersion=2
# Enable kotlin/native experimental memory model # Enable kotlin/native experimental memory model
kotlin.native.binary.memoryModel=experimental kotlin.native.binary.memoryModel=experimental
kotlin.version=1.9.0 kotlin.version=1.9.0
agp.version=7.1.3 agp.version=7.1.3
compose.version=1.4.3 compose.version=1.5.0-beta02

1
examples/codeviewer/shared/build.gradle.kts

@ -26,7 +26,6 @@ kotlin {
baseName = "shared" baseName = "shared"
isStatic = true isStatic = true
} }
extraSpecAttributes["resources"] = "['src/commonMain/resources/**', 'src/iosMain/resources/**']"
} }
sourceSets { sourceSets {

3
examples/falling-balls/gradle.properties

@ -6,11 +6,10 @@ org.gradle.jvmargs=-Xmx3g
org.jetbrains.compose.experimental.jscanvas.enabled=true org.jetbrains.compose.experimental.jscanvas.enabled=true
org.jetbrains.compose.experimental.macos.enabled=true org.jetbrains.compose.experimental.macos.enabled=true
org.jetbrains.compose.experimental.uikit.enabled=true org.jetbrains.compose.experimental.uikit.enabled=true
kotlin.native.cacheKind=none
kotlin.native.useEmbeddableCompilerJar=true kotlin.native.useEmbeddableCompilerJar=true
kotlin.mpp.androidSourceSetLayoutVersion=2 kotlin.mpp.androidSourceSetLayoutVersion=2
# Enable kotlin/native experimental memory model # Enable kotlin/native experimental memory model
kotlin.native.binary.memoryModel=experimental kotlin.native.binary.memoryModel=experimental
kotlin.version=1.9.0 kotlin.version=1.9.0
agp.version=7.1.3 agp.version=7.1.3
compose.version=1.4.3 compose.version=1.5.0-beta02

1
examples/falling-balls/shared/build.gradle.kts

@ -45,7 +45,6 @@ kotlin {
baseName = "shared" baseName = "shared"
isStatic = true isStatic = true
} }
extraSpecAttributes["resources"] = "['src/commonMain/resources/**', 'src/iosMain/resources/**']"
} }
sourceSets { sourceSets {

3
examples/imageviewer/gradle.properties

@ -6,11 +6,10 @@ org.gradle.jvmargs=-Xmx3g
org.jetbrains.compose.experimental.jscanvas.enabled=true org.jetbrains.compose.experimental.jscanvas.enabled=true
org.jetbrains.compose.experimental.macos.enabled=true org.jetbrains.compose.experimental.macos.enabled=true
org.jetbrains.compose.experimental.uikit.enabled=true org.jetbrains.compose.experimental.uikit.enabled=true
kotlin.native.cacheKind=none
kotlin.mpp.androidSourceSetLayoutVersion=2 kotlin.mpp.androidSourceSetLayoutVersion=2
kotlin.native.useEmbeddableCompilerJar=true kotlin.native.useEmbeddableCompilerJar=true
# Enable kotlin/native experimental memory model # Enable kotlin/native experimental memory model
kotlin.native.binary.memoryModel=experimental kotlin.native.binary.memoryModel=experimental
kotlin.version=1.9.0 kotlin.version=1.9.0
agp.version=7.1.3 agp.version=7.1.3
compose.version=1.5.0-dev1114 compose.version=1.5.0-beta02

2
examples/imageviewer/shared/build.gradle.kts

@ -26,8 +26,6 @@ kotlin {
baseName = "shared" baseName = "shared"
isStatic = true isStatic = true
} }
extraSpecAttributes["resources"] = "['src/commonMain/resources/**', 'src/iosMain/resources/**']"
} }
sourceSets { sourceSets {

3
examples/minesweeper/gradle.properties

@ -6,11 +6,10 @@ org.gradle.jvmargs=-Xmx3g
org.jetbrains.compose.experimental.jscanvas.enabled=true org.jetbrains.compose.experimental.jscanvas.enabled=true
org.jetbrains.compose.experimental.macos.enabled=true org.jetbrains.compose.experimental.macos.enabled=true
org.jetbrains.compose.experimental.uikit.enabled=true org.jetbrains.compose.experimental.uikit.enabled=true
kotlin.native.cacheKind=none
kotlin.native.useEmbeddableCompilerJar=true kotlin.native.useEmbeddableCompilerJar=true
kotlin.mpp.androidSourceSetLayoutVersion=2 kotlin.mpp.androidSourceSetLayoutVersion=2
# Enable kotlin/native experimental memory model # Enable kotlin/native experimental memory model
kotlin.native.binary.memoryModel=experimental kotlin.native.binary.memoryModel=experimental
kotlin.version=1.9.0 kotlin.version=1.9.0
agp.version=7.1.3 agp.version=7.1.3
compose.version=1.4.3 compose.version=1.5.0-beta02

12
examples/minesweeper/shared/build.gradle.kts

@ -15,16 +15,7 @@ kotlin {
jvm("desktop") jvm("desktop")
ios() ios()
iosSimulatorArm64() { iosSimulatorArm64()
// TODO: remove after 1.5 release
binaries.forEach {
it.freeCompilerArgs += listOf(
"-linker-option", "-framework", "-linker-option", "Metal",
"-linker-option", "-framework", "-linker-option", "CoreText",
"-linker-option", "-framework", "-linker-option", "CoreGraphics",
)
}
}
js(IR) { js(IR) {
browser() browser()
@ -54,7 +45,6 @@ kotlin {
baseName = "shared" baseName = "shared"
isStatic = true isStatic = true
} }
extraSpecAttributes["resources"] = "['src/commonMain/resources/**', 'src/iosMain/resources/**']"
} }
sourceSets { sourceSets {

3
examples/todoapp-lite/gradle.properties

@ -6,11 +6,10 @@ org.gradle.jvmargs=-Xmx3g
org.jetbrains.compose.experimental.jscanvas.enabled=true org.jetbrains.compose.experimental.jscanvas.enabled=true
org.jetbrains.compose.experimental.macos.enabled=true org.jetbrains.compose.experimental.macos.enabled=true
org.jetbrains.compose.experimental.uikit.enabled=true org.jetbrains.compose.experimental.uikit.enabled=true
kotlin.native.cacheKind=none
kotlin.native.useEmbeddableCompilerJar=true kotlin.native.useEmbeddableCompilerJar=true
kotlin.mpp.androidSourceSetLayoutVersion=2 kotlin.mpp.androidSourceSetLayoutVersion=2
# Enable kotlin/native experimental memory model # Enable kotlin/native experimental memory model
kotlin.native.binary.memoryModel=experimental kotlin.native.binary.memoryModel=experimental
kotlin.version=1.9.0 kotlin.version=1.9.0
agp.version=7.1.3 agp.version=7.1.3
compose.version=1.4.3 compose.version=1.5.0-beta02

1
examples/todoapp-lite/shared/build.gradle.kts

@ -26,7 +26,6 @@ kotlin {
baseName = "shared" baseName = "shared"
isStatic = true isStatic = true
} }
extraSpecAttributes["resources"] = "['src/commonMain/resources/**', 'src/iosMain/resources/**']"
} }
sourceSets { sourceSets {

3
examples/visual-effects/gradle.properties

@ -7,10 +7,9 @@ org.jetbrains.compose.experimental.jscanvas.enabled=true
org.jetbrains.compose.experimental.macos.enabled=true org.jetbrains.compose.experimental.macos.enabled=true
org.jetbrains.compose.experimental.uikit.enabled=true org.jetbrains.compose.experimental.uikit.enabled=true
kotlin.mpp.androidSourceSetLayoutVersion=2 kotlin.mpp.androidSourceSetLayoutVersion=2
kotlin.native.cacheKind=none
kotlin.native.useEmbeddableCompilerJar=true kotlin.native.useEmbeddableCompilerJar=true
# Enable kotlin/native experimental memory model # Enable kotlin/native experimental memory model
kotlin.native.binary.memoryModel=experimental kotlin.native.binary.memoryModel=experimental
kotlin.version=1.9.0 kotlin.version=1.9.0
agp.version=7.1.3 agp.version=7.1.3
compose.version=1.4.3 compose.version=1.5.0-beta02

1
examples/visual-effects/shared/build.gradle.kts

@ -24,7 +24,6 @@ kotlin {
baseName = "shared" baseName = "shared"
isStatic = true isStatic = true
} }
extraSpecAttributes["resources"] = "['src/commonMain/resources/**', 'src/iosMain/resources/**']"
} }
sourceSets { sourceSets {

3
examples/widgets-gallery/gradle.properties

@ -6,11 +6,10 @@ org.gradle.jvmargs=-Xmx3g
org.jetbrains.compose.experimental.jscanvas.enabled=true org.jetbrains.compose.experimental.jscanvas.enabled=true
org.jetbrains.compose.experimental.macos.enabled=true org.jetbrains.compose.experimental.macos.enabled=true
org.jetbrains.compose.experimental.uikit.enabled=true org.jetbrains.compose.experimental.uikit.enabled=true
kotlin.native.cacheKind=none
kotlin.native.useEmbeddableCompilerJar=true kotlin.native.useEmbeddableCompilerJar=true
kotlin.mpp.androidSourceSetLayoutVersion=2 kotlin.mpp.androidSourceSetLayoutVersion=2
# Enable kotlin/native experimental memory model # Enable kotlin/native experimental memory model
kotlin.native.binary.memoryModel=experimental kotlin.native.binary.memoryModel=experimental
kotlin.version=1.9.0 kotlin.version=1.9.0
agp.version=7.1.3 agp.version=7.1.3
compose.version=1.4.3 compose.version=1.5.0-beta02

1
examples/widgets-gallery/shared/build.gradle.kts

@ -26,7 +26,6 @@ kotlin {
baseName = "shared" baseName = "shared"
isStatic = true isStatic = true
} }
extraSpecAttributes["resources"] = "['src/commonMain/resources/**', 'src/iosMain/resources/**']"
} }
sourceSets { sourceSets {

8
gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/experimental/internal/configureNativeCompilerCaching.kt

@ -46,9 +46,7 @@ private fun KotlinNativeTarget.checkCacheKindUserValueIsNotNone() {
val value = provider.valueOrNull(cacheKindProperty) val value = provider.valueOrNull(cacheKindProperty)
if (value != null) { if (value != null) {
if (value.equals(NONE_VALUE, ignoreCase = true)) { if (value.equals(NONE_VALUE, ignoreCase = true)) {
ComposeMultiplatformBuildService error(cacheKindPropertyWarningMessage(cacheKindProperty, provider))
.getInstance(project)
.warnOnceAfterBuild(cacheKindPropertyWarningMessage(cacheKindProperty, provider))
} }
return return
} }
@ -60,13 +58,13 @@ private fun cacheKindPropertyWarningMessage(
cacheKindProperty: String, cacheKindProperty: String,
provider: KGPPropertyProvider provider: KGPPropertyProvider
) = """ ) = """
|Warning: '$cacheKindProperty' is explicitly set to `none`. |'$cacheKindProperty' is explicitly set to `none`.
|This option significantly slows the Kotlin/Native compiler. |This option significantly slows the Kotlin/Native compiler.
|Compose Multiplatform Gradle plugin can set this property automatically, |Compose Multiplatform Gradle plugin can set this property automatically,
|when it is necessary. |when it is necessary.
| * Recommended action: remove explicit '$cacheKindProperty=$NONE_VALUE' from ${provider.location}. | * Recommended action: remove explicit '$cacheKindProperty=$NONE_VALUE' from ${provider.location}.
| * Alternative action: if you are sure you need '$cacheKindProperty=$NONE_VALUE', disable | * Alternative action: if you are sure you need '$cacheKindProperty=$NONE_VALUE', disable
|this warning by adding '$COMPOSE_NATIVE_MANAGE_CACHE_KIND=false' to your 'gradle.properties'. |this error by adding '$COMPOSE_NATIVE_MANAGE_CACHE_KIND=false' to your 'gradle.properties'.
""".trimMargin() """.trimMargin()
private fun KotlinNativeTarget.configureTargetCompilerCache(kotlinVersion: KotlinVersion) { private fun KotlinNativeTarget.configureTargetCompilerCache(kotlinVersion: KotlinVersion) {

6
gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/experimental/uikit/internal/resources/configureSyncIosResources.kt

@ -92,7 +92,11 @@ private fun SyncIosResourcesContext.configureCocoapodsResourcesAttribute() {
val specAttributes = cocoapodsExt.extraSpecAttributes val specAttributes = cocoapodsExt.extraSpecAttributes
val resourcesSpec = specAttributes[RESOURCES_SPEC_ATTR] val resourcesSpec = specAttributes[RESOURCES_SPEC_ATTR]
if (!resourcesSpec.isNullOrBlank()) { if (!resourcesSpec.isNullOrBlank()) {
project.logger.warn("Warning: kotlin.cocoapods.extraSpecAttributes[\"resources\"] is ignored by Compose Multiplatform's resource synchronization for iOS") error("""
|Kotlin.cocoapods.extraSpecAttributes["resources"] is not compatible with Compose Multiplatform's resources management for iOS.
| * Recommended action: remove extraSpecAttributes["resources"] from '${project.buildFile}' and run '${project.path}:podInstall' once;
| * Alternative action: turn off Compose Multiplatform's resources management for iOS by adding '${IosGradleProperties.SYNC_RESOURCES_PROPERTY}=false' to your gradle.properties;
""".trimMargin())
} }
cocoapodsExt.framework { cocoapodsExt.framework {
val syncDir = syncDirFor(this).get().asFile val syncDir = syncDirFor(this).get().asFile

14
gradle-plugins/compose/src/test/kotlin/org/jetbrains/compose/test/tests/integration/GradlePluginTest.kt

@ -142,23 +142,19 @@ class GradlePluginTest : GradlePluginTestBase() {
defaultTestEnvironment.copy(kotlinVersion = kotlinVersion) defaultTestEnvironment.copy(kotlinVersion = kotlinVersion)
) )
val cacheKindWarning = "Warning: 'kotlin.native.cacheKind' is explicitly set to `none`" val cacheKindError = "'kotlin.native.cacheKind' is explicitly set to `none`"
val args = arrayOf("build", "--dry-run", "-Pkotlin.native.cacheKind=none") val args = arrayOf("build", "--dry-run", "-Pkotlin.native.cacheKind=none")
with(nativeCacheKindWarningProject(kotlinVersion = TestKotlinVersions.v1_8_20)) { with(nativeCacheKindWarningProject(kotlinVersion = TestKotlinVersions.v1_8_20)) {
gradle(*args).checks { gradleFailure(*args).checks {
check.logContainsOnce(cacheKindWarning) check.logContains(cacheKindError)
}
// check that the warning is shown even when the configuration is loaded from cache
gradle(*args).checks {
check.logContainsOnce(cacheKindWarning)
} }
} }
testWorkDir.deleteRecursively() testWorkDir.deleteRecursively()
testWorkDir.mkdirs() testWorkDir.mkdirs()
with(nativeCacheKindWarningProject(kotlinVersion = TestKotlinVersions.v1_9_0) ) { with(nativeCacheKindWarningProject(kotlinVersion = TestKotlinVersions.v1_9_0) ) {
gradle(*args).checks { gradleFailure(*args).checks {
check.logContainsOnce(cacheKindWarning) check.logContains(cacheKindError)
} }
} }
} }

Loading…
Cancel
Save