Browse Source

Update kotlin version in examples (#4844)

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)
pull/4857/head
Oleksandr Karpovich 7 months ago committed by GitHub
parent
commit
4c01cbdec7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 1
      ci/templates/desktop-template/build.gradle.kts
  2. 2
      ci/templates/desktop-template/gradle.properties
  3. 1
      ci/templates/desktop-template/settings.gradle.kts
  4. 10
      ci/templates/html-library-template/build.gradle.kts
  5. 2
      ci/templates/html-library-template/gradle.properties
  6. 1
      ci/templates/html-library-template/settings.gradle.kts
  7. 1
      ci/templates/multiplatform-template/android/build.gradle.kts
  8. 1
      ci/templates/multiplatform-template/build.gradle.kts
  9. 1
      ci/templates/multiplatform-template/common/build.gradle.kts
  10. 1
      ci/templates/multiplatform-template/desktop/build.gradle.kts
  11. 2
      ci/templates/multiplatform-template/gradle.properties
  12. 1
      ci/templates/multiplatform-template/settings.gradle.kts
  13. 1
      examples/chat/androidApp/build.gradle.kts
  14. 1
      examples/chat/build.gradle.kts
  15. 1
      examples/chat/desktopApp/build.gradle.kts
  16. 4
      examples/chat/gradle.properties
  17. 5
      examples/chat/jsApp/build.gradle.kts
  18. 6
      examples/chat/jsApp/src/jsMain/kotlin/main.js.kt
  19. 1
      examples/chat/settings.gradle.kts
  20. 1
      examples/chat/shared/build.gradle.kts
  21. 1
      examples/cocoapods-ios-example/androidApp/build.gradle.kts
  22. 1
      examples/cocoapods-ios-example/build.gradle.kts
  23. 4
      examples/cocoapods-ios-example/gradle.properties
  24. 1
      examples/cocoapods-ios-example/settings.gradle.kts
  25. 1
      examples/cocoapods-ios-example/shared/build.gradle.kts
  26. 1
      examples/codeviewer/androidApp/build.gradle.kts
  27. 1
      examples/codeviewer/build.gradle.kts
  28. 1
      examples/codeviewer/desktopApp/build.gradle.kts
  29. 4
      examples/codeviewer/gradle.properties
  30. 1
      examples/codeviewer/settings.gradle.kts
  31. 1
      examples/codeviewer/shared/build.gradle.kts
  32. 183
      examples/codeviewer/shared/src/iosMain/composeResources/EditorView.kt
  33. 1
      examples/graphics-2d/androidApp/build.gradle.kts
  34. 1
      examples/graphics-2d/build.gradle.kts
  35. 1
      examples/graphics-2d/desktopApp/build.gradle.kts
  36. 4
      examples/graphics-2d/gradle.properties
  37. 6
      examples/graphics-2d/jsApp/build.gradle.kts
  38. 6
      examples/graphics-2d/jsApp/src/jsMain/kotlin/main.js.kt
  39. 1
      examples/graphics-2d/settings.gradle.kts
  40. 1
      examples/graphics-2d/shared/build.gradle.kts
  41. 1
      examples/html/compose-bird/build.gradle.kts
  42. 2
      examples/html/compose-bird/gradle.properties
  43. 1
      examples/html/compose-bird/settings.gradle.kts
  44. 11
      examples/html/compose-in-js/build.gradle.kts
  45. 2
      examples/html/compose-in-js/gradle.properties
  46. 1
      examples/html/compose-in-js/settings.gradle.kts
  47. 9
      examples/html/landing/build.gradle.kts
  48. 2
      examples/html/landing/gradle.properties
  49. 1
      examples/html/landing/settings.gradle.kts
  50. 8
      examples/html/with-react/build.gradle.kts
  51. 2
      examples/html/with-react/gradle.properties
  52. 1
      examples/html/with-react/settings.gradle.kts
  53. 1
      examples/imageviewer/androidApp/build.gradle.kts
  54. 1
      examples/imageviewer/desktopApp/build.gradle.kts
  55. 8
      examples/imageviewer/gradle.properties
  56. 544
      examples/imageviewer/kotlin-js-store/yarn.lock
  57. 1
      examples/imageviewer/mapview-desktop/build.gradle.kts
  58. 1
      examples/imageviewer/settings.gradle.kts
  59. 1
      examples/imageviewer/shared/build.gradle.kts
  60. 28
      examples/imageviewer/webApp/build.gradle.kts
  61. 1
      examples/intellij-plugin/build.gradle.kts
  62. 2
      examples/intellij-plugin/gradle.properties
  63. 1
      examples/intellij-plugin/settings.gradle.kts
  64. 1
      examples/interop/ios-compose-in-swiftui/build.gradle.kts
  65. 2
      examples/interop/ios-compose-in-swiftui/gradle.properties
  66. 1
      examples/interop/ios-compose-in-swiftui/settings.gradle.kts
  67. 1
      examples/interop/ios-compose-in-swiftui/shared/build.gradle.kts
  68. 1
      examples/interop/ios-compose-in-uikit/build.gradle.kts
  69. 2
      examples/interop/ios-compose-in-uikit/gradle.properties
  70. 1
      examples/interop/ios-compose-in-uikit/settings.gradle.kts
  71. 1
      examples/interop/ios-compose-in-uikit/shared/build.gradle.kts
  72. 1
      examples/interop/ios-swiftui-in-compose/build.gradle.kts
  73. 2
      examples/interop/ios-swiftui-in-compose/gradle.properties
  74. 1
      examples/interop/ios-swiftui-in-compose/settings.gradle.kts
  75. 1
      examples/interop/ios-swiftui-in-compose/shared/build.gradle.kts
  76. 1
      examples/interop/ios-uikit-in-compose/build.gradle.kts
  77. 2
      examples/interop/ios-uikit-in-compose/gradle.properties
  78. 1
      examples/interop/ios-uikit-in-compose/settings.gradle.kts
  79. 1
      examples/interop/ios-uikit-in-compose/shared/build.gradle.kts
  80. 1
      examples/issues/android/build.gradle.kts
  81. 1
      examples/issues/build.gradle.kts
  82. 1
      examples/issues/common/build.gradle.kts
  83. 1
      examples/issues/desktop/build.gradle.kts
  84. 2
      examples/issues/gradle.properties
  85. 1
      examples/issues/settings.gradle.kts
  86. 1
      examples/jetsnack/android/build.gradle.kts
  87. 1
      examples/jetsnack/build.gradle.kts
  88. 1
      examples/jetsnack/common/build.gradle.kts
  89. 3
      examples/jetsnack/common/src/nonAndroidMain/kotlin/com/example/jetsnack/ui/MppJetsnackAppState.kt
  90. 3
      examples/jetsnack/common/src/nonAndroidMain/kotlin/com/example/jetsnack/ui/home/cart/CartViewModel.nonAndroid.kt
  91. 1
      examples/jetsnack/desktop/build.gradle.kts
  92. 11
      examples/jetsnack/gradle.properties
  93. 810
      examples/jetsnack/kotlin-js-store/yarn.lock
  94. 1
      examples/jetsnack/settings.gradle.kts
  95. 5
      examples/jetsnack/web/build.gradle.kts
  96. 2
      examples/jetsnack/web/webpack.config.d/cleanupSourcemap.js
  97. 5
      examples/nav_cupcake/gradle.properties
  98. 4
      examples/nav_cupcake/gradle/libs.versions.toml
  99. 3
      examples/notepad/build.gradle.kts
  100. 2
      examples/notepad/gradle.properties
  101. Some files were not shown because too many files have changed in this diff Show More

1
ci/templates/desktop-template/build.gradle.kts

@ -2,6 +2,7 @@ import org.jetbrains.compose.desktop.application.dsl.TargetFormat
plugins { plugins {
kotlin("jvm") kotlin("jvm")
kotlin("plugin.compose")
id("org.jetbrains.compose") id("org.jetbrains.compose")
} }

2
ci/templates/desktop-template/gradle.properties

@ -1,4 +1,4 @@
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
kotlin.code.style=official kotlin.code.style=official
kotlin.version=1.9.24 kotlin.version=2.0.0
compose.version=1.6.10 compose.version=1.6.10

1
ci/templates/desktop-template/settings.gradle.kts

@ -6,6 +6,7 @@ pluginManagement {
plugins { plugins {
kotlin("jvm").version(extra["kotlin.version"] as String) kotlin("jvm").version(extra["kotlin.version"] as String)
kotlin("plugin.compose").version(extra["kotlin.version"] as String)
id("org.jetbrains.compose").version(extra["compose.version"] as String) id("org.jetbrains.compose").version(extra["compose.version"] as String)
} }
} }

10
ci/templates/html-library-template/build.gradle.kts

@ -3,6 +3,7 @@ import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension
plugins { plugins {
kotlin("multiplatform") kotlin("multiplatform")
kotlin("plugin.compose")
id("org.jetbrains.compose") id("org.jetbrains.compose")
} }
@ -30,12 +31,3 @@ kotlin {
} }
} }
// a temporary workaround for a bug in jsRun invocation - see https://youtrack.jetbrains.com/issue/KT-48273
afterEvaluate {
rootProject.extensions.configure<NodeJsRootExtension> {
nodeVersion = "16.0.0"
versions.webpackDevServer.version = "4.0.0"
versions.webpackCli.version = "4.10.0"
}
}

2
ci/templates/html-library-template/gradle.properties

@ -1,4 +1,4 @@
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
kotlin.code.style=official kotlin.code.style=official
kotlin.version=1.9.24 kotlin.version=2.0.0
compose.version=1.6.10 compose.version=1.6.10

1
ci/templates/html-library-template/settings.gradle.kts

@ -6,6 +6,7 @@ pluginManagement {
plugins { plugins {
kotlin("multiplatform").version(extra["kotlin.version"] as String) kotlin("multiplatform").version(extra["kotlin.version"] as String)
kotlin("plugin.compose").version(extra["kotlin.version"] as String)
id("org.jetbrains.compose").version(extra["compose.version"] as String) id("org.jetbrains.compose").version(extra["compose.version"] as String)
} }
} }

1
ci/templates/multiplatform-template/android/build.gradle.kts

@ -1,6 +1,7 @@
plugins { plugins {
id("com.android.application") id("com.android.application")
kotlin("android") kotlin("android")
kotlin("plugin.compose")
id("org.jetbrains.compose") id("org.jetbrains.compose")
} }

1
ci/templates/multiplatform-template/build.gradle.kts

@ -3,6 +3,7 @@ plugins {
// in each subproject's classloader // in each subproject's classloader
kotlin("jvm") apply false kotlin("jvm") apply false
kotlin("multiplatform") apply false kotlin("multiplatform") apply false
kotlin("plugin.compose") apply false
kotlin("android") apply false kotlin("android") apply false
id("com.android.application") apply false id("com.android.application") apply false
id("com.android.library") apply false id("com.android.library") apply false

1
ci/templates/multiplatform-template/common/build.gradle.kts

@ -1,6 +1,7 @@
plugins { plugins {
id("com.android.library") id("com.android.library")
kotlin("multiplatform") kotlin("multiplatform")
kotlin("plugin.compose")
id("org.jetbrains.compose") id("org.jetbrains.compose")
} }

1
ci/templates/multiplatform-template/desktop/build.gradle.kts

@ -3,6 +3,7 @@ import org.jetbrains.compose.desktop.application.dsl.TargetFormat
plugins { plugins {
kotlin("multiplatform") kotlin("multiplatform")
id("org.jetbrains.compose") id("org.jetbrains.compose")
kotlin("plugin.compose")
} }
kotlin { kotlin {

2
ci/templates/multiplatform-template/gradle.properties

@ -2,6 +2,6 @@ org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
android.useAndroidX=true android.useAndroidX=true
android.enableJetifier=true android.enableJetifier=true
kotlin.code.style=official kotlin.code.style=official
kotlin.version=1.9.24 kotlin.version=2.0.0
agp.version=8.0.2 agp.version=8.0.2
compose.version=1.6.10 compose.version=1.6.10

1
ci/templates/multiplatform-template/settings.gradle.kts

@ -8,6 +8,7 @@ pluginManagement {
plugins { plugins {
kotlin("jvm").version(extra["kotlin.version"] as String) kotlin("jvm").version(extra["kotlin.version"] as String)
kotlin("multiplatform").version(extra["kotlin.version"] as String) kotlin("multiplatform").version(extra["kotlin.version"] as String)
kotlin("plugin.compose").version(extra["kotlin.version"] as String)
kotlin("android").version(extra["kotlin.version"] as String) kotlin("android").version(extra["kotlin.version"] as String)
id("com.android.application").version(extra["agp.version"] as String) id("com.android.application").version(extra["agp.version"] as String)
id("com.android.library").version(extra["agp.version"] as String) id("com.android.library").version(extra["agp.version"] as String)

1
examples/chat/androidApp/build.gradle.kts

@ -1,5 +1,6 @@
plugins { plugins {
kotlin("multiplatform") kotlin("multiplatform")
kotlin("plugin.compose")
id("com.android.application") id("com.android.application")
id("org.jetbrains.compose") id("org.jetbrains.compose")
} }

1
examples/chat/build.gradle.kts

@ -3,6 +3,7 @@ plugins {
// in each subproject's classloader // in each subproject's classloader
kotlin("jvm") apply false kotlin("jvm") apply false
kotlin("multiplatform") apply false kotlin("multiplatform") apply false
kotlin("plugin.compose") apply false
kotlin("android") apply false kotlin("android") apply false
id("com.android.application") apply false id("com.android.application") apply false
id("com.android.library") apply false id("com.android.library") apply false

1
examples/chat/desktopApp/build.gradle.kts

@ -1,5 +1,6 @@
plugins { plugins {
kotlin("multiplatform") kotlin("multiplatform")
kotlin("plugin.compose")
id("org.jetbrains.compose") id("org.jetbrains.compose")
} }

4
examples/chat/gradle.properties

@ -1,7 +1,7 @@
kotlin.code.style=official kotlin.code.style=official
xcodeproj=./iosApp xcodeproj=./iosApp
android.useAndroidX=true android.useAndroidX=true
org.gradle.jvmargs=-Xmx3g org.gradle.jvmargs=-Xmx8g
org.gradle.configuration-cache=true org.gradle.configuration-cache=true
org.gradle.caching=true org.gradle.caching=true
org.jetbrains.compose.experimental.jscanvas.enabled=true org.jetbrains.compose.experimental.jscanvas.enabled=true
@ -10,6 +10,6 @@ kotlin.native.useEmbeddableCompilerJar=true
kotlin.mpp.androidSourceSetLayoutVersion=2 kotlin.mpp.androidSourceSetLayoutVersion=2
# Enable kotlin/native experimental memory model # Enable kotlin/native experimental memory model
kotlin.native.binary.memoryModel=experimental kotlin.native.binary.memoryModel=experimental
kotlin.version=1.9.24 kotlin.version=2.0.0
agp.version=8.0.2 agp.version=8.0.2
compose.version=1.6.10 compose.version=1.6.10

5
examples/chat/jsApp/build.gradle.kts

@ -1,5 +1,6 @@
plugins { plugins {
kotlin("multiplatform") kotlin("multiplatform")
kotlin("plugin.compose")
id("org.jetbrains.compose") id("org.jetbrains.compose")
} }
@ -19,7 +20,3 @@ kotlin {
} }
} }
compose.experimental {
web.application {}
}

6
examples/chat/jsApp/src/jsMain/kotlin/main.js.kt

@ -1,12 +1,14 @@
import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.window.Window import androidx.compose.ui.window.CanvasBasedWindow
import androidx.compose.ui.ExperimentalComposeUiApi
import org.jetbrains.skiko.wasm.onWasmReady import org.jetbrains.skiko.wasm.onWasmReady
@OptIn(ExperimentalComposeUiApi::class)
fun main() { fun main() {
onWasmReady { onWasmReady {
Window("Chat") { CanvasBasedWindow(title = "Chat") {
Column(modifier = Modifier.fillMaxSize()) { Column(modifier = Modifier.fillMaxSize()) {
MainView() MainView()
} }

1
examples/chat/settings.gradle.kts

@ -12,6 +12,7 @@ pluginManagement {
kotlin("jvm").version(kotlinVersion) kotlin("jvm").version(kotlinVersion)
kotlin("multiplatform").version(kotlinVersion) kotlin("multiplatform").version(kotlinVersion)
kotlin("plugin.compose").version(kotlinVersion)
kotlin("android").version(kotlinVersion) kotlin("android").version(kotlinVersion)
id("com.android.base").version(agpVersion) id("com.android.base").version(agpVersion)
id("com.android.application").version(agpVersion) id("com.android.application").version(agpVersion)

1
examples/chat/shared/build.gradle.kts

@ -2,6 +2,7 @@
plugins { plugins {
kotlin("multiplatform") kotlin("multiplatform")
kotlin("plugin.compose")
id("com.android.library") id("com.android.library")
id("org.jetbrains.compose") id("org.jetbrains.compose")
} }

1
examples/cocoapods-ios-example/androidApp/build.gradle.kts

@ -1,5 +1,6 @@
plugins { plugins {
kotlin("multiplatform") kotlin("multiplatform")
kotlin("plugin.compose")
id("com.android.application") id("com.android.application")
id("org.jetbrains.compose") id("org.jetbrains.compose")
} }

1
examples/cocoapods-ios-example/build.gradle.kts

@ -2,6 +2,7 @@ plugins {
// this is necessary to avoid the plugins to be loaded multiple times // this is necessary to avoid the plugins to be loaded multiple times
// in each subproject's classloader // in each subproject's classloader
kotlin("multiplatform").apply(false) kotlin("multiplatform").apply(false)
kotlin("plugin.compose").apply(false)
id("com.android.application").apply(false) id("com.android.application").apply(false)
id("com.android.library").apply(false) id("com.android.library").apply(false)
id("org.jetbrains.compose").apply(false) id("org.jetbrains.compose").apply(false)

4
examples/cocoapods-ios-example/gradle.properties

@ -1,5 +1,5 @@
#Gradle #Gradle
org.gradle.jvmargs=-Xmx2048M -Dkotlin.daemon.jvm.options\="-Xmx2048M" org.gradle.jvmargs=-Xmx8g -Dkotlin.daemon.jvm.options\="-Xmx8g"
org.gradle.configuration-cache=true org.gradle.configuration-cache=true
org.gradle.caching=true org.gradle.caching=true
@ -20,6 +20,6 @@ android.minSdk=24
#Compose #Compose
#Versions #Versions
kotlin.version=1.9.24 kotlin.version=2.0.0
agp.version=8.0.2 agp.version=8.0.2
compose.version=1.6.10 compose.version=1.6.10

1
examples/cocoapods-ios-example/settings.gradle.kts

@ -16,6 +16,7 @@ pluginManagement {
val composeVersion = extra["compose.version"] as String val composeVersion = extra["compose.version"] as String
kotlin("jvm").version(kotlinVersion) kotlin("jvm").version(kotlinVersion)
kotlin("plugin.compose").version(kotlinVersion)
kotlin("multiplatform").version(kotlinVersion) kotlin("multiplatform").version(kotlinVersion)
kotlin("android").version(kotlinVersion) kotlin("android").version(kotlinVersion)

1
examples/cocoapods-ios-example/shared/build.gradle.kts

@ -1,5 +1,6 @@
plugins { plugins {
kotlin("multiplatform") kotlin("multiplatform")
kotlin("plugin.compose")
kotlin("native.cocoapods") kotlin("native.cocoapods")
id("com.android.library") id("com.android.library")
id("org.jetbrains.compose") id("org.jetbrains.compose")

1
examples/codeviewer/androidApp/build.gradle.kts

@ -1,5 +1,6 @@
plugins { plugins {
kotlin("multiplatform") kotlin("multiplatform")
kotlin("plugin.compose")
id("com.android.application") id("com.android.application")
id("org.jetbrains.compose") id("org.jetbrains.compose")
} }

1
examples/codeviewer/build.gradle.kts

@ -3,6 +3,7 @@ plugins {
// in each subproject's classloader // in each subproject's classloader
kotlin("jvm") apply false kotlin("jvm") apply false
kotlin("multiplatform") apply false kotlin("multiplatform") apply false
kotlin("plugin.compose") apply false
kotlin("android") apply false kotlin("android") apply false
id("com.android.application") apply false id("com.android.application") apply false
id("com.android.library") apply false id("com.android.library") apply false

1
examples/codeviewer/desktopApp/build.gradle.kts

@ -2,6 +2,7 @@ import org.jetbrains.compose.desktop.application.dsl.TargetFormat
plugins { plugins {
kotlin("multiplatform") kotlin("multiplatform")
kotlin("plugin.compose")
id("org.jetbrains.compose") id("org.jetbrains.compose")
} }

4
examples/codeviewer/gradle.properties

@ -1,7 +1,7 @@
kotlin.code.style=official kotlin.code.style=official
xcodeproj=./iosApp xcodeproj=./iosApp
android.useAndroidX=true android.useAndroidX=true
org.gradle.jvmargs=-Xmx3g org.gradle.jvmargs=-Xmx8g
org.gradle.configuration-cache=true org.gradle.configuration-cache=true
org.gradle.caching=true org.gradle.caching=true
org.jetbrains.compose.experimental.jscanvas.enabled=true org.jetbrains.compose.experimental.jscanvas.enabled=true
@ -10,6 +10,6 @@ kotlin.native.useEmbeddableCompilerJar=true
kotlin.mpp.androidSourceSetLayoutVersion=2 kotlin.mpp.androidSourceSetLayoutVersion=2
# Enable kotlin/native experimental memory model # Enable kotlin/native experimental memory model
kotlin.native.binary.memoryModel=experimental kotlin.native.binary.memoryModel=experimental
kotlin.version=1.9.24 kotlin.version=2.0.0
agp.version=8.0.2 agp.version=8.0.2
compose.version=1.6.10 compose.version=1.6.10

1
examples/codeviewer/settings.gradle.kts

@ -13,6 +13,7 @@ pluginManagement {
kotlin("jvm").version(kotlinVersion) kotlin("jvm").version(kotlinVersion)
kotlin("multiplatform").version(kotlinVersion) kotlin("multiplatform").version(kotlinVersion)
kotlin("plugin.compose").version(kotlinVersion)
kotlin("android").version(kotlinVersion) kotlin("android").version(kotlinVersion)
id("com.android.base").version(agpVersion) id("com.android.base").version(agpVersion)
id("com.android.application").version(agpVersion) id("com.android.application").version(agpVersion)

1
examples/codeviewer/shared/build.gradle.kts

@ -2,6 +2,7 @@
plugins { plugins {
kotlin("multiplatform") kotlin("multiplatform")
kotlin("plugin.compose")
id("com.android.library") id("com.android.library")
id("org.jetbrains.compose") id("org.jetbrains.compose")
} }

183
examples/codeviewer/shared/src/iosMain/composeResources/EditorView.kt

@ -1,183 +0,0 @@
/**
* This file is an example (we can open it in iOS application)
*/
package org.jetbrains.codeviewer.ui.editor
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.text.selection.DisableSelection
import androidx.compose.material.AmbientContentColor
import androidx.compose.material.CircularProgressIndicator
import androidx.compose.material.Surface
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.key
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.alpha
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.text.*
import androidx.compose.ui.unit.dp
import org.jetbrains.codeviewer.platform.SelectionContainer
import org.jetbrains.codeviewer.ui.common.AppTheme
import org.jetbrains.codeviewer.ui.common.Fonts
import org.jetbrains.codeviewer.ui.common.Settings
import org.jetbrains.codeviewer.util.loadableScoped
import org.jetbrains.codeviewer.util.withoutWidthConstraints
import kotlin.text.Regex.Companion.fromLiteral
@Composable
fun EditorView(model: Editor, settings: Settings) = key(model) {
with (LocalDensity.current) {
SelectionContainer {
Surface(
Modifier.fillMaxSize(),
color = AppTheme.colors.backgroundDark,
) {
val lines by loadableScoped(model.lines)
if (lines != null) {
Box {
Lines(lines!!, settings)
Box(
Modifier
.offset(
x = settings.fontSize.toDp() * 0.5f * settings.maxLineSymbols
)
.width(1.dp)
.fillMaxHeight()
.background(AppTheme.colors.codeGuide)
)
}
} else {
CircularProgressIndicator(
modifier = Modifier
.size(36.dp)
.padding(4.dp)
)
}
}
}
}
}
@Composable
private fun Lines(lines: Editor.Lines, settings: Settings) = with(DensityAmbient.current) {
val maxNumber = remember(lines.lineNumberDigitCount) {
(1..lines.lineNumberDigitCount).joinToString(separator = "") { "9" }
}
Box(Modifier.fillMaxSize()) {
val scrollState = rememberLazyListState()
val lineHeight = settings.fontSize.toDp() * 1.6f
LazyColumnFor(
lines.size,
modifier = Modifier.fillMaxSize(),
state = scrollState,
itemContent = { index ->
val line: Editor.Line? by loadable { lines.get(index) }
Box(Modifier.height(lineHeight)) {
if (line != null) {
Line(Modifier.align(Alignment.CenterStart), maxNumber, line!!, settings)
}
}
}
)
VerticalScrollbar(
Modifier.align(Alignment.CenterEnd),
scrollState,
lines.size,
lineHeight
)
}
}
// Поддержка русского языка
// دعم اللغة العربية
// 中文支持
@Composable
private fun Line(modifier: Modifier, maxNumber: String, line: Editor.Line, settings: Settings) {
Row(modifier = modifier) {
DisableSelection {
Box {
LineNumber(maxNumber, Modifier.alpha(0f), settings)
LineNumber(line.number.toString(), Modifier.align(Alignment.CenterEnd), settings)
}
}
LineContent(
line.content,
modifier = Modifier
.weight(1f)
.withoutWidthConstraints()
.padding(start = 28.dp, end = 12.dp),
settings = settings
)
}
}
@Composable
private fun LineNumber(number: String, modifier: Modifier, settings: Settings) = Text(
text = number,
fontSize = settings.fontSize,
fontFamily = Fonts.jetbrainsMono(),
color = AmbientContentColor.current.copy(alpha = 0.30f),
modifier = modifier.padding(start = 12.dp)
)
@Composable
private fun LineContent(content: Editor.Content, modifier: Modifier, settings: Settings) = Text(
text = if (content.isCode) {
codeString(content.value.value)
} else {
AnnotatedString(content.value.value)
},
fontSize = settings.fontSize,
fontFamily = Fonts.jetbrainsMono(),
modifier = modifier,
softWrap = false
)
private fun codeString(str: String) = buildAnnotatedString {
withStyle(AppTheme.code.simple) {
append(str.replace("\t", " "))
addStyle(AppTheme.code.punctuation, ":")
addStyle(AppTheme.code.punctuation, "=")
addStyle(AppTheme.code.punctuation, "\"")
addStyle(AppTheme.code.punctuation, "[")
addStyle(AppTheme.code.punctuation, "]")
addStyle(AppTheme.code.punctuation, "{")
addStyle(AppTheme.code.punctuation, "}")
addStyle(AppTheme.code.punctuation, "(")
addStyle(AppTheme.code.punctuation, ")")
addStyle(AppTheme.code.punctuation, ",")
addStyle(AppTheme.code.keyword, "fun ")
addStyle(AppTheme.code.keyword, "val ")
addStyle(AppTheme.code.keyword, "var ")
addStyle(AppTheme.code.keyword, "private ")
addStyle(AppTheme.code.keyword, "internal ")
addStyle(AppTheme.code.keyword, "for ")
addStyle(AppTheme.code.keyword, "expect ")
addStyle(AppTheme.code.keyword, "actual ")
addStyle(AppTheme.code.keyword, "import ")
addStyle(AppTheme.code.keyword, "package ")
addStyle(AppTheme.code.value, "true")
addStyle(AppTheme.code.value, "false")
addStyle(AppTheme.code.value, Regex("[0-9]*"))
addStyle(AppTheme.code.annotation, Regex("^@[a-zA-Z_]*"))
addStyle(AppTheme.code.comment, Regex("^\\s*//.*"))
}
}
private fun AnnotatedString.Builder.addStyle(style: SpanStyle, regexp: String) {
addStyle(style, fromLiteral(regexp))
}
private fun AnnotatedString.Builder.addStyle(style: SpanStyle, regexp: Regex) {
for (result in regexp.findAll(toString())) {
addStyle(style, result.range.first, result.range.last + 1)
}
}

1
examples/graphics-2d/androidApp/build.gradle.kts

@ -1,5 +1,6 @@
plugins { plugins {
kotlin("multiplatform") kotlin("multiplatform")
kotlin("plugin.compose")
id("com.android.application") id("com.android.application")
id("org.jetbrains.compose") id("org.jetbrains.compose")
} }

1
examples/graphics-2d/build.gradle.kts

@ -3,6 +3,7 @@ plugins {
// in each subproject's classloader // in each subproject's classloader
kotlin("jvm") apply false kotlin("jvm") apply false
kotlin("multiplatform") apply false kotlin("multiplatform") apply false
kotlin("plugin.compose") apply false
kotlin("android") apply false kotlin("android") apply false
id("com.android.application") apply false id("com.android.application") apply false
id("com.android.library") apply false id("com.android.library") apply false

1
examples/graphics-2d/desktopApp/build.gradle.kts

@ -2,6 +2,7 @@ import org.jetbrains.compose.desktop.application.dsl.TargetFormat
plugins { plugins {
kotlin("multiplatform") kotlin("multiplatform")
kotlin("plugin.compose")
id("org.jetbrains.compose") id("org.jetbrains.compose")
} }

4
examples/graphics-2d/gradle.properties

@ -1,7 +1,7 @@
kotlin.code.style=official kotlin.code.style=official
xcodeproj=./iosApp xcodeproj=./iosApp
android.useAndroidX=true android.useAndroidX=true
org.gradle.jvmargs=-Xmx3g org.gradle.jvmargs=-Xmx8g
org.gradle.configuration-cache=true org.gradle.configuration-cache=true
org.gradle.caching=true org.gradle.caching=true
org.jetbrains.compose.experimental.jscanvas.enabled=true org.jetbrains.compose.experimental.jscanvas.enabled=true
@ -10,7 +10,7 @@ kotlin.native.useEmbeddableCompilerJar=true
kotlin.mpp.androidSourceSetLayoutVersion=2 kotlin.mpp.androidSourceSetLayoutVersion=2
# Enable kotlin/native experimental memory model # Enable kotlin/native experimental memory model
kotlin.native.binary.memoryModel=experimental kotlin.native.binary.memoryModel=experimental
kotlin.version=1.9.24 kotlin.version=2.0.0
agp.version=8.0.2 agp.version=8.0.2
compose.version=1.6.10 compose.version=1.6.10

6
examples/graphics-2d/jsApp/build.gradle.kts

@ -1,5 +1,6 @@
plugins { plugins {
kotlin("multiplatform") kotlin("multiplatform")
kotlin("plugin.compose")
id("org.jetbrains.compose") id("org.jetbrains.compose")
} }
@ -17,8 +18,3 @@ kotlin {
} }
} }
} }
compose.experimental {
web.application {}
}

6
examples/graphics-2d/jsApp/src/jsMain/kotlin/main.js.kt

@ -1,9 +1,11 @@
import androidx.compose.ui.window.Window import androidx.compose.ui.ExperimentalComposeUiApi
import androidx.compose.ui.window.CanvasBasedWindow
import org.jetbrains.skiko.wasm.onWasmReady import org.jetbrains.skiko.wasm.onWasmReady
@OptIn(ExperimentalComposeUiApi::class)
fun main() { fun main() {
onWasmReady { onWasmReady {
Window("Graphics2D") { CanvasBasedWindow(title = "Graphics2D") {
MainView() MainView()
} }
} }

1
examples/graphics-2d/settings.gradle.kts

@ -12,6 +12,7 @@ pluginManagement {
kotlin("jvm").version(kotlinVersion) kotlin("jvm").version(kotlinVersion)
kotlin("multiplatform").version(kotlinVersion) kotlin("multiplatform").version(kotlinVersion)
kotlin("plugin.compose").version(kotlinVersion)
kotlin("android").version(kotlinVersion) kotlin("android").version(kotlinVersion)
id("com.android.base").version(agpVersion) id("com.android.base").version(agpVersion)
id("com.android.application").version(agpVersion) id("com.android.application").version(agpVersion)

1
examples/graphics-2d/shared/build.gradle.kts

@ -1,6 +1,7 @@
plugins { plugins {
kotlin("multiplatform") kotlin("multiplatform")
kotlin("plugin.compose")
id("com.android.library") id("com.android.library")
id("org.jetbrains.compose") id("org.jetbrains.compose")
} }

1
examples/html/compose-bird/build.gradle.kts

@ -2,6 +2,7 @@ import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension
plugins { plugins {
kotlin("multiplatform") kotlin("multiplatform")
kotlin("plugin.compose")
id("org.jetbrains.compose") id("org.jetbrains.compose")
} }
group = "com.theapache64.composebird" group = "com.theapache64.composebird"

2
examples/html/compose-bird/gradle.properties

@ -1,5 +1,5 @@
kotlin.code.style=official kotlin.code.style=official
kotlin.version=1.9.24 kotlin.version=2.0.0
compose.version=1.6.10 compose.version=1.6.10
org.gradle.configuration-cache=true org.gradle.configuration-cache=true
org.gradle.caching=true org.gradle.caching=true

1
examples/html/compose-bird/settings.gradle.kts

@ -7,6 +7,7 @@ pluginManagement {
plugins { plugins {
kotlin("multiplatform").version(extra["kotlin.version"] as String) kotlin("multiplatform").version(extra["kotlin.version"] as String)
kotlin("plugin.compose").version(extra["kotlin.version"] as String)
id("org.jetbrains.compose").version(extra["compose.version"] as String) id("org.jetbrains.compose").version(extra["compose.version"] as String)
} }
} }

11
examples/html/compose-in-js/build.gradle.kts

@ -1,5 +1,6 @@
plugins { plugins {
kotlin("multiplatform") kotlin("multiplatform")
kotlin("plugin.compose")
id("org.jetbrains.compose") id("org.jetbrains.compose")
} }
@ -41,13 +42,3 @@ kotlin {
} }
} }
afterEvaluate {
rootProject.extensions.configure<org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension> {
nodeVersion = "16.0.0"
}
rootProject.plugins.withType(org.jetbrains.kotlin.gradle.targets.js.yarn.YarnPlugin::class.java) {
rootProject.the<org.jetbrains.kotlin.gradle.targets.js.yarn.YarnRootExtension>().resolution("colors", "1.4.0")
}
}

2
examples/html/compose-in-js/gradle.properties

@ -1,6 +1,6 @@
kotlin.code.style=official kotlin.code.style=official
kotlin.js.webpack.major.version=4 kotlin.js.webpack.major.version=4
kotlin.version=1.9.24 kotlin.version=2.0.0
compose.version=1.6.10 compose.version=1.6.10
org.gradle.configuration-cache=true org.gradle.configuration-cache=true
org.gradle.caching=true org.gradle.caching=true

1
examples/html/compose-in-js/settings.gradle.kts

@ -6,6 +6,7 @@ pluginManagement {
plugins { plugins {
kotlin("multiplatform").version(extra["kotlin.version"] as String) kotlin("multiplatform").version(extra["kotlin.version"] as String)
kotlin("plugin.compose").version(extra["kotlin.version"] as String)
id("org.jetbrains.compose").version(extra["compose.version"] as String) id("org.jetbrains.compose").version(extra["compose.version"] as String)
} }
} }

9
examples/html/landing/build.gradle.kts

@ -2,6 +2,7 @@ import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension
plugins { plugins {
kotlin("multiplatform") kotlin("multiplatform")
kotlin("plugin.compose")
id("org.jetbrains.compose") id("org.jetbrains.compose")
} }
@ -27,11 +28,3 @@ kotlin {
} }
} }
} }
// a temporary workaround for a bug in jsRun invocation - see https://youtrack.jetbrains.com/issue/KT-48273
afterEvaluate {
rootProject.extensions.configure<NodeJsRootExtension> {
versions.webpackDevServer.version = "4.0.0"
versions.webpackCli.version = "4.10.0"
}
}

2
examples/html/landing/gradle.properties

@ -1,5 +1,5 @@
kotlin.code.style=official kotlin.code.style=official
kotlin.version=1.9.24 kotlin.version=2.0.0
compose.version=1.6.10 compose.version=1.6.10
org.gradle.configuration-cache=true org.gradle.configuration-cache=true
org.gradle.caching=true org.gradle.caching=true

1
examples/html/landing/settings.gradle.kts

@ -7,6 +7,7 @@ pluginManagement {
plugins { plugins {
kotlin("multiplatform").version(extra["kotlin.version"] as String) kotlin("multiplatform").version(extra["kotlin.version"] as String)
kotlin("plugin.compose").version(extra["kotlin.version"] as String)
id("org.jetbrains.compose").version(extra["compose.version"] as String) id("org.jetbrains.compose").version(extra["compose.version"] as String)
} }
} }

8
examples/html/with-react/build.gradle.kts

@ -1,6 +1,7 @@
import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension
plugins { plugins {
kotlin("multiplatform") kotlin("multiplatform")
kotlin("plugin.compose")
id("org.jetbrains.compose") id("org.jetbrains.compose")
} }
@ -32,10 +33,3 @@ kotlin {
} }
} }
// a temporary workaround for a bug in jsRun invocation - see https://youtrack.jetbrains.com/issue/KT-48273
afterEvaluate {
rootProject.extensions.configure<NodeJsRootExtension> {
versions.webpackDevServer.version = "4.0.0"
versions.webpackCli.version = "4.10.0"
}
}

2
examples/html/with-react/gradle.properties

@ -1,5 +1,5 @@
kotlin.code.style=official kotlin.code.style=official
kotlin.version=1.9.24 kotlin.version=2.0.0
compose.version=1.6.10 compose.version=1.6.10
org.gradle.configuration-cache=true org.gradle.configuration-cache=true
org.gradle.caching=true org.gradle.caching=true

1
examples/html/with-react/settings.gradle.kts

@ -7,6 +7,7 @@ pluginManagement {
plugins { plugins {
kotlin("multiplatform").version(extra["kotlin.version"] as String) kotlin("multiplatform").version(extra["kotlin.version"] as String)
kotlin("plugin.compose").version(extra["kotlin.version"] as String)
id("org.jetbrains.compose").version(extra["compose.version"] as String) id("org.jetbrains.compose").version(extra["compose.version"] as String)
} }
} }

1
examples/imageviewer/androidApp/build.gradle.kts

@ -1,5 +1,6 @@
plugins { plugins {
kotlin("multiplatform") kotlin("multiplatform")
kotlin("plugin.compose")
id("com.android.application") id("com.android.application")
id("org.jetbrains.compose") id("org.jetbrains.compose")
id("com.google.android.libraries.mapsplatform.secrets-gradle-plugin") version "2.0.1" id("com.google.android.libraries.mapsplatform.secrets-gradle-plugin") version "2.0.1"

1
examples/imageviewer/desktopApp/build.gradle.kts

@ -2,6 +2,7 @@ import org.jetbrains.compose.desktop.application.dsl.TargetFormat
plugins { plugins {
kotlin("multiplatform") kotlin("multiplatform")
kotlin("plugin.compose")
id("org.jetbrains.compose") id("org.jetbrains.compose")
} }

8
examples/imageviewer/gradle.properties

@ -1,15 +1,13 @@
kotlin.code.style=official kotlin.code.style=official
xcodeproj=iosApp xcodeproj=iosApp
android.useAndroidX=true android.useAndroidX=true
org.gradle.jvmargs=-Xmx3g org.gradle.jvmargs=-Xmx8g
# TODO: enable configuration cache once we update on kotlin 2.0 org.gradle.configuration-cache=true
# see https://youtrack.jetbrains.com/issue/KT-64851 (k/wasm issue)
org.gradle.configuration-cache=false
org.gradle.caching=true org.gradle.caching=true
org.jetbrains.compose.experimental.jscanvas.enabled=true org.jetbrains.compose.experimental.jscanvas.enabled=true
org.jetbrains.compose.experimental.macos.enabled=true org.jetbrains.compose.experimental.macos.enabled=true
org.jetbrains.compose.experimental.wasm.enabled=true org.jetbrains.compose.experimental.wasm.enabled=true
kotlin.version=1.9.24 kotlin.version=2.0.0
agp.version=8.0.2 agp.version=8.0.2
compose.version=1.6.10 compose.version=1.6.10

544
examples/imageviewer/kotlin-js-store/yarn.lock

File diff suppressed because it is too large Load Diff

1
examples/imageviewer/mapview-desktop/build.gradle.kts

@ -1,5 +1,6 @@
plugins { plugins {
kotlin("multiplatform") kotlin("multiplatform")
kotlin("plugin.compose")
id("org.jetbrains.compose") id("org.jetbrains.compose")
kotlin("plugin.serialization") kotlin("plugin.serialization")
} }

1
examples/imageviewer/settings.gradle.kts

@ -12,6 +12,7 @@ pluginManagement {
kotlin("jvm").version(kotlinVersion) kotlin("jvm").version(kotlinVersion)
kotlin("multiplatform").version(kotlinVersion) kotlin("multiplatform").version(kotlinVersion)
kotlin("plugin.compose").version(kotlinVersion)
kotlin("plugin.serialization").version(kotlinVersion) kotlin("plugin.serialization").version(kotlinVersion)
kotlin("android").version(kotlinVersion) kotlin("android").version(kotlinVersion)
id("com.android.base").version(agpVersion) id("com.android.base").version(agpVersion)

1
examples/imageviewer/shared/build.gradle.kts

@ -1,5 +1,6 @@
plugins { plugins {
kotlin("multiplatform") kotlin("multiplatform")
kotlin("plugin.compose")
id("com.android.library") id("com.android.library")
id("org.jetbrains.compose") id("org.jetbrains.compose")
kotlin("plugin.serialization") kotlin("plugin.serialization")

28
examples/imageviewer/webApp/build.gradle.kts

@ -1,32 +1,13 @@
import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl
import org.jetbrains.kotlin.gradle.targets.js.ir.DefaultIncrementalSyncTask import org.jetbrains.kotlin.gradle.targets.js.ir.DefaultIncrementalSyncTask
import org.jetbrains.kotlin.gradle.targets.js.webpack.KotlinWebpackConfig import org.jetbrains.kotlin.gradle.targets.js.webpack.KotlinWebpackConfig
plugins { plugins {
kotlin("multiplatform") kotlin("multiplatform")
kotlin("plugin.compose")
id("org.jetbrains.compose") id("org.jetbrains.compose")
} }
val copyJsResources = tasks.create("copyJsResourcesWorkaround", Copy::class.java) {
from(project(":shared").file("src/commonMain/composeResources"))
into("build/processedResources/js/main")
}
tasks.withType<DefaultIncrementalSyncTask> {
dependsOn(copyJsResources)
}
val copyWasmResources = tasks.create("copyWasmResourcesWorkaround", Copy::class.java) {
from(project(":shared").file("src/commonMain/composeResources"))
into("build/processedResources/wasmJs/main")
}
afterEvaluate {
project.tasks.getByName("jsProcessResources").finalizedBy(copyJsResources)
project.tasks.getByName("wasmJsProcessResources").finalizedBy(copyWasmResources)
project.tasks.getByName("wasmJsDevelopmentExecutableCompileSync").dependsOn(copyWasmResources)
project.tasks.getByName("wasmJsProductionExecutableCompileSync").dependsOn(copyWasmResources)
}
val rootDirPath = project.rootDir.path val rootDirPath = project.rootDir.path
kotlin { kotlin {
@ -41,6 +22,7 @@ kotlin {
useEsModules() useEsModules()
} }
@OptIn(ExperimentalWasmDsl::class)
wasmJs { wasmJs {
moduleName = "imageviewer" moduleName = "imageviewer"
browser { browser {
@ -78,7 +60,3 @@ kotlin {
} }
} }
} }
compose.experimental {
web.application {}
}

1
examples/intellij-plugin/build.gradle.kts

@ -2,6 +2,7 @@ plugins {
id("org.jetbrains.intellij") version "1.17.2" id("org.jetbrains.intellij") version "1.17.2"
java java
kotlin("jvm") kotlin("jvm")
kotlin("plugin.compose")
id("org.jetbrains.compose") id("org.jetbrains.compose")
id("idea") id("idea")
} }

2
examples/intellij-plugin/gradle.properties

@ -1,5 +1,5 @@
kotlin.code.style=official kotlin.code.style=official
kotlin.version=1.9.24 kotlin.version=2.0.0
compose.version=1.6.10 compose.version=1.6.10
org.gradle.configuration-cache=true org.gradle.configuration-cache=true
org.gradle.caching=true org.gradle.caching=true

1
examples/intellij-plugin/settings.gradle.kts

@ -3,6 +3,7 @@ rootProject.name = "ComposeDemoPlugin"
pluginManagement { pluginManagement {
plugins { plugins {
kotlin("jvm").version(extra["kotlin.version"] as String) kotlin("jvm").version(extra["kotlin.version"] as String)
kotlin("plugin.compose").version(extra["kotlin.version"] as String)
id("org.jetbrains.compose").version(extra["compose.version"] as String) id("org.jetbrains.compose").version(extra["compose.version"] as String)
} }
} }

1
examples/interop/ios-compose-in-swiftui/build.gradle.kts

@ -2,6 +2,7 @@ plugins {
// this is necessary to avoid the plugins to be loaded multiple times // this is necessary to avoid the plugins to be loaded multiple times
// in each subproject's classloader // in each subproject's classloader
kotlin("multiplatform") apply false kotlin("multiplatform") apply false
kotlin("plugin.compose") apply false
id("org.jetbrains.compose") apply false id("org.jetbrains.compose") apply false
} }

2
examples/interop/ios-compose-in-swiftui/gradle.properties

@ -1,5 +1,5 @@
kotlin.code.style=official kotlin.code.style=official
xcodeproj=./iosApp xcodeproj=./iosApp
org.gradle.jvmargs=-Xmx3g org.gradle.jvmargs=-Xmx3g
kotlin.version=1.9.24 kotlin.version=2.0.0
compose.version=1.6.10 compose.version=1.6.10

1
examples/interop/ios-compose-in-swiftui/settings.gradle.kts

@ -10,6 +10,7 @@ pluginManagement {
val composeVersion = extra["compose.version"] as String val composeVersion = extra["compose.version"] as String
kotlin("multiplatform").version(kotlinVersion) kotlin("multiplatform").version(kotlinVersion)
kotlin("plugin.compose").version(kotlinVersion)
id("org.jetbrains.compose").version(composeVersion) id("org.jetbrains.compose").version(composeVersion)
} }
} }

1
examples/interop/ios-compose-in-swiftui/shared/build.gradle.kts

@ -2,6 +2,7 @@
plugins { plugins {
kotlin("multiplatform") kotlin("multiplatform")
kotlin("plugin.compose")
id("org.jetbrains.compose") id("org.jetbrains.compose")
} }

1
examples/interop/ios-compose-in-uikit/build.gradle.kts

@ -2,6 +2,7 @@ plugins {
// this is necessary to avoid the plugins to be loaded multiple times // this is necessary to avoid the plugins to be loaded multiple times
// in each subproject's classloader // in each subproject's classloader
kotlin("multiplatform") apply false kotlin("multiplatform") apply false
kotlin("plugin.compose") apply false
id("org.jetbrains.compose") apply false id("org.jetbrains.compose") apply false
} }

2
examples/interop/ios-compose-in-uikit/gradle.properties

@ -3,5 +3,5 @@ xcodeproj=./iosApp
org.gradle.jvmargs=-Xmx3g org.gradle.jvmargs=-Xmx3g
# Enable kotlin/native experimental memory model # Enable kotlin/native experimental memory model
kotlin.native.binary.memoryModel=experimental kotlin.native.binary.memoryModel=experimental
kotlin.version=1.9.24 kotlin.version=2.0.0
compose.version=1.6.10 compose.version=1.6.10

1
examples/interop/ios-compose-in-uikit/settings.gradle.kts

@ -10,6 +10,7 @@ pluginManagement {
val composeVersion = extra["compose.version"] as String val composeVersion = extra["compose.version"] as String
kotlin("multiplatform").version(kotlinVersion) kotlin("multiplatform").version(kotlinVersion)
kotlin("plugin.compose").version(kotlinVersion)
id("org.jetbrains.compose").version(composeVersion) id("org.jetbrains.compose").version(composeVersion)
} }
} }

1
examples/interop/ios-compose-in-uikit/shared/build.gradle.kts

@ -2,6 +2,7 @@
plugins { plugins {
kotlin("multiplatform") kotlin("multiplatform")
kotlin("plugin.compose")
id("org.jetbrains.compose") id("org.jetbrains.compose")
} }

1
examples/interop/ios-swiftui-in-compose/build.gradle.kts

@ -2,6 +2,7 @@ plugins {
// this is necessary to avoid the plugins to be loaded multiple times // this is necessary to avoid the plugins to be loaded multiple times
// in each subproject's classloader // in each subproject's classloader
kotlin("multiplatform") apply false kotlin("multiplatform") apply false
kotlin("plugin.compose") apply false
id("org.jetbrains.compose") apply false id("org.jetbrains.compose") apply false
} }

2
examples/interop/ios-swiftui-in-compose/gradle.properties

@ -3,5 +3,5 @@ xcodeproj=./iosApp
org.gradle.jvmargs=-Xmx3g org.gradle.jvmargs=-Xmx3g
# Enable kotlin/native experimental memory model # Enable kotlin/native experimental memory model
kotlin.native.binary.memoryModel=experimental kotlin.native.binary.memoryModel=experimental
kotlin.version=1.9.24 kotlin.version=2.0.0
compose.version=1.6.10 compose.version=1.6.10

1
examples/interop/ios-swiftui-in-compose/settings.gradle.kts

@ -10,6 +10,7 @@ pluginManagement {
val composeVersion = extra["compose.version"] as String val composeVersion = extra["compose.version"] as String
kotlin("multiplatform").version(kotlinVersion) kotlin("multiplatform").version(kotlinVersion)
kotlin("plugin.compose").version(kotlinVersion)
id("org.jetbrains.compose").version(composeVersion) id("org.jetbrains.compose").version(composeVersion)
} }
} }

