Skip to content

Commit adfb71f

Browse files
authored
Updated example of building using the CLI to Kotlin 1.9.23 and Compose 1.6.1 (JetBrains#4488)
This PR updates the experimental CLI example to the latest Kotlin and Compose Multiplatform releases. The default platform used was also updated to Mac arm64. Co-authored-by: Christian Melchior <[email protected]>
1 parent 7c0dcfb commit adfb71f

File tree

1 file changed

+27
-19
lines changed

1 file changed

+27
-19
lines changed

experimental/build_from_cli/build_and_run_from_cli_example.sh

+27-19
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,31 @@ function mavenDep {
1818
fi
1919
}
2020

21-
PLATFORM=macos-x64
22-
# to know which Skiko version corresponds to Compose version, search "skiko" in https://maven.pkg.jetbrains.space/public/p/compose/dev/org/jetbrains/compose/ui/ui-graphics-desktop/1.1.0-alpha04/ui-graphics-desktop-1.1.0-alpha04.pom (replace 1.0.0-alpha04 by needed version)
23-
SKIKO_VERSION=0.2.33
24-
KOTLIN_VERSION=1.5.0
25-
COMPOSE_VERSION=0.4.0-build209
26-
COROUTINES_VERSION=1.3.6
27-
COLLECTIONS_VERSION=0.3
28-
SPACE_REPO="https://public.jetbrains.space/p/compose/packages/maven/"
21+
# Define which platform the code is running on. This is required to load the correct native code.
22+
PLATFORM=macos-arm64
23+
# The Compose compiler must be compatible with the selected version of Kotlin.
24+
# See https://www.jetbrains.com/help/kotlin-multiplatform-dev/compose-compatibility-and-versioning.html#use-a-developer-version-of-compose-multiplatform-compiler
25+
# for which version of the compiler to use.
26+
COMPOSE_COMPILER_VERSION=1.5.10.1
27+
# See https://github.com/JetBrains/compose-multiplatform/releases for available versions of Compose
28+
COMPOSE_VERSION=1.6.1
29+
# To know which Skiko version corresponds to the used Compose version, search after "skiko" in
30+
# https://repo1.maven.org/maven2/org/jetbrains/compose/ui/ui-desktop/1.6.1/ui-desktop-1.6.1.pom
31+
# (replace 1.6.1) with the version of compose used.
32+
SKIKO_VERSION=0.7.97
33+
KOTLIN_VERSION=1.9.23
34+
COROUTINES_VERSION=1.8.0
35+
ANDROIDX_COLLECTION_VERSION=1.4.0
36+
GOOGLE_REPO="https://maven.google.com/"
2937
MAVEN_CENTRAL="https://repo1.maven.org/maven2"
3038

31-
mavenDep "$SPACE_REPO" "org/jetbrains/skiko" "skiko-jvm-runtime-$PLATFORM" "$SKIKO_VERSION"
32-
mavenDep "$SPACE_REPO" "org/jetbrains/compose" "compose-full" "$COMPOSE_VERSION"
33-
mavenDep "$SPACE_REPO" "org/jetbrains/compose" "compose-compiler-hosted" "$COMPOSE_VERSION"
34-
mavenDep "$MAVEN_CENTRAL" "org/jetbrains/kotlinx" "kotlinx-collections-immutable-jvm" "$COLLECTIONS_VERSION"
35-
mavenDep "$MAVEN_CENTRAL" "org/jetbrains/kotlinx" "kotlinx-coroutines-core" "$COROUTINES_VERSION"
39+
mavenDep "$MAVEN_CENTRAL" "org/jetbrains/skiko" "skiko-awt" "$SKIKO_VERSION"
40+
mavenDep "$MAVEN_CENTRAL" "org/jetbrains/skiko" "skiko-awt-runtime-$PLATFORM" "$SKIKO_VERSION"
41+
mavenDep "$MAVEN_CENTRAL" "org/jetbrains/compose/compiler" "compiler-hosted" "$COMPOSE_COMPILER_VERSION"
42+
mavenDep "$MAVEN_CENTRAL" "org/jetbrains/compose" "compose-full" "$COMPOSE_VERSION"
43+
mavenDep "$MAVEN_CENTRAL" "org/jetbrains/kotlinx" "kotlinx-coroutines-core-jvm" "$COROUTINES_VERSION"
44+
mavenDep "$GOOGLE_REPO" "androidx/collection" "collection-jvm" "$ANDROIDX_COLLECTION_VERSION"
45+
3646
mavenDep "$MAVEN_CENTRAL" "org/jetbrains/kotlin" "kotlin-stdlib" "$KOTLIN_VERSION"
3747
if [ ! -f "deps/kotlin-compiler-$KOTLIN_VERSION.zip" ]; then
3848
wget -P deps/ "https://github.com/JetBrains/kotlin/releases/download/v$KOTLIN_VERSION/kotlin-compiler-$KOTLIN_VERSION.zip"
@@ -46,16 +56,14 @@ if [ -d "$OUT_DIR" ]; then
4656
rm -rf $OUT_DIR
4757
fi
4858

49-
COMPILE_CLASSPATH="deps/compose-full-$COMPOSE_VERSION.jar:deps/skiko-jvm-runtime-$PLATFORM-$SKIKO_VERSION.jar:deps/kotlinx-coroutines-core-$COROUTINES_VERSION.jar"
50-
RUNTIME_CLASSPATH="deps/kotlinx-collections-immutable-jvm-$COLLECTIONS_VERSION.jar:deps/kotlin-stdlib-$KOTLIN_VERSION.jar:$COMPILE_CLASSPATH"
59+
COMPILE_CLASSPATH="deps/compose-full-$COMPOSE_VERSION.jar"
60+
RUNTIME_CLASSPATH="deps/collection-jvm-$ANDROIDX_COLLECTION_VERSION.jar:deps/skiko-awt-$SKIKO_VERSION.jar:deps/skiko-awt-runtime-$PLATFORM-$SKIKO_VERSION.jar:deps/kotlin-stdlib-$KOTLIN_VERSION.jar:deps/kotlinx-coroutines-core-jvm-$COROUTINES_VERSION.jar:$COMPILE_CLASSPATH"
5161
SOURCES=$(find src/main -name "*.kt"|paste -sd " " -)
5262
JAVA_OPTS=-Xmx1G deps/kotlinc/bin/kotlinc-jvm \
53-
-jvm-target 1.8 \
54-
-Xuse-ir \
63+
-language-version 1.9 \
5564
-Xmulti-platform \
56-
-Xplugin="deps/compose-compiler-hosted-$COMPOSE_VERSION.jar" \
65+
-Xplugin="deps/compiler-hosted-$COMPOSE_COMPILER_VERSION.jar" \
5766
-cp "$COMPILE_CLASSPATH" \
5867
-d $OUT_DIR $SOURCES
5968

60-
#jar cf result.jar -C "$OUT_DIR" . -C "src/main/resources" .
6169
java -cp "out/:result.jar:$RUNTIME_CLASSPATH" MainKt

0 commit comments

Comments
 (0)