Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace warnings with errors #3496

Merged

Conversation

AlexeyTsvetkov
Copy link
Collaborator

@AlexeyTsvetkov AlexeyTsvetkov commented Aug 15, 2023

Some Gradle configuration flags and Gradle DSL options become incompatible with Compose Multiplatform 1.5.0.

1. Kotlin/Native cache kind explicitly set to "none"

By default, enabling/disabling the compiler caches for Kotlin/Native is now handled by Compose Multiplatform Gradle plugin. Manually disabling the cache raises a warning. The caches are disabled by the following flags in gradle.properties or local.properties:

  • kotlin.native.cacheKind=none;
  • kotlin.native.cacheKind.<IOS_TARGET_PRESET>=none;

What can you do?

  • 🟢 We recommend to remove kotlin.native.cacheKind=none from gradle.properties or local.properties.
  • ⚠️ If you are sure the flags are necessary, the automatic flag management and the error can be turned off by adding compose.kotlin.native.manageCacheKind=false to gradle.properties.

Detailed description

Disabling the compiler caches is usually not necessary because it significantly slows down incremental builds.
However, prior to Kotlin/Native 1.9.0, the compiler often could not compile Compose code with the cache.
This has led to widespread use of cacheKind=none throughout many Compose Multiplatform projects.

The root issue is partially fixed in Kotlin 1.9.0, and will be fixed completely in a future release.
Compose Multiplatform Gradle plugin can now manage the necessary caching flags by itself based on a Kotlin/Native version being used. So once the underlying issue in Kotlin/Native compiler is fixed, the plugin will enable caching automatically.

2. CocoaPods resource configuration

⚠️ This section is only relevant for users of the Compose Multiplatform experimental resources library.
Users of third party libraries (such as Moko Resources or libres) should not be affected by this.

Now, explicitly setting the extra spec resources attribute is prohibited:

kotlin {
    cocoapods {
        // ...
        extraSpecAttributes["resources"] = "['src/commonMain/resources/**', 'src/iosMain/resources/**']"
    }
}

What can you do?

  • 🟢 We recommend to remove extraSpecAttributes["resources"] from build scripts:
kotlin {
    cocoapods {
        // The following line should be removed!
        extraSpecAttributes["resources"] = "['src/commonMain/resources/**', 'src/iosMain/resources/**']"
    }
}
  • ⚠️ Alternatively, the automatic resource management can be disabled by adding the following line to gradle.properties:
compose.ios.resources.sync=false

Detailed description

For more information about resource management improvements, see the description of the corresponding PR.

@AlexeyTsvetkov AlexeyTsvetkov force-pushed the support/1.5.0-replace-warnings-with-errors branch from 2867761 to e394974 Compare August 15, 2023 16:27
@igordmn
Copy link
Collaborator

igordmn commented Aug 15, 2023

compose.kotlin.native.manageCacheKind

Should we rename it to "org.jetbrains.compose.kotlin.native.manageCacheKind"? To be consistent with the other property

@AlexeyTsvetkov AlexeyTsvetkov merged commit fa2df40 into support/1.5.0 Aug 15, 2023
3 checks passed
@AlexeyTsvetkov AlexeyTsvetkov deleted the support/1.5.0-replace-warnings-with-errors branch August 15, 2023 17:49
Copy link
Collaborator

@igordmn igordmn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's wait Dima for the second approval.

I will cherry-pick it to release/1.5.0 after merging.

Copy link
Contributor

@dima-avdeev-jb dima-avdeev-jb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All fine, Approve!

AlexeyTsvetkov added a commit to AlexeyTsvetkov/compose-jb that referenced this pull request Aug 16, 2023
We tried to enable the compiler cache, when
Kotlin/Native 1.9.0 is used.
Prior to Kotlin 1.9.0, the caching could not
be used with Compose, because code generation would fail.
With Kotlin 1.9.0, code generation succeeds, but  generated debug symbols cause issues with dsymutil during xcode build.
For more details, see https://youtrack.jetbrains.com/issue/KT-61270

This change partially reverts JetBrains#3477 and JetBrains#3496

Now, we always set `kotlin.native.cacheKind=none` in
Compose Multiplatform Gradle plugin for all
versions of Kotlin until KT-61270 is fixed.
Also, explicit cache kind error becomes a warning again.
AlexeyTsvetkov added a commit that referenced this pull request Aug 16, 2023
We tried to enable the compiler cache, when
Kotlin/Native 1.9.0 is used.
Prior to Kotlin 1.9.0, the caching could not
be used with Compose, because code generation would fail.
With Kotlin 1.9.0, code generation succeeds, but  generated debug symbols cause issues with dsymutil during xcode build.
For more details, see https://youtrack.jetbrains.com/issue/KT-61270

This change partially reverts #3477 and #3496

Now, we always set `kotlin.native.cacheKind=none` in
Compose Multiplatform Gradle plugin for all
versions of Kotlin until KT-61270 is fixed.
Also, explicit cache kind error becomes a warning again.
igordmn pushed a commit that referenced this pull request Aug 16, 2023
We tried to enable the compiler cache, when
Kotlin/Native 1.9.0 is used.
Prior to Kotlin 1.9.0, the caching could not
be used with Compose, because code generation would fail.
With Kotlin 1.9.0, code generation succeeds, but  generated debug symbols cause issues with dsymutil during xcode build.
For more details, see https://youtrack.jetbrains.com/issue/KT-61270

This change partially reverts #3477 and #3496

Now, we always set `kotlin.native.cacheKind=none` in
Compose Multiplatform Gradle plugin for all
versions of Kotlin until KT-61270 is fixed.
Also, explicit cache kind error becomes a warning again.
@dima-avdeev-jb dima-avdeev-jb restored the support/1.5.0-replace-warnings-with-errors branch September 13, 2023 10:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants