Changes:
- update all examples to Kotlin 2.0
- migrate to using kotlin("plugin.compose") for Compose compiler
configuration
- remove deprecated Compose Web gradle API usages
- added a workaround for
https://github.com/JetBrains/compose-multiplatform/issues/4848 in
Jetsnack example
Testing:
- `./gradlew build` in every example
- run some examples in simulators (or desktop, browser)
The intermediate `iosMain` source was previously removed here:
https://github.com/JetBrains/compose-multiplatform/pull/3956 And it
worked fine.
According to the doc
https://kotlinlang.org/docs/whatsnew1920.html#set-up-the-target-hierarchy
:
> If you want to have additional source sets that the default hierarchy
template doesn't provide, for example, one that shares code between a
macOS and a JVM target, adjust the hierarchy by reapplying the template
explicitly with applyDefaultHierarchyTemplate() and configuring
additional source sets manually as usual with dependsOn()
Now we have an additional custom source set named 'jsWasmMain',
therefore we need to have `applyDefaultHierarchyTemplate()`.
- add imageviewer project to validateExamplesWithJs.sh
- update dmmy_map image and add a notice about using Open Data License
- update web app setup (index.html) and remove redundant files
- temporary disable configuration cache due to k/wasm issue
https://youtrack.jetbrains.com/issue/KT-64851 (fixed in 2.0)
- Apply window insets for UI containers
- Update the screenshot
- Align gradle.properties with other examples
- Add jetsnack to all example verification scripts
Fix regression after
https://github.com/JetBrains/compose-multiplatform/pull/4433
`./gradlew compileReleaseKotlinAndroid` in `imageviewer` fails with:
```
* What went wrong:
Execution failed for task ':shared:compileReleaseKotlinAndroid'.
> Inconsistent JVM-target compatibility detected for tasks 'compileReleaseJavaWithJavac' (1.8) and 'compileReleaseKotlinAndroid' (17).
```
(JAVA_HOME points to JDK 17)
Due to [known
problem](https://partnerissuetracker.corp.google.com/issues/199919707),
the application crashes when selecting lines with empty text.
The fix does 2 things:
- Prevents `SelectionContainer` from crashing
- Improves format of copied text by separating it into lines
COMPOSE-357
- Merged non UI examples visual-effects, falling-balls and minesweeper
into one graphics2d
- Removed deprecated function calls `kotlin.system.getTimeNanos()`
- Little bit simplifyed code
- Used Material3
Co-authored-by: Igor Demin <igordmn@users.noreply.github.com>
According to https://developer.android.com/build/jdks we should:
1. [use JDK 17 for API 34](https://developer.android.com/build/jdks#compileSdk)
2. [use toolchain](https://developer.android.com/build/jdks#toolchain):
```
We recommend that you always specify the Java toolchain, and either ensure that the specified JDK is installed, or add a toolchain resolver to your build.
```
As we don't want to force people to have JDK 17 on their machine, we apply toolchain resolver that is recommended by Gradle:
```
id("org.gradle.toolchains.foojay-resolver-convention") version("0.4.0")
```
## Test
1. Remove JDK 17 from the computer, remove `jvmToolchain(17)`
2. Run `./gradlew assembleDebug`
3. It should fail with:
```
> Could not create task ':androidApp:compileDebugJavaWithJavac'.
> Failed to calculate the value of task ':androidApp:compileDebugJavaWithJavac' property 'javaCompiler'.
> No matching toolchains found for requested specification: {languageVersion=17, vendor=any, implementation=vendor-specific} for WINDOWS on x86_64.
> No locally installed toolchains match and toolchain download repositories have not been configured.
```
4. restore `jvmToolchain(17)`
5. Run `./gradlew assembleDebug` again
6. It should succeed
## Issues
Fixes https://github.com/JetBrains/compose-multiplatform/issues/3615
* 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
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