1
examples/interop/ios-swiftui-in-compose/shared/build.gradle.kts

@ -2,6 +2,7 @@
plugins { plugins {
kotlin("multiplatform") kotlin("multiplatform")
kotlin("plugin.compose")
id("org.jetbrains.compose") id("org.jetbrains.compose")
} }

1
examples/interop/ios-uikit-in-compose/build.gradle.kts

@ -2,6 +2,7 @@ plugins {
// this is necessary to avoid the plugins to be loaded multiple times // this is necessary to avoid the plugins to be loaded multiple times
// in each subproject's classloader // in each subproject's classloader
kotlin("multiplatform") apply false kotlin("multiplatform") apply false
kotlin("plugin.compose") apply false
id("org.jetbrains.compose") apply false id("org.jetbrains.compose") apply false
} }

2
examples/interop/ios-uikit-in-compose/gradle.properties

@ -3,5 +3,5 @@ xcodeproj=./iosApp
org.gradle.jvmargs=-Xmx3g org.gradle.jvmargs=-Xmx3g
# Enable kotlin/native experimental memory model # Enable kotlin/native experimental memory model
kotlin.native.binary.memoryModel=experimental kotlin.native.binary.memoryModel=experimental
kotlin.version=1.9.24 kotlin.version=2.0.0
compose.version=1.6.10 compose.version=1.6.10

