From 43a4086ba493bcaf70663508d5450e7536bee6f6 Mon Sep 17 00:00:00 2001 From: Igor Demin Date: Wed, 26 Jul 2023 17:23:38 +0200 Subject: [PATCH] Migrate examples to 1.4.3 (#3410) [Changelog](https://github.com/JetBrains/compose-multiplatform/releases/tag/v1.4.3) Changed templates: https://github.com/JetBrains/compose-multiplatform-template/commit/bbf71f754c6fd7564ebb8db8aa1e990e1160a748 https://github.com/JetBrains/compose-multiplatform-ios-android-template/commit/ba91acf5d6db3b23bdfca1b59398fcef00e1abca https://github.com/JetBrains/compose-multiplatform-desktop-template/commit/5204842894b2f175fe4f8e4d8e0be79eeec9c749 https://github.com/JetBrains/compose-multiplatform-html-library-template/commit/36d1554dee86922d90012363c862a5e88fe35a53 --- VERSIONING.md | 4 +++- ci/compose-uber-jar/gradle.properties | 2 +- ci/templates/desktop-template/gradle.properties | 4 ++-- ci/templates/html-library-template/gradle.properties | 4 ++-- ci/templates/multiplatform-template/gradle.properties | 4 ++-- examples/chat/gradle.properties | 4 ++-- examples/codeviewer/gradle.properties | 4 ++-- examples/falling-balls/gradle.properties | 4 ++-- examples/html/compose-bird/gradle.properties | 4 ++-- examples/html/compose-in-js/gradle.properties | 4 ++-- examples/html/landing/gradle.properties | 4 ++-- examples/html/with-react/gradle.properties | 4 ++-- examples/imageviewer/gradle.properties | 4 ++-- .../src/iosMain/kotlin/example/imageviewer/platform.ios.kt | 2 ++ .../kotlin/example/imageviewer/storage/FileExtensions.kt | 2 ++ .../kotlin/example/imageviewer/storage/IosImageStorage.ios.kt | 3 +++ .../iosMain/kotlin/example/imageviewer/view/CameraView.ios.kt | 3 +++ .../kotlin/example/imageviewer/view/LocationVisualizer.ios.kt | 2 ++ examples/intellij-plugin/gradle.properties | 4 ++-- examples/issues/gradle.properties | 4 ++-- examples/minesweeper/gradle.properties | 4 ++-- examples/notepad/gradle.properties | 4 ++-- examples/todoapp-lite/gradle.properties | 4 ++-- examples/todoapp/gradle.properties | 4 ++-- examples/visual-effects/gradle.properties | 4 ++-- examples/widgets-gallery/gradle.properties | 4 ++-- tools/replaceVersion.sh | 2 -- tutorials/HTML/Getting_Started/README.md | 4 ++-- 28 files changed, 56 insertions(+), 44 deletions(-) diff --git a/VERSIONING.md b/VERSIONING.md index 6bb5c5f49c..dfd636f481 100644 --- a/VERSIONING.md +++ b/VERSIONING.md @@ -37,7 +37,9 @@ Kotlin version | Minimal Compose version | Notes 1.8.0 | 1.3.0 | 1.3.0 is not supported by earlier k/native versions 1.8.10 | 1.3.1 1.8.20 | 1.4.0 -1.8.20 | 1.4.1 +1.8.21 | 1.4.3 +1.8.22 | 1.4.3 +1.9.0 | 1.4.3 ### Using the latest Kotlin version diff --git a/ci/compose-uber-jar/gradle.properties b/ci/compose-uber-jar/gradle.properties index 68f7a4b5db..9e87d28540 100644 --- a/ci/compose-uber-jar/gradle.properties +++ b/ci/compose-uber-jar/gradle.properties @@ -1,2 +1,2 @@ -compose.version=1.4.1 +compose.version=1.4.3 kotlin.code.style=official diff --git a/ci/templates/desktop-template/gradle.properties b/ci/templates/desktop-template/gradle.properties index c34a46a505..105a342d5a 100644 --- a/ci/templates/desktop-template/gradle.properties +++ b/ci/templates/desktop-template/gradle.properties @@ -1,4 +1,4 @@ org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 kotlin.code.style=official -kotlin.version=1.8.20 -compose.version=1.4.1 +kotlin.version=1.9.0 +compose.version=1.4.3 diff --git a/ci/templates/html-library-template/gradle.properties b/ci/templates/html-library-template/gradle.properties index c34a46a505..105a342d5a 100644 --- a/ci/templates/html-library-template/gradle.properties +++ b/ci/templates/html-library-template/gradle.properties @@ -1,4 +1,4 @@ org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 kotlin.code.style=official -kotlin.version=1.8.20 -compose.version=1.4.1 +kotlin.version=1.9.0 +compose.version=1.4.3 diff --git a/ci/templates/multiplatform-template/gradle.properties b/ci/templates/multiplatform-template/gradle.properties index 419dff984d..4d04eec50b 100644 --- a/ci/templates/multiplatform-template/gradle.properties +++ b/ci/templates/multiplatform-template/gradle.properties @@ -2,6 +2,6 @@ org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 android.useAndroidX=true android.enableJetifier=true kotlin.code.style=official -kotlin.version=1.8.20 +kotlin.version=1.9.0 agp.version=7.1.3 -compose.version=1.4.1 +compose.version=1.4.3 diff --git a/examples/chat/gradle.properties b/examples/chat/gradle.properties index 59a25387e0..0c5787e969 100644 --- a/examples/chat/gradle.properties +++ b/examples/chat/gradle.properties @@ -11,6 +11,6 @@ kotlin.native.useEmbeddableCompilerJar=true kotlin.mpp.androidSourceSetLayoutVersion=2 # Enable kotlin/native experimental memory model kotlin.native.binary.memoryModel=experimental -kotlin.version=1.8.20 +kotlin.version=1.9.0 agp.version=7.1.3 -compose.version=1.4.1 +compose.version=1.4.3 diff --git a/examples/codeviewer/gradle.properties b/examples/codeviewer/gradle.properties index 59a25387e0..0c5787e969 100644 --- a/examples/codeviewer/gradle.properties +++ b/examples/codeviewer/gradle.properties @@ -11,6 +11,6 @@ kotlin.native.useEmbeddableCompilerJar=true kotlin.mpp.androidSourceSetLayoutVersion=2 # Enable kotlin/native experimental memory model kotlin.native.binary.memoryModel=experimental -kotlin.version=1.8.20 +kotlin.version=1.9.0 agp.version=7.1.3 -compose.version=1.4.1 +compose.version=1.4.3 diff --git a/examples/falling-balls/gradle.properties b/examples/falling-balls/gradle.properties index 59a25387e0..0c5787e969 100644 --- a/examples/falling-balls/gradle.properties +++ b/examples/falling-balls/gradle.properties @@ -11,6 +11,6 @@ kotlin.native.useEmbeddableCompilerJar=true kotlin.mpp.androidSourceSetLayoutVersion=2 # Enable kotlin/native experimental memory model kotlin.native.binary.memoryModel=experimental -kotlin.version=1.8.20 +kotlin.version=1.9.0 agp.version=7.1.3 -compose.version=1.4.1 +compose.version=1.4.3 diff --git a/examples/html/compose-bird/gradle.properties b/examples/html/compose-bird/gradle.properties index 9c5d046412..c977b41e35 100644 --- a/examples/html/compose-bird/gradle.properties +++ b/examples/html/compose-bird/gradle.properties @@ -1,3 +1,3 @@ kotlin.code.style=official -kotlin.version=1.8.20 -compose.version=1.4.1 +kotlin.version=1.9.0 +compose.version=1.4.3 diff --git a/examples/html/compose-in-js/gradle.properties b/examples/html/compose-in-js/gradle.properties index b2e964491d..3dbe700979 100644 --- a/examples/html/compose-in-js/gradle.properties +++ b/examples/html/compose-in-js/gradle.properties @@ -2,5 +2,5 @@ kotlin.code.style=official kotlin.mpp.enableGranularSourceSetsMetadata=true kotlin.native.enableDependencyPropagation=false kotlin.js.webpack.major.version=4 -kotlin.version=1.8.20 -compose.version=1.4.1 +kotlin.version=1.9.0 +compose.version=1.4.3 diff --git a/examples/html/landing/gradle.properties b/examples/html/landing/gradle.properties index 9c5d046412..c977b41e35 100644 --- a/examples/html/landing/gradle.properties +++ b/examples/html/landing/gradle.properties @@ -1,3 +1,3 @@ kotlin.code.style=official -kotlin.version=1.8.20 -compose.version=1.4.1 +kotlin.version=1.9.0 +compose.version=1.4.3 diff --git a/examples/html/with-react/gradle.properties b/examples/html/with-react/gradle.properties index 9c5d046412..c977b41e35 100644 --- a/examples/html/with-react/gradle.properties +++ b/examples/html/with-react/gradle.properties @@ -1,3 +1,3 @@ kotlin.code.style=official -kotlin.version=1.8.20 -compose.version=1.4.1 +kotlin.version=1.9.0 +compose.version=1.4.3 diff --git a/examples/imageviewer/gradle.properties b/examples/imageviewer/gradle.properties index ed81b24b3f..a50918ec89 100644 --- a/examples/imageviewer/gradle.properties +++ b/examples/imageviewer/gradle.properties @@ -11,6 +11,6 @@ kotlin.mpp.androidSourceSetLayoutVersion=2 kotlin.native.useEmbeddableCompilerJar=true # Enable kotlin/native experimental memory model kotlin.native.binary.memoryModel=experimental -kotlin.version=1.8.20 +kotlin.version=1.9.0 agp.version=7.1.3 -compose.version=1.4.1 +compose.version=1.4.3 diff --git a/examples/imageviewer/shared/src/iosMain/kotlin/example/imageviewer/platform.ios.kt b/examples/imageviewer/shared/src/iosMain/kotlin/example/imageviewer/platform.ios.kt index 9926f5250c..92d4b9d370 100644 --- a/examples/imageviewer/shared/src/iosMain/kotlin/example/imageviewer/platform.ios.kt +++ b/examples/imageviewer/shared/src/iosMain/kotlin/example/imageviewer/platform.ios.kt @@ -8,6 +8,7 @@ import androidx.compose.ui.unit.Density import androidx.compose.ui.unit.LayoutDirection import example.imageviewer.icon.IconIosShare import kotlinx.cinterop.useContents +import kotlinx.cinterop.ExperimentalForeignApi import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.IO import platform.CoreFoundation.CFUUIDCreate @@ -41,6 +42,7 @@ class IosStorableImage( actual typealias PlatformStorableImage = IosStorableImage +@OptIn(ExperimentalForeignApi::class) actual fun createUUID(): String = CFBridgingRelease(CFUUIDCreateString(null, CFUUIDCreate(null))) as String diff --git a/examples/imageviewer/shared/src/iosMain/kotlin/example/imageviewer/storage/FileExtensions.kt b/examples/imageviewer/shared/src/iosMain/kotlin/example/imageviewer/storage/FileExtensions.kt index 3513a1f662..a003027160 100644 --- a/examples/imageviewer/shared/src/iosMain/kotlin/example/imageviewer/storage/FileExtensions.kt +++ b/examples/imageviewer/shared/src/iosMain/kotlin/example/imageviewer/storage/FileExtensions.kt @@ -1,3 +1,5 @@ +@file:OptIn(ExperimentalForeignApi::class) + package example.imageviewer.storage import kotlinx.cinterop.* diff --git a/examples/imageviewer/shared/src/iosMain/kotlin/example/imageviewer/storage/IosImageStorage.ios.kt b/examples/imageviewer/shared/src/iosMain/kotlin/example/imageviewer/storage/IosImageStorage.ios.kt index 93408a61d1..59b0d7c1be 100644 --- a/examples/imageviewer/shared/src/iosMain/kotlin/example/imageviewer/storage/IosImageStorage.ios.kt +++ b/examples/imageviewer/shared/src/iosMain/kotlin/example/imageviewer/storage/IosImageStorage.ios.kt @@ -7,6 +7,7 @@ import example.imageviewer.PlatformStorableImage import example.imageviewer.model.PictureData import example.imageviewer.toImageBitmap import kotlinx.cinterop.CValue +import kotlinx.cinterop.ExperimentalForeignApi import kotlinx.cinterop.useContents import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers @@ -122,6 +123,7 @@ class IosImageStorage( } } +@OptIn(ExperimentalForeignApi::class) private fun UIImage.fitInto(px: Int): UIImage { val targetScale = maxOf( px.toFloat() / size.useContents { width }, @@ -131,6 +133,7 @@ private fun UIImage.fitInto(px: Int): UIImage { return resize(newSize) } +@OptIn(ExperimentalForeignApi::class) private fun UIImage.resize(targetSize: CValue): UIImage { val currentSize = this.size val widthRatio = targetSize.useContents { width } / currentSize.useContents { width } diff --git a/examples/imageviewer/shared/src/iosMain/kotlin/example/imageviewer/view/CameraView.ios.kt b/examples/imageviewer/shared/src/iosMain/kotlin/example/imageviewer/view/CameraView.ios.kt index c76d44fa88..5499750fba 100644 --- a/examples/imageviewer/shared/src/iosMain/kotlin/example/imageviewer/view/CameraView.ios.kt +++ b/examples/imageviewer/shared/src/iosMain/kotlin/example/imageviewer/view/CameraView.ios.kt @@ -18,6 +18,7 @@ import example.imageviewer.model.GpsPosition import example.imageviewer.model.PictureData import example.imageviewer.model.createCameraPictureData import kotlinx.cinterop.CValue +import kotlinx.cinterop.ExperimentalForeignApi import kotlinx.cinterop.ObjCAction import kotlinx.cinterop.useContents import platform.AVFoundation.* @@ -121,6 +122,7 @@ private fun BoxScope.AuthorizedCamera( } } +@OptIn(ExperimentalForeignApi::class) @Composable private fun BoxScope.RealDeviceCamera( camera: AVCaptureDevice, @@ -272,6 +274,7 @@ private fun BoxScope.RealDeviceCamera( } } +@OptIn(ExperimentalForeignApi::class) fun CLLocation.toGps() = GpsPosition( latitude = coordinate.useContents { latitude }, diff --git a/examples/imageviewer/shared/src/iosMain/kotlin/example/imageviewer/view/LocationVisualizer.ios.kt b/examples/imageviewer/shared/src/iosMain/kotlin/example/imageviewer/view/LocationVisualizer.ios.kt index 451d3b9ee5..4da53ef73b 100644 --- a/examples/imageviewer/shared/src/iosMain/kotlin/example/imageviewer/view/LocationVisualizer.ios.kt +++ b/examples/imageviewer/shared/src/iosMain/kotlin/example/imageviewer/view/LocationVisualizer.ios.kt @@ -6,11 +6,13 @@ import androidx.compose.runtime.remember import androidx.compose.ui.Modifier import androidx.compose.ui.interop.UIKitView import example.imageviewer.model.GpsPosition +import kotlinx.cinterop.ExperimentalForeignApi import platform.CoreLocation.CLLocationCoordinate2DMake import platform.MapKit.MKCoordinateRegionMakeWithDistance import platform.MapKit.MKMapView import platform.MapKit.MKPointAnnotation +@OptIn(ExperimentalForeignApi::class) @Composable actual fun LocationVisualizer( modifier: Modifier, diff --git a/examples/intellij-plugin/gradle.properties b/examples/intellij-plugin/gradle.properties index 9c5d046412..c977b41e35 100644 --- a/examples/intellij-plugin/gradle.properties +++ b/examples/intellij-plugin/gradle.properties @@ -1,3 +1,3 @@ kotlin.code.style=official -kotlin.version=1.8.20 -compose.version=1.4.1 +kotlin.version=1.9.0 +compose.version=1.4.3 diff --git a/examples/issues/gradle.properties b/examples/issues/gradle.properties index fe0cb4ce3e..a61fd0475a 100644 --- a/examples/issues/gradle.properties +++ b/examples/issues/gradle.properties @@ -19,6 +19,6 @@ kotlin.code.style=official android.useAndroidX=true # Automatically convert third-party libraries to use AndroidX android.enableJetifier=true -kotlin.version=1.8.20 +kotlin.version=1.9.0 agp.version=7.1.3 -compose.version=1.4.1 +compose.version=1.4.3 diff --git a/examples/minesweeper/gradle.properties b/examples/minesweeper/gradle.properties index 59a25387e0..0c5787e969 100644 --- a/examples/minesweeper/gradle.properties +++ b/examples/minesweeper/gradle.properties @@ -11,6 +11,6 @@ kotlin.native.useEmbeddableCompilerJar=true kotlin.mpp.androidSourceSetLayoutVersion=2 # Enable kotlin/native experimental memory model kotlin.native.binary.memoryModel=experimental -kotlin.version=1.8.20 +kotlin.version=1.9.0 agp.version=7.1.3 -compose.version=1.4.1 +compose.version=1.4.3 diff --git a/examples/notepad/gradle.properties b/examples/notepad/gradle.properties index c34a46a505..105a342d5a 100644 --- a/examples/notepad/gradle.properties +++ b/examples/notepad/gradle.properties @@ -1,4 +1,4 @@ org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 kotlin.code.style=official -kotlin.version=1.8.20 -compose.version=1.4.1 +kotlin.version=1.9.0 +compose.version=1.4.3 diff --git a/examples/todoapp-lite/gradle.properties b/examples/todoapp-lite/gradle.properties index 59a25387e0..0c5787e969 100755 --- a/examples/todoapp-lite/gradle.properties +++ b/examples/todoapp-lite/gradle.properties @@ -11,6 +11,6 @@ kotlin.native.useEmbeddableCompilerJar=true kotlin.mpp.androidSourceSetLayoutVersion=2 # Enable kotlin/native experimental memory model kotlin.native.binary.memoryModel=experimental -kotlin.version=1.8.20 +kotlin.version=1.9.0 agp.version=7.1.3 -compose.version=1.4.1 +compose.version=1.4.3 diff --git a/examples/todoapp/gradle.properties b/examples/todoapp/gradle.properties index 4020275597..1b42962c80 100755 --- a/examples/todoapp/gradle.properties +++ b/examples/todoapp/gradle.properties @@ -27,5 +27,5 @@ kotlin.native.disableCompilerDaemon=true # After updating Compose Multiplatform version, update corresponding Jetpack Compose versions # in Android module (search "Workaround for https://github.com/JetBrains/compose-jb/issues/2340") #TODO also change version in buildSrc/gradle.properties -kotlin.version=1.8.20 -compose.version=1.4.1 +kotlin.version=1.9.0 +compose.version=1.4.3 diff --git a/examples/visual-effects/gradle.properties b/examples/visual-effects/gradle.properties index 9a5dc82f4e..125fb44055 100644 --- a/examples/visual-effects/gradle.properties +++ b/examples/visual-effects/gradle.properties @@ -11,6 +11,6 @@ kotlin.native.cacheKind=none kotlin.native.useEmbeddableCompilerJar=true # Enable kotlin/native experimental memory model kotlin.native.binary.memoryModel=experimental -kotlin.version=1.8.20 +kotlin.version=1.9.0 agp.version=7.1.3 -compose.version=1.4.1 +compose.version=1.4.3 diff --git a/examples/widgets-gallery/gradle.properties b/examples/widgets-gallery/gradle.properties index 59a25387e0..0c5787e969 100644 --- a/examples/widgets-gallery/gradle.properties +++ b/examples/widgets-gallery/gradle.properties @@ -11,6 +11,6 @@ kotlin.native.useEmbeddableCompilerJar=true kotlin.mpp.androidSourceSetLayoutVersion=2 # Enable kotlin/native experimental memory model kotlin.native.binary.memoryModel=experimental -kotlin.version=1.8.20 +kotlin.version=1.9.0 agp.version=7.1.3 -compose.version=1.4.1 +compose.version=1.4.3 diff --git a/tools/replaceVersion.sh b/tools/replaceVersion.sh index a94dfb1b11..7a5b1621e9 100755 --- a/tools/replaceVersion.sh +++ b/tools/replaceVersion.sh @@ -8,9 +8,7 @@ ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"/.. declare -a folders=( "$ROOT/examples" "$ROOT/gradle-plugins" - "$ROOT/components" "$ROOT/ci" - "$ROOT/html" "$ROOT/tutorials" ) diff --git a/tutorials/HTML/Getting_Started/README.md b/tutorials/HTML/Getting_Started/README.md index 81c7f99365..73f3a797af 100644 --- a/tutorials/HTML/Getting_Started/README.md +++ b/tutorials/HTML/Getting_Started/README.md @@ -36,8 +36,8 @@ pluginManagement { ``` kotlin // Add compose gradle plugin plugins { - kotlin("multiplatform") version "1.8.20" - id("org.jetbrains.compose") version "1.4.1" + kotlin("multiplatform") version "1.9.0" + id("org.jetbrains.compose") version "1.4.3" } // Add maven repositories