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.
It crashes on Android, because it doesn't have slice method yet (only starting from API 34):
```
java.lang.NoSuchMethodError: No virtual method slice(II)Ljava/nio/MappedByteBuffer; in class Ljava/nio/MappedByteBuffer; or its super classes (declaration of 'java.nio.MappedByteBuffer' appears in /apex/com.android.art/javalib/core-oj.jar)
at org.jetbrains.codeviewer.platform.JvmFileKt$toProjectFile$1$readLines$2.get(JvmFile.kt:68)
at org.jetbrains.codeviewer.ui.editor.EditorKt$Editor$1.invoke$content(Editor.kt:47)
at org.jetbrains.codeviewer.ui.editor.EditorKt$Editor$1.access$invoke$content(Editor.kt:37)
at org.jetbrains.codeviewer.ui.editor.EditorKt$Editor$1$1.get(Editor.kt:57)
at org.jetbrains.codeviewer.ui.editor.EditorViewKt$Lines$1$1$1$1.invoke(EditorView.kt:84)
at org.jetbrains.codeviewer.ui.editor.EditorViewKt$Lines$1$1$1$1.invoke(EditorView.kt:82)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:138)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:35)
at androidx.compose.foundation.lazy.LazyListItemProviderImpl$Item$1.invoke(LazyListItemProvider.kt:79)
at androidx.compose.foundation.lazy.LazyListItemProviderImpl$Item$1.invoke(LazyListItemProvider.kt:77)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:108)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:35)
at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:228)
at androidx.compose.foundation.lazy.layout.LazyLayoutPinnableItemKt.LazyLayoutPinnableItem(LazyLayoutPinnableItem.kt:54)
at androidx.compose.foundation.lazy.LazyListItemProviderImpl.Item(LazyListItemProvider.kt:77)
at androidx.compose.foundation.lazy.layout.LazyLayoutItemContentFactoryKt$SkippableItem$1.invoke(LazyLayoutItemContentFactory.kt:135)
at androidx.compose.foundation.lazy.layout.LazyLayoutItemContentFactoryKt$SkippableItem$1.invoke(LazyLayoutItemContentFactory.kt:134)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:108)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:35)
```
The regression was introduced in Update experimental Codeviewer with changes from non-experimental one (#2975).
Replacing with code that is available for Android
* The camera should stop working after leaving CameraView on Android.
* Update examples/imageviewer/shared/src/androidMain/kotlin/example/imageviewer/view/CameraView.android.kt
* Fix cache kind management with nested subprojects
Previously, cache kind property management
worked incorrectly when Compose Gradle plugin
was applied to both parent and child subprojects,
e.g. :compose-subproject-1:compose-subproject-2.
With this example the plugin would successfully
set the property for compose-subproject-1,
but then for compose-subproject-2 the following snippet
would fail:
```
if (project.hasProperty(targetCacheKindPropertyName)) {
project.setProperty(targetCacheKindPropertyName, NONE_VALUE)
}
```
because project.hasProperty would have return true
(because it checks parent subproject properties too),
but project.setProperty would fail, because
parent project's properties are read only.
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.
To avoid incorrect warnings, we now
record the snapshot of relevant properties
during Compose Multiplatform build service initialization
Resolves#3515
* Fix issues from code review
For iOS/Web it will be stabilized with stabilizing these targets themselves. Also, we should expose uiTest for them, not uiTestJUnit4
JUnit5 support will be provided in the future in [this issue](https://github.com/JetBrains/compose-multiplatform/issues/2371)
## API Changes
- Testing framework is stabilized for Desktop
- `compose.uiTestJUnit4` is renamed to `compose.desktop.uiTestJUnit4`
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 https://github.com/JetBrains/compose-multiplatform/pull/3477 and https://github.com/JetBrains/compose-multiplatform/pull/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.
It updates the default version of compose compiler plugin for kotlin 1.9.0
For now it's 1.5.1-rc01 version. For a stable release, we'll build a stable 1.5.1 compose compiler plugin.
* Handle ClassCastException for ComposeMultiplatformBuildService in Compose Gradle plugin
ClassCastException might occur when our gradle plugin was loaded more than once. See https://github.com/JetBrains/compose-multiplatform/issues/3459
We throw another exception with a bit more clear message.
* Update gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/ComposeCompilerKotlinSupportPlugin.kt
Compose compiler plugin produces symbols with identical signatures. k/jvm and k/native do not check for clashes, while k/js does. We disable the checker in our gradle plugin, so our users do not need to add extra workaround on their side.