The recent compose core libs are built using 1.9.21, and apparently, older k/native versions don't support them.
e: kotlin.NotImplementedError: Generation of stubs for class org.jetbrains.kotlin.ir.symbols.impl.IrTypeParameterPublicSymbolImpl is not supported yet
Reason:
Since Xcode 15, there is a new default setting:
`ENABLE_USER_SCRIPT_SANDBOXING = YES`
SyncComposeResourcesForIosTask fails to work with it right now.
Currently when `org.gradle.configuration-cache=true` we have an error:
> Configuration cache state could not be cached: field `resourceFiles`
of task `:shared:syncComposeResourcesForIos` of type
`org.jetbrains.compose.experimental.uikit.tasks.SyncComposeResourcesForIosTask`:
error writing value of type
'org.gradle.api.internal.provider.TransformBackedProvider'
Old description (can be ignored):
_This PR attempts to fix it in SyncComposeResourcesForIosTask by
wrapping inputs into providers. It seems that gradle configuration cache
doesn't like some provider types produced by `.map`, `.zip`, `.orElse`,
etc._
**Latest description:**
With configuration cache enabled, gradle runs all `orElse` providers
during configuration (I don't know why yet).
We used to throw an exception in `orElse` which led to the crash. This
PR refactors SyncComposeResourcesForIosTask so it doesn't throw an
exception immediately in orElse, but postpones it to later step.
* Add API to not apply the Compose Compiler plugin
* avoid eager initialization
* Update gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/ComposeExtension.kt
Co-authored-by: Igor Demin <igordmn@users.noreply.github.com>
* Update gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/ComposeExtension.kt
Co-authored-by: Igor Demin <igordmn@users.noreply.github.com>
* Apply PR review suggestions:
- Deprecate `compose.web.targets` in favor of `compose.platformTypes`
- refactor `configureExperimentalWebApplication` to support multiple k/js targets
---------
Co-authored-by: Igor Demin <igordmn@users.noreply.github.com>
* Update versions to CM 1.5.1 and kotlin 1.9.10
* Add explicit dependencies on compose.ui and compose.foundation in examples/chat/jsApp
* Update CHANGELOG.md
* fix typo
* Add Dependencies for 1.5.1 Changelog
Sometimes we need to report warnings during the configuration phase.
For example, when Androidx Compose Compiler is used with
non-JVM targets (e.g. iOS/js), we want to warn users
that using non-JB compiler with non-JVM targets is not supported.
The default way of reporting warnings in Gradle is using a logger.
For example we could write something like:
```
abstract class ComposePlugin : Plugin<Project> {
override fun apply(project: Project) {
if (project.hasNonJvmTargets() && project.usesNonJBComposeCompiler()) {
project.logger.warn("...")
}
}
}
```
This approach has a few issues:
1. When the Configuration Cache is enabled, project's configuration might
get skipped altogether, and the warning won't be printed.
2. If a project contains multiple Gradle modules (subprojects),
the warning might be printed multiple times. That might be OK
for some warnings. But repeating exactly the same warning
10s or 100s is unnecessary.
The only way to share the state between Gradle modules,
while preserving compatibility with the Configuration Cache,
is to define Gradle Build Service.
In 1.5.0 we used Gradle Build Service mechanism for both warnings.
However, I did not know that:
* only the service's parameters are persisted in the Configuration Cache.
The service itself is not persisted.
* if a service instance is materialized during the configuration
phase, then all changes made to its parameters will not be
visible to that particular instance (but they will be visible to the
next instance).
So the only way to report diagnostics with configuration cache without
repetition is to define a service that is not materialized
during the configuration phase (i.e. serviceProvider.get() is not called),
add to add warnings to a set property of the service.
This change implements that.
Resolves#3595
The new android multiplatform plugin will have type `jvm` but doesn't
inherit from the KotlinJvmTarget type, which makes the compose
multiplatform gradle plugin not useable with the new android gradle
plugin for multiplatforms builds.