1
examples/interop/ios-uikit-in-compose/settings.gradle.kts

@ -10,6 +10,7 @@ pluginManagement {
val composeVersion = extra["compose.version"] as String val composeVersion = extra["compose.version"] as String
kotlin("multiplatform").version(kotlinVersion) kotlin("multiplatform").version(kotlinVersion)
kotlin("plugin.compose").version(kotlinVersion)
id("org.jetbrains.compose").version(composeVersion) id("org.jetbrains.compose").version(composeVersion)
} }
} }

1
examples/interop/ios-uikit-in-compose/shared/build.gradle.kts

@ -2,6 +2,7 @@
plugins { plugins {
kotlin("multiplatform") kotlin("multiplatform")
kotlin("plugin.compose")
id("org.jetbrains.compose") id("org.jetbrains.compose")
} }

1
examples/issues/android/build.gradle.kts

@ -1,6 +1,7 @@
plugins { plugins {
id("com.android.application") id("com.android.application")
kotlin("android") kotlin("android")
kotlin("plugin.compose")
id("org.jetbrains.compose") id("org.jetbrains.compose")
} }

1
examples/issues/build.gradle.kts

@ -3,6 +3,7 @@ plugins {
// in each subproject's classloader // in each subproject's classloader
kotlin("jvm") apply false kotlin("jvm") apply false
kotlin("multiplatform") apply false kotlin("multiplatform") apply false
kotlin("plugin.compose") apply false
kotlin("android") apply false kotlin("android") apply false
id("com.android.application") apply false id("com.android.application") apply false
id("com.android.library") apply false id("com.android.library") apply false

1
examples/issues/common/build.gradle.kts

@ -1,6 +1,7 @@
plugins { plugins {
id("com.android.library") id("com.android.library")
kotlin("multiplatform") kotlin("multiplatform")
kotlin("plugin.compose")
id("org.jetbrains.compose") id("org.jetbrains.compose")
id("com.apollographql.apollo").version("2.3.0") id("com.apollographql.apollo").version("2.3.0")
} }

1
examples/issues/desktop/build.gradle.kts

@ -2,6 +2,7 @@ import org.jetbrains.compose.desktop.application.dsl.TargetFormat
plugins { plugins {
kotlin("multiplatform") // kotlin("jvm") doesn't work well in IDEA/AndroidStudio (https://github.com/JetBrains/compose-jb/issues/22) kotlin("multiplatform") // kotlin("jvm") doesn't work well in IDEA/AndroidStudio (https://github.com/JetBrains/compose-jb/issues/22)
kotlin("plugin.compose")
id("org.jetbrains.compose") id("org.jetbrains.compose")
} }

2
examples/issues/gradle.properties

@ -19,6 +19,6 @@ kotlin.code.style=official
android.useAndroidX=true android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX # Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true android.enableJetifier=true
kotlin.version=1.9.24 kotlin.version=2.0.0
agp.version=8.0.2 agp.version=8.0.2
compose.version=1.6.10 compose.version=1.6.10

1
examples/issues/settings.gradle.kts

@ -12,6 +12,7 @@ pluginManagement {
kotlin("jvm").version(kotlinVersion) kotlin("jvm").version(kotlinVersion)
kotlin("multiplatform").version(kotlinVersion) kotlin("multiplatform").version(kotlinVersion)
kotlin("plugin.compose").version(kotlinVersion)
kotlin("android").version(kotlinVersion) kotlin("android").version(kotlinVersion)
id("com.android.application").version(agpVersion) id("com.android.application").version(agpVersion)
id("com.android.library").version(agpVersion) id("com.android.library").version(agpVersion)

1
examples/jetsnack/android/build.gradle.kts

@ -1,5 +1,6 @@
plugins { plugins {
id("org.jetbrains.compose") id("org.jetbrains.compose")
kotlin("plugin.compose")
id("com.android.application") id("com.android.application")
kotlin("android") kotlin("android")
} }

1
examples/jetsnack/build.gradle.kts

@ -13,6 +13,7 @@ allprojects {
plugins { plugins {
kotlin("multiplatform") apply false kotlin("multiplatform") apply false
kotlin("plugin.compose") apply false
kotlin("android") apply false kotlin("android") apply false
id("com.android.application") apply false id("com.android.application") apply false
id("com.android.library") apply false id("com.android.library") apply false

1
examples/jetsnack/common/build.gradle.kts

@ -2,6 +2,7 @@ import org.jetbrains.compose.compose
plugins { plugins {
kotlin("multiplatform") kotlin("multiplatform")
kotlin("plugin.compose")
id("org.jetbrains.compose") id("org.jetbrains.compose")
id("com.android.library") id("com.android.library")
} }

3
examples/jetsnack/common/src/nonAndroidMain/kotlin/com/example/jetsnack/ui/MppJetsnackAppState.kt

@ -6,8 +6,11 @@ import androidx.compose.runtime.*
import com.example.jetsnack.model.SnackbarManager import com.example.jetsnack.model.SnackbarManager
import com.example.jetsnack.ui.home.HomeSections import com.example.jetsnack.ui.home.HomeSections
import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.CoroutineScope
import kotlin.native.HiddenFromObjC
@Stable @Stable
@OptIn(kotlin.experimental.ExperimentalObjCRefinement::class)
@HiddenFromObjC // Remove after the bug is fixed: https://github.com/JetBrains/compose-multiplatform/issues/4848
actual class MppJetsnackAppState( actual class MppJetsnackAppState(
actual val scaffoldState: ScaffoldState, actual val scaffoldState: ScaffoldState,
actual val snackbarManager: SnackbarManager, actual val snackbarManager: SnackbarManager,

3
examples/jetsnack/common/src/nonAndroidMain/kotlin/com/example/jetsnack/ui/home/cart/CartViewModel.nonAndroid.kt

@ -5,7 +5,10 @@ import androidx.compose.runtime.State
import androidx.compose.runtime.collectAsState import androidx.compose.runtime.collectAsState
import com.example.jetsnack.model.OrderLine import com.example.jetsnack.model.OrderLine
import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.StateFlow
import kotlin.native.HiddenFromObjC
@OptIn(kotlin.experimental.ExperimentalObjCRefinement::class)
@HiddenFromObjC // Remove after the bug is fixed: https://github.com/JetBrains/compose-multiplatform/issues/4848
actual abstract class JetSnackCartViewModel actual constructor() { actual abstract class JetSnackCartViewModel actual constructor() {
@Composable @Composable

1
examples/jetsnack/desktop/build.gradle.kts

@ -4,6 +4,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins { plugins {
kotlin("multiplatform") kotlin("multiplatform")
kotlin("plugin.compose")
id("org.jetbrains.compose") id("org.jetbrains.compose")
} }

11
examples/jetsnack/gradle.properties

@ -1,13 +1,6 @@
org.gradle.jvmargs=-Xmx3g org.gradle.jvmargs=-Xmx8g
kotlin.code.style=official kotlin.code.style=official
android.useAndroidX=true android.useAndroidX=true
agp.version=8.0.2 agp.version=8.0.2
kotlin.version=1.9.24 kotlin.version=2.0.0
compose.version=1.6.10 compose.version=1.6.10
# TODO: enable configuration cache once we update on kotlin 2.0
# see https://youtrack.jetbrains.com/issue/KT-64851 (k/wasm issue)
org.gradle.configuration-cache=false
#Compose for Web is Experimental
org.jetbrains.compose.experimental.wasm.enabled=true

810
examples/jetsnack/kotlin-js-store/yarn.lock

File diff suppressed because it is too large Load Diff

1
examples/jetsnack/settings.gradle.kts

@ -12,6 +12,7 @@ pluginManagement {
val composeVersion = extra["compose.version"] as String val composeVersion = extra["compose.version"] as String
kotlin("multiplatform").version(kotlinVersion) kotlin("multiplatform").version(kotlinVersion)
kotlin("plugin.compose").version(kotlinVersion)
kotlin("android").version(kotlinVersion) kotlin("android").version(kotlinVersion)
id("com.android.application").version(agpVersion) id("com.android.application").version(agpVersion)
id("com.android.library").version(agpVersion) id("com.android.library").version(agpVersion)

5
examples/jetsnack/web/build.gradle.kts

@ -2,6 +2,7 @@ import org.jetbrains.kotlin.gradle.targets.js.webpack.KotlinWebpackConfig
plugins { plugins {
kotlin("multiplatform") kotlin("multiplatform")
kotlin("plugin.compose")
id("org.jetbrains.compose") id("org.jetbrains.compose")
} }
@ -45,7 +46,3 @@ kotlin {
} }
} }
} }
compose.experimental {
web.application {}
}

2
examples/jetsnack/web/webpack.config.d/cleanupSourcemap.js

@ -6,7 +6,7 @@
const outDir = __dirname + "/kotlin/" const outDir = __dirname + "/kotlin/"
const projecName = path.basename(__dirname); const projecName = path.basename(__dirname);
const mapFile = outDir + projecName + ".map" const mapFile = outDir + projecName + ".wasm.map"
const sourcemap = JSON.parse(fs.readFileSync(mapFile)) const sourcemap = JSON.parse(fs.readFileSync(mapFile))
const sources = sourcemap["sources"] const sources = sourcemap["sources"]

5
examples/nav_cupcake/gradle.properties

@ -1,16 +1,13 @@
kotlin.code.style=official kotlin.code.style=official
#Gradle #Gradle
org.gradle.jvmargs=-Xmx4G -Dfile.encoding=UTF-8 -Dkotlin.daemon.jvm.options\="-Xmx4G" org.gradle.jvmargs=-Xmx8G -Dfile.encoding=UTF-8 -Dkotlin.daemon.jvm.options\="-Xmx8G"
#Android #Android
android.nonTransitiveRClass=true android.nonTransitiveRClass=true
android.useAndroidX=true android.useAndroidX=true
#Compose
org.jetbrains.compose.experimental.wasm.enabled=true
#MPP #MPP
kotlin.mpp.androidSourceSetLayoutVersion=2 kotlin.mpp.androidSourceSetLayoutVersion=2
kotlin.mpp.enableCInteropCommonization=true kotlin.mpp.enableCInteropCommonization=true

4
examples/nav_cupcake/gradle/libs.versions.toml

@ -7,9 +7,9 @@ androidx-activity = "1.8.2"
androidx-lifecycle = "2.8.0-rc03" androidx-lifecycle = "2.8.0-rc03"
androidx-navigation = "2.7.0-alpha06" androidx-navigation = "2.7.0-alpha06"
compose-android = "1.6.7" compose-android = "1.6.7"
compose-multiplatform = "1.6.10-rc03" compose-multiplatform = "1.6.10"
junit = "4.13.2" junit = "4.13.2"
kotlin = "2.0.0-RC3" kotlin = "2.0.0"
kotlinx-datetime = "0.6.0" kotlinx-datetime = "0.6.0"
[libraries] [libraries]

3
examples/notepad/build.gradle.kts

@ -2,6 +2,7 @@ import org.jetbrains.compose.desktop.application.dsl.TargetFormat
plugins { plugins {
kotlin("jvm") kotlin("jvm")
kotlin("plugin.compose")
id("org.jetbrains.compose") id("org.jetbrains.compose")
} }
@ -14,7 +15,7 @@ repositories {
dependencies { dependencies {
implementation(compose.desktop.currentOs) implementation(compose.desktop.currentOs)
implementation(compose.materialIconsExtended) implementation(compose.materialIconsExtended)
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-swing:1.6.0") implementation("org.jetbrains.kotlinx:kotlinx-coroutines-swing:1.8.0")
} }
compose.desktop { compose.desktop {

2
examples/notepad/gradle.properties

@ -1,6 +1,6 @@
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
kotlin.code.style=official kotlin.code.style=official
kotlin.version=1.9.24 kotlin.version=2.0.0
compose.version=1.6.10 compose.version=1.6.10
org.gradle.configuration-cache=true org.gradle.configuration-cache=true
org.gradle.caching=true org.gradle.caching=true

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save