From dbd0a21949633302fcf98ad79c78896bbc6250ba Mon Sep 17 00:00:00 2001 From: Igor Demin Date: Wed, 8 Dec 2021 10:32:18 +0300 Subject: [PATCH] Modify replace.sh for replacing Compose version (#1511) Remove: ``` __LATEST_COMPOSE_RELEASE_VERSION__ __KOTLIN_COMPOSE_VERSION__ System.getenv("COMPOSE_TEMPLATE_COMPOSE_VERSION") ``` They pollute templates/examples. Now, all paths where we need to change the version are hardcoded in the script. Usage: ``` ./replace.sh 1.0.0-rc6 ``` This script is planned to run on CI In the future I will add support for changing Kotlin version --- benchmarks/build.gradle.kts | 3 - ci/compose-uber-jar/gradle.properties | 1 - components/build.gradle.kts | 16 ----- components/gradle.properties | 5 +- components/settings.gradle.kts | 14 +++++ examples/codeviewer/build.gradle.kts | 17 ------ examples/codeviewer/gradle.properties | 5 +- examples/codeviewer/settings.gradle.kts | 21 +++++++ examples/falling-balls-web/build.gradle.kts | 4 +- examples/falling-balls-web/gradle.properties | 2 + .../falling-balls-web/settings.gradle.kts | 8 ++- .../src/jvmMain/kotlin/App.kt | 9 ++- .../src/jvmMain/kotlin/modifiers/position.kt | 2 +- examples/falling-balls/build.gradle.kts | 6 +- examples/falling-balls/gradle.properties | 2 + examples/falling-balls/settings.gradle.kts | 7 +++ examples/imageviewer/build.gradle.kts | 15 ----- examples/imageviewer/gradle.properties | 5 +- examples/imageviewer/settings.gradle.kts | 21 +++++++ examples/intellij-plugin/build.gradle.kts | 5 +- examples/intellij-plugin/gradle.properties | 4 +- examples/intellij-plugin/settings.gradle.kts | 9 ++- examples/issues/build.gradle.kts | 17 ------ examples/issues/gradle.properties | 5 +- examples/issues/settings.gradle.kts | 21 +++++++ examples/notepad/build.gradle.kts | 6 +- examples/notepad/gradle.properties | 4 +- examples/notepad/settings.gradle.kts | 7 ++- examples/todoapp-lite/build.gradle.kts | 15 ----- examples/todoapp-lite/gradle.properties | 5 +- examples/todoapp-lite/settings.gradle.kts | 21 +++++++ examples/todoapp/buildSrc/build.gradle.kts | 4 +- .../buildSrc/buildSrc/src/main/kotlin/Deps.kt | 29 +++++---- examples/todoapp/buildSrc/gradle.properties | 2 + .../kotlin/multiplatform-setup.gradle.kts | 10 ++-- examples/visual-effects/build.gradle.kts | 6 +- examples/visual-effects/gradle.properties | 2 + examples/visual-effects/settings.gradle.kts | 11 ++-- examples/web-compose-bird/build.gradle.kts | 4 +- examples/web-compose-bird/gradle.properties | 2 + examples/web-compose-bird/settings.gradle.kts | 8 ++- examples/web-landing/build.gradle.kts | 4 +- examples/web-landing/gradle.properties | 4 +- examples/web-landing/settings.gradle.kts | 8 ++- examples/web-with-react/build.gradle.kts | 4 +- examples/web-with-react/gradle.properties | 4 +- examples/web-with-react/settings.gradle.kts | 7 ++- examples/widgets-gallery/build.gradle.kts | 17 ------ examples/widgets-gallery/gradle.properties | 5 +- examples/widgets-gallery/settings.gradle.kts | 21 +++++++ .../build_and_run_from_cli_example.sh | 2 - experimental/cef/build.gradle.kts | 2 - experimental/components/build.gradle.kts | 1 - experimental/components/gradle.properties | 2 - .../lwjgl-integration/build.gradle.kts | 4 +- gradle-plugins/build.gradle.kts | 1 - .../compose/test/TestKotlinVersion.kt | 1 - gradle-plugins/gradle.properties | 1 - .../simple-preview-example/build.gradle.kts | 2 - templates/desktop-template/build.gradle.kts | 6 +- templates/desktop-template/gradle.properties | 4 +- .../desktop-template/settings.gradle.kts | 7 ++- .../android/src/main/AndroidManifest.xml | 1 + .../multiplatform-template/build.gradle.kts | 18 ------ .../multiplatform-template/gradle.properties | 5 +- .../settings.gradle.kts | 17 ++++++ templates/web-template/build.gradle.kts | 8 +-- templates/web-template/gradle.properties | 4 +- templates/web-template/settings.gradle.kts | 5 ++ tools/replace.sh | 60 +++++++++++++++---- tutorials/Getting_Started/README.md | 2 +- tutorials/checker/build.gradle.kts | 23 +++++-- web/compose-compiler-integration/README.md | 5 +- web/gradle.properties | 1 - 74 files changed, 371 insertions(+), 245 deletions(-) create mode 100644 examples/falling-balls-web/gradle.properties create mode 100755 examples/todoapp/buildSrc/gradle.properties diff --git a/benchmarks/build.gradle.kts b/benchmarks/build.gradle.kts index 65f52ad948..ceda7f51d5 100644 --- a/benchmarks/build.gradle.kts +++ b/benchmarks/build.gradle.kts @@ -3,11 +3,8 @@ import kotlinx.benchmark.gradle.* import org.jetbrains.kotlin.allopen.gradle.* plugins { - // __KOTLIN_COMPOSE_VERSION__ kotlin("jvm") version "1.4.20" - // __LATEST_COMPOSE_RELEASE_VERSION__ id("org.jetbrains.compose") version "0.2.0-build132" - // __KOTLIN_COMPOSE_VERSION__ kotlin("plugin.allopen") version "1.4.20" id("kotlinx.benchmark") version "0.3.0" } diff --git a/ci/compose-uber-jar/gradle.properties b/ci/compose-uber-jar/gradle.properties index 5efcea40a8..4f1fed2253 100644 --- a/ci/compose-uber-jar/gradle.properties +++ b/ci/compose-uber-jar/gradle.properties @@ -1,3 +1,2 @@ -# __LATEST_COMPOSE_RELEASE_VERSION__ compose.version=1.0.0 kotlin.code.style=official diff --git a/components/build.gradle.kts b/components/build.gradle.kts index 73d20416c1..c75dd5b55d 100644 --- a/components/build.gradle.kts +++ b/components/build.gradle.kts @@ -1,19 +1,3 @@ -buildscript { - val composeVersion = property("compose.version") - - repositories { - google() - mavenCentral() - maven("https://maven.pkg.jetbrains.space/public/p/compose/dev") - } - - dependencies { - classpath("org.jetbrains.compose:compose-gradle-plugin:$composeVersion") - // __KOTLIN_COMPOSE_VERSION__ - classpath(kotlin("gradle-plugin", version = "1.5.31")) - } -} - subprojects { version = findProperty("deploy.version") ?: property("compose.version")!! diff --git a/components/gradle.properties b/components/gradle.properties index 7421193a8e..b9582acb89 100644 --- a/components/gradle.properties +++ b/components/gradle.properties @@ -2,6 +2,5 @@ org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 android.useAndroidX=true android.enableJetifier=true kotlin.code.style=official - -# __LATEST_COMPOSE_RELEASE_VERSION__ -compose.version=1.0.0 +kotlin.version=1.5.31 +compose.version=1.0.0 \ No newline at end of file diff --git a/components/settings.gradle.kts b/components/settings.gradle.kts index 562747a4c6..2e9fcc334b 100644 --- a/components/settings.gradle.kts +++ b/components/settings.gradle.kts @@ -1,2 +1,16 @@ +pluginManagement { + repositories { + gradlePluginPortal() + maven("https://maven.pkg.jetbrains.space/public/p/compose/dev") + google() + } + + plugins { + kotlin("jvm").version(extra["kotlin.version"] as String) + kotlin("multiplatform").version(extra["kotlin.version"] as String) + id("org.jetbrains.compose").version(extra["compose.version"] as String) + } +} + include(":SplitPane:library") include(":SplitPane:demo") \ No newline at end of file diff --git a/examples/codeviewer/build.gradle.kts b/examples/codeviewer/build.gradle.kts index eff6d09fe2..45172c70e6 100644 --- a/examples/codeviewer/build.gradle.kts +++ b/examples/codeviewer/build.gradle.kts @@ -1,20 +1,3 @@ -buildscript { - repositories { - mavenLocal() - google() - mavenCentral() - maven("https://maven.pkg.jetbrains.space/public/p/compose/dev") - } - - dependencies { - // __LATEST_COMPOSE_RELEASE_VERSION__ - classpath("org.jetbrains.compose:compose-gradle-plugin:1.0.0") - classpath("com.android.tools.build:gradle:4.2.2") - // __KOTLIN_COMPOSE_VERSION__ - classpath(kotlin("gradle-plugin", version = "1.5.31")) - } -} - allprojects { repositories { google() diff --git a/examples/codeviewer/gradle.properties b/examples/codeviewer/gradle.properties index 4d15d015f8..5f7597d432 100644 --- a/examples/codeviewer/gradle.properties +++ b/examples/codeviewer/gradle.properties @@ -18,4 +18,7 @@ android.useAndroidX=true # Automatically convert third-party libraries to use AndroidX android.enableJetifier=true # Kotlin code style for this project: "official" or "obsolete": -kotlin.code.style=official \ No newline at end of file +kotlin.code.style=official +kotlin.version=1.5.31 +agp.version=4.2.2 +compose.version=1.0.0 diff --git a/examples/codeviewer/settings.gradle.kts b/examples/codeviewer/settings.gradle.kts index 9a0d554e9b..f4ac8d1ff7 100644 --- a/examples/codeviewer/settings.gradle.kts +++ b/examples/codeviewer/settings.gradle.kts @@ -1 +1,22 @@ +pluginManagement { + repositories { + gradlePluginPortal() + maven("https://maven.pkg.jetbrains.space/public/p/compose/dev") + google() + } + + plugins { + val kotlinVersion = extra["kotlin.version"] as String + val agpVersion = extra["agp.version"] as String + val composeVersion = extra["compose.version"] as String + + kotlin("jvm").version(kotlinVersion) + kotlin("multiplatform").version(kotlinVersion) + kotlin("android").version(kotlinVersion) + id("com.android.application").version(agpVersion) + id("com.android.library").version(agpVersion) + id("org.jetbrains.compose").version(composeVersion) + } +} + include(":common", ":android", ":desktop") diff --git a/examples/falling-balls-web/build.gradle.kts b/examples/falling-balls-web/build.gradle.kts index e37db2d2d4..d471299de9 100644 --- a/examples/falling-balls-web/build.gradle.kts +++ b/examples/falling-balls-web/build.gradle.kts @@ -3,8 +3,8 @@ import org.jetbrains.compose.compose import org.jetbrains.compose.desktop.application.dsl.TargetFormat plugins { - kotlin("multiplatform") version "1.5.31" - id("org.jetbrains.compose") version "1.0.0" + kotlin("multiplatform") + id("org.jetbrains.compose") } version = "1.0-SNAPSHOT" diff --git a/examples/falling-balls-web/gradle.properties b/examples/falling-balls-web/gradle.properties new file mode 100644 index 0000000000..a161a21c41 --- /dev/null +++ b/examples/falling-balls-web/gradle.properties @@ -0,0 +1,2 @@ +kotlin.version=1.5.31 +compose.version=1.0.0 diff --git a/examples/falling-balls-web/settings.gradle.kts b/examples/falling-balls-web/settings.gradle.kts index 401f6cb417..bbbb65a6ae 100644 --- a/examples/falling-balls-web/settings.gradle.kts +++ b/examples/falling-balls-web/settings.gradle.kts @@ -2,10 +2,14 @@ pluginManagement { repositories { gradlePluginPortal() mavenCentral() - maven { url = uri("https://maven.pkg.jetbrains.space/public/p/compose/dev") } - google() + maven("https://maven.pkg.jetbrains.space/public/p/compose/dev") } + plugins { + kotlin("multiplatform").version(extra["kotlin.version"] as String) + id("org.jetbrains.compose").version(extra["compose.version"] as String) + } } + rootProject.name = "falling_balls_with_web" diff --git a/examples/falling-balls-web/src/jvmMain/kotlin/App.kt b/examples/falling-balls-web/src/jvmMain/kotlin/App.kt index f5550d29ec..d2eed65ca9 100644 --- a/examples/falling-balls-web/src/jvmMain/kotlin/App.kt +++ b/examples/falling-balls-web/src/jvmMain/kotlin/App.kt @@ -1,17 +1,16 @@ package org.jetbrains.compose.common.demo -import androidx.compose.desktop.Window -import androidx.compose.ui.unit.IntSize -import org.jetbrains.compose.demo.falling.views.fallingBalls -import org.jetbrains.compose.demo.falling.Game import androidx.compose.runtime.remember +import androidx.compose.ui.window.singleWindowApplication +import org.jetbrains.compose.demo.falling.Game +import org.jetbrains.compose.demo.falling.views.fallingBalls class JvmGame : Game() { override fun now() = System.nanoTime() } fun main() { - Window(title = "Demo", size = IntSize(600, 400)) { + singleWindowApplication(title = "Demo") { fallingBalls( remember { JvmGame().apply { diff --git a/examples/falling-balls-web/src/jvmMain/kotlin/modifiers/position.kt b/examples/falling-balls-web/src/jvmMain/kotlin/modifiers/position.kt index a73cbe5392..050e54b9fc 100644 --- a/examples/falling-balls-web/src/jvmMain/kotlin/modifiers/position.kt +++ b/examples/falling-balls-web/src/jvmMain/kotlin/modifiers/position.kt @@ -2,11 +2,11 @@ package org.jetbrains.compose.common.demo import androidx.compose.runtime.Composable import org.jetbrains.compose.common.ui.Modifier -import org.jetbrains.compose.common.foundation.layout.offset import org.jetbrains.compose.common.ui.unit.Dp import org.jetbrains.compose.common.internal.castOrCreate import org.jetbrains.compose.common.ui.unit.implementation import androidx.compose.foundation.layout.offset +import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi @Composable @OptIn(ExperimentalComposeWebWidgetsApi::class) diff --git a/examples/falling-balls/build.gradle.kts b/examples/falling-balls/build.gradle.kts index fa81282773..f368d90c3f 100644 --- a/examples/falling-balls/build.gradle.kts +++ b/examples/falling-balls/build.gradle.kts @@ -3,10 +3,8 @@ import org.jetbrains.compose.desktop.application.dsl.TargetFormat import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { - // __KOTLIN_COMPOSE_VERSION__ - kotlin("jvm") version "1.5.31" - // __LATEST_COMPOSE_RELEASE_VERSION__ - id("org.jetbrains.compose") version "1.0.0" + kotlin("jvm") + id("org.jetbrains.compose") } group = "me.user" diff --git a/examples/falling-balls/gradle.properties b/examples/falling-balls/gradle.properties index 7fc6f1ff27..06bacfe25f 100644 --- a/examples/falling-balls/gradle.properties +++ b/examples/falling-balls/gradle.properties @@ -1 +1,3 @@ kotlin.code.style=official +kotlin.version=1.5.31 +compose.version=1.0.0 diff --git a/examples/falling-balls/settings.gradle.kts b/examples/falling-balls/settings.gradle.kts index 1fafcc8c2b..792529f337 100644 --- a/examples/falling-balls/settings.gradle.kts +++ b/examples/falling-balls/settings.gradle.kts @@ -1 +1,8 @@ +pluginManagement { + plugins { + kotlin("jvm").version(extra["kotlin.version"] as String) + id("org.jetbrains.compose").version(extra["compose.version"] as String) + } +} + rootProject.name = "falling_balls" diff --git a/examples/imageviewer/build.gradle.kts b/examples/imageviewer/build.gradle.kts index 4e3ccdf8cd..45172c70e6 100755 --- a/examples/imageviewer/build.gradle.kts +++ b/examples/imageviewer/build.gradle.kts @@ -1,18 +1,3 @@ -buildscript { - repositories { - google() - mavenCentral() - maven("https://maven.pkg.jetbrains.space/public/p/compose/dev") - } - - dependencies { - // __LATEST_COMPOSE_RELEASE_VERSION__ - classpath("org.jetbrains.compose:compose-gradle-plugin:1.0.0") - classpath("com.android.tools.build:gradle:4.1.0") - classpath(kotlin("gradle-plugin", version = "1.5.31")) - } -} - allprojects { repositories { google() diff --git a/examples/imageviewer/gradle.properties b/examples/imageviewer/gradle.properties index 4d15d015f8..5f7597d432 100755 --- a/examples/imageviewer/gradle.properties +++ b/examples/imageviewer/gradle.properties @@ -18,4 +18,7 @@ android.useAndroidX=true # Automatically convert third-party libraries to use AndroidX android.enableJetifier=true # Kotlin code style for this project: "official" or "obsolete": -kotlin.code.style=official \ No newline at end of file +kotlin.code.style=official +kotlin.version=1.5.31 +agp.version=4.2.2 +compose.version=1.0.0 diff --git a/examples/imageviewer/settings.gradle.kts b/examples/imageviewer/settings.gradle.kts index 9a0d554e9b..f4ac8d1ff7 100755 --- a/examples/imageviewer/settings.gradle.kts +++ b/examples/imageviewer/settings.gradle.kts @@ -1 +1,22 @@ +pluginManagement { + repositories { + gradlePluginPortal() + maven("https://maven.pkg.jetbrains.space/public/p/compose/dev") + google() + } + + plugins { + val kotlinVersion = extra["kotlin.version"] as String + val agpVersion = extra["agp.version"] as String + val composeVersion = extra["compose.version"] as String + + kotlin("jvm").version(kotlinVersion) + kotlin("multiplatform").version(kotlinVersion) + kotlin("android").version(kotlinVersion) + id("com.android.application").version(agpVersion) + id("com.android.library").version(agpVersion) + id("org.jetbrains.compose").version(composeVersion) + } +} + include(":common", ":android", ":desktop") diff --git a/examples/intellij-plugin/build.gradle.kts b/examples/intellij-plugin/build.gradle.kts index c95ba9e34d..c462f5a4d4 100644 --- a/examples/intellij-plugin/build.gradle.kts +++ b/examples/intellij-plugin/build.gradle.kts @@ -3,9 +3,8 @@ import org.jetbrains.compose.compose plugins { id("org.jetbrains.intellij") version "1.1.4" java - kotlin("jvm") version "1.5.31" - // __LATEST_COMPOSE_RELEASE_VERSION__ - id("org.jetbrains.compose") version "1.0.0" + kotlin("jvm") + id("org.jetbrains.compose") id("idea") } diff --git a/examples/intellij-plugin/gradle.properties b/examples/intellij-plugin/gradle.properties index 29e08e8ca8..06bacfe25f 100644 --- a/examples/intellij-plugin/gradle.properties +++ b/examples/intellij-plugin/gradle.properties @@ -1 +1,3 @@ -kotlin.code.style=official \ No newline at end of file +kotlin.code.style=official +kotlin.version=1.5.31 +compose.version=1.0.0 diff --git a/examples/intellij-plugin/settings.gradle.kts b/examples/intellij-plugin/settings.gradle.kts index 81c28fd83a..dd1ac3675a 100644 --- a/examples/intellij-plugin/settings.gradle.kts +++ b/examples/intellij-plugin/settings.gradle.kts @@ -1,9 +1,8 @@ rootProject.name = "ComposeDemoPlugin" pluginManagement { - repositories { - gradlePluginPortal() - mavenCentral() - maven { url = uri("https://maven.pkg.jetbrains.space/public/p/compose/dev") } + plugins { + kotlin("jvm").version(extra["kotlin.version"] as String) + id("org.jetbrains.compose").version(extra["compose.version"] as String) } -} \ No newline at end of file +} diff --git a/examples/issues/build.gradle.kts b/examples/issues/build.gradle.kts index ef4e105309..543d661ea0 100644 --- a/examples/issues/build.gradle.kts +++ b/examples/issues/build.gradle.kts @@ -1,20 +1,3 @@ -buildscript { - repositories { - mavenLocal() - google() - mavenCentral() - maven("https://maven.pkg.jetbrains.space/public/p/compose/dev") - } - - dependencies { - // __LATEST_COMPOSE_RELEASE_VERSION__ - classpath("org.jetbrains.compose:compose-gradle-plugin:1.0.0") - classpath("com.android.tools.build:gradle:4.1.3") - // __KOTLIN_COMPOSE_VERSION__ - classpath(kotlin("gradle-plugin", version = "1.5.31")) - } -} - allprojects { repositories { mavenLocal() diff --git a/examples/issues/gradle.properties b/examples/issues/gradle.properties index 356c30dcd6..fc41fc8e48 100644 --- a/examples/issues/gradle.properties +++ b/examples/issues/gradle.properties @@ -18,4 +18,7 @@ kotlin.code.style=official # https://developer.android.com/topic/libraries/support-library/androidx-rn android.useAndroidX=true # Automatically convert third-party libraries to use AndroidX -android.enableJetifier=true \ No newline at end of file +android.enableJetifier=true +kotlin.version=1.5.31 +agp.version=4.2.2 +compose.version=1.0.0 diff --git a/examples/issues/settings.gradle.kts b/examples/issues/settings.gradle.kts index 9a0d554e9b..f4ac8d1ff7 100644 --- a/examples/issues/settings.gradle.kts +++ b/examples/issues/settings.gradle.kts @@ -1 +1,22 @@ +pluginManagement { + repositories { + gradlePluginPortal() + maven("https://maven.pkg.jetbrains.space/public/p/compose/dev") + google() + } + + plugins { + val kotlinVersion = extra["kotlin.version"] as String + val agpVersion = extra["agp.version"] as String + val composeVersion = extra["compose.version"] as String + + kotlin("jvm").version(kotlinVersion) + kotlin("multiplatform").version(kotlinVersion) + kotlin("android").version(kotlinVersion) + id("com.android.application").version(agpVersion) + id("com.android.library").version(agpVersion) + id("org.jetbrains.compose").version(composeVersion) + } +} + include(":common", ":android", ":desktop") diff --git a/examples/notepad/build.gradle.kts b/examples/notepad/build.gradle.kts index 11da3e685d..4002e23f92 100644 --- a/examples/notepad/build.gradle.kts +++ b/examples/notepad/build.gradle.kts @@ -2,10 +2,8 @@ import org.jetbrains.compose.compose import org.jetbrains.compose.desktop.application.dsl.TargetFormat plugins { - // __KOTLIN_COMPOSE_VERSION__ - kotlin("jvm") version "1.5.31" - // __LATEST_COMPOSE_RELEASE_VERSION__ - id("org.jetbrains.compose") version ("1.0.0") + kotlin("jvm") + id("org.jetbrains.compose") } repositories { diff --git a/examples/notepad/gradle.properties b/examples/notepad/gradle.properties index f1a9d3306a..999cde62e9 100644 --- a/examples/notepad/gradle.properties +++ b/examples/notepad/gradle.properties @@ -1,2 +1,4 @@ org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 -kotlin.code.style=official \ No newline at end of file +kotlin.code.style=official +kotlin.version=1.5.31 +compose.version=1.0.0 diff --git a/examples/notepad/settings.gradle.kts b/examples/notepad/settings.gradle.kts index 781ae9381e..9474fbaae5 100644 --- a/examples/notepad/settings.gradle.kts +++ b/examples/notepad/settings.gradle.kts @@ -3,4 +3,9 @@ pluginManagement { gradlePluginPortal() maven("https://maven.pkg.jetbrains.space/public/p/compose/dev") } -} \ No newline at end of file + + plugins { + kotlin("jvm").version(extra["kotlin.version"] as String) + id("org.jetbrains.compose").version(extra["compose.version"] as String) + } +} diff --git a/examples/todoapp-lite/build.gradle.kts b/examples/todoapp-lite/build.gradle.kts index 4e3ccdf8cd..45172c70e6 100755 --- a/examples/todoapp-lite/build.gradle.kts +++ b/examples/todoapp-lite/build.gradle.kts @@ -1,18 +1,3 @@ -buildscript { - repositories { - google() - mavenCentral() - maven("https://maven.pkg.jetbrains.space/public/p/compose/dev") - } - - dependencies { - // __LATEST_COMPOSE_RELEASE_VERSION__ - classpath("org.jetbrains.compose:compose-gradle-plugin:1.0.0") - classpath("com.android.tools.build:gradle:4.1.0") - classpath(kotlin("gradle-plugin", version = "1.5.31")) - } -} - allprojects { repositories { google() diff --git a/examples/todoapp-lite/gradle.properties b/examples/todoapp-lite/gradle.properties index 4d15d015f8..5f7597d432 100755 --- a/examples/todoapp-lite/gradle.properties +++ b/examples/todoapp-lite/gradle.properties @@ -18,4 +18,7 @@ android.useAndroidX=true # Automatically convert third-party libraries to use AndroidX android.enableJetifier=true # Kotlin code style for this project: "official" or "obsolete": -kotlin.code.style=official \ No newline at end of file +kotlin.code.style=official +kotlin.version=1.5.31 +agp.version=4.2.2 +compose.version=1.0.0 diff --git a/examples/todoapp-lite/settings.gradle.kts b/examples/todoapp-lite/settings.gradle.kts index 9a0d554e9b..f4ac8d1ff7 100755 --- a/examples/todoapp-lite/settings.gradle.kts +++ b/examples/todoapp-lite/settings.gradle.kts @@ -1 +1,22 @@ +pluginManagement { + repositories { + gradlePluginPortal() + maven("https://maven.pkg.jetbrains.space/public/p/compose/dev") + google() + } + + plugins { + val kotlinVersion = extra["kotlin.version"] as String + val agpVersion = extra["agp.version"] as String + val composeVersion = extra["compose.version"] as String + + kotlin("jvm").version(kotlinVersion) + kotlin("multiplatform").version(kotlinVersion) + kotlin("android").version(kotlinVersion) + id("com.android.application").version(agpVersion) + id("com.android.library").version(agpVersion) + id("org.jetbrains.compose").version(composeVersion) + } +} + include(":common", ":android", ":desktop") diff --git a/examples/todoapp/buildSrc/build.gradle.kts b/examples/todoapp/buildSrc/build.gradle.kts index 5617d479a3..bb48132e6a 100644 --- a/examples/todoapp/buildSrc/build.gradle.kts +++ b/examples/todoapp/buildSrc/build.gradle.kts @@ -10,8 +10,8 @@ repositories { } dependencies { - implementation(Deps.JetBrains.Compose.gradlePlugin) - implementation(Deps.JetBrains.Kotlin.gradlePlugin) + implementation(Deps.JetBrains.Compose(project).gradlePlugin) + implementation(Deps.JetBrains.Kotlin(project).gradlePlugin) implementation(Deps.Android.Tools.Build.gradlePlugin) implementation(Deps.Squareup.SQLDelight.gradlePlugin) } diff --git a/examples/todoapp/buildSrc/buildSrc/src/main/kotlin/Deps.kt b/examples/todoapp/buildSrc/buildSrc/src/main/kotlin/Deps.kt index 10a09d0084..3ba8272955 100644 --- a/examples/todoapp/buildSrc/buildSrc/src/main/kotlin/Deps.kt +++ b/examples/todoapp/buildSrc/buildSrc/src/main/kotlin/Deps.kt @@ -1,20 +1,23 @@ -object Deps { +// We store Kotlin and Compose versions in gradle.properties to +// be able to override them on CI. +// You probably won't need this, so you can get rid of `project` in this file. +import org.gradle.api.Project + +object Deps { object JetBrains { - object Kotlin { - // __KOTLIN_COMPOSE_VERSION__ - private const val VERSION = "1.5.31" - const val gradlePlugin = "org.jetbrains.kotlin:kotlin-gradle-plugin:$VERSION" - const val testCommon = "org.jetbrains.kotlin:kotlin-test-common:$VERSION" - const val testJunit = "org.jetbrains.kotlin:kotlin-test-junit:$VERSION" - const val testJs = "org.jetbrains.kotlin:kotlin-test-js:$VERSION" - const val testAnnotationsCommon = "org.jetbrains.kotlin:kotlin-test-annotations-common:$VERSION" + class Kotlin(private val project: Project) { + private val VERSION = project.properties["kotlin.version"] + val gradlePlugin = "org.jetbrains.kotlin:kotlin-gradle-plugin:$VERSION" + val testCommon = "org.jetbrains.kotlin:kotlin-test-common:$VERSION" + val testJunit = "org.jetbrains.kotlin:kotlin-test-junit:$VERSION" + val testJs = "org.jetbrains.kotlin:kotlin-test-js:$VERSION" + val testAnnotationsCommon = "org.jetbrains.kotlin:kotlin-test-annotations-common:$VERSION" } - object Compose { - // __LATEST_COMPOSE_RELEASE_VERSION__ - private const val VERSION = "1.0.0" - const val gradlePlugin = "org.jetbrains.compose:compose-gradle-plugin:$VERSION" + class Compose(private val project: Project) { + private val VERSION = project.properties["compose.version"] + val gradlePlugin = "org.jetbrains.compose:compose-gradle-plugin:$VERSION" } } diff --git a/examples/todoapp/buildSrc/gradle.properties b/examples/todoapp/buildSrc/gradle.properties new file mode 100755 index 0000000000..a161a21c41 --- /dev/null +++ b/examples/todoapp/buildSrc/gradle.properties @@ -0,0 +1,2 @@ +kotlin.version=1.5.31 +compose.version=1.0.0 diff --git a/examples/todoapp/buildSrc/src/main/kotlin/multiplatform-setup.gradle.kts b/examples/todoapp/buildSrc/src/main/kotlin/multiplatform-setup.gradle.kts index b1643f4029..f7bb6d5ab6 100644 --- a/examples/todoapp/buildSrc/src/main/kotlin/multiplatform-setup.gradle.kts +++ b/examples/todoapp/buildSrc/src/main/kotlin/multiplatform-setup.gradle.kts @@ -15,24 +15,24 @@ kotlin { sourceSets { named("commonTest") { dependencies { - implementation(Deps.JetBrains.Kotlin.testCommon) - implementation(Deps.JetBrains.Kotlin.testAnnotationsCommon) + implementation(Deps.JetBrains.Kotlin(project).testCommon) + implementation(Deps.JetBrains.Kotlin(project).testAnnotationsCommon) } } named("androidTest") { dependencies { - implementation(Deps.JetBrains.Kotlin.testJunit) + implementation(Deps.JetBrains.Kotlin(project).testJunit) } } named("desktopTest") { dependencies { - implementation(Deps.JetBrains.Kotlin.testJunit) + implementation(Deps.JetBrains.Kotlin(project).testJunit) } } named("jsTest") { dependencies { - implementation(Deps.JetBrains.Kotlin.testJs) + implementation(Deps.JetBrains.Kotlin(project).testJs) } } } diff --git a/examples/visual-effects/build.gradle.kts b/examples/visual-effects/build.gradle.kts index 67c189167a..623050da5d 100644 --- a/examples/visual-effects/build.gradle.kts +++ b/examples/visual-effects/build.gradle.kts @@ -3,10 +3,8 @@ import org.jetbrains.compose.desktop.application.dsl.TargetFormat import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { - // __KOTLIN_COMPOSE_VERSION__ - kotlin("jvm") version "1.5.31" - // __LATEST_COMPOSE_RELEASE_VERSION__ - id("org.jetbrains.compose") version "1.0.0" + kotlin("jvm") + id("org.jetbrains.compose") } group = "me.user" diff --git a/examples/visual-effects/gradle.properties b/examples/visual-effects/gradle.properties index 7fc6f1ff27..8d00bb2f2a 100644 --- a/examples/visual-effects/gradle.properties +++ b/examples/visual-effects/gradle.properties @@ -1 +1,3 @@ kotlin.code.style=official +kotlin.version=1.5.31 +compose.version=1.0.0 \ No newline at end of file diff --git a/examples/visual-effects/settings.gradle.kts b/examples/visual-effects/settings.gradle.kts index 103c1e57bd..69d08df2c6 100644 --- a/examples/visual-effects/settings.gradle.kts +++ b/examples/visual-effects/settings.gradle.kts @@ -1,10 +1,13 @@ pluginManagement { repositories { gradlePluginPortal() - mavenCentral() - maven { url = uri("https://maven.pkg.jetbrains.space/public/p/compose/dev") } + maven("https://maven.pkg.jetbrains.space/public/p/compose/dev") + } + + plugins { + kotlin("jvm").version(extra["kotlin.version"] as String) + id("org.jetbrains.compose").version(extra["compose.version"] as String) } - } -rootProject.name = "visual-effects" +rootProject.name = "visual-effects" diff --git a/examples/web-compose-bird/build.gradle.kts b/examples/web-compose-bird/build.gradle.kts index 038f5759a5..444e94c391 100644 --- a/examples/web-compose-bird/build.gradle.kts +++ b/examples/web-compose-bird/build.gradle.kts @@ -1,8 +1,8 @@ import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension plugins { - kotlin("multiplatform") version "1.5.31" - id("org.jetbrains.compose") version "1.0.0" + kotlin("multiplatform") + id("org.jetbrains.compose") } group = "com.theapache64.composebird" version = "1.0.0-alpha01" diff --git a/examples/web-compose-bird/gradle.properties b/examples/web-compose-bird/gradle.properties index 39f0b7a404..8b9727b436 100644 --- a/examples/web-compose-bird/gradle.properties +++ b/examples/web-compose-bird/gradle.properties @@ -1,2 +1,4 @@ kotlin.code.style=official org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=1024m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 +kotlin.version=1.5.31 +compose.version=1.0.0 diff --git a/examples/web-compose-bird/settings.gradle.kts b/examples/web-compose-bird/settings.gradle.kts index f063d947c5..d6270ff710 100644 --- a/examples/web-compose-bird/settings.gradle.kts +++ b/examples/web-compose-bird/settings.gradle.kts @@ -1,9 +1,15 @@ pluginManagement { repositories { gradlePluginPortal() + mavenCentral() maven("https://maven.pkg.jetbrains.space/public/p/compose/dev") - google() + } + + plugins { + kotlin("multiplatform").version(extra["kotlin.version"] as String) + id("org.jetbrains.compose").version(extra["compose.version"] as String) } } + rootProject.name = "web-compose-bird" diff --git a/examples/web-landing/build.gradle.kts b/examples/web-landing/build.gradle.kts index 539343bb4e..94019a1285 100644 --- a/examples/web-landing/build.gradle.kts +++ b/examples/web-landing/build.gradle.kts @@ -1,8 +1,8 @@ import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension plugins { - kotlin("multiplatform") version "1.5.31" - id("org.jetbrains.compose") version "1.0.0" + kotlin("multiplatform") + id("org.jetbrains.compose") } repositories { diff --git a/examples/web-landing/gradle.properties b/examples/web-landing/gradle.properties index 29e08e8ca8..06bacfe25f 100644 --- a/examples/web-landing/gradle.properties +++ b/examples/web-landing/gradle.properties @@ -1 +1,3 @@ -kotlin.code.style=official \ No newline at end of file +kotlin.code.style=official +kotlin.version=1.5.31 +compose.version=1.0.0 diff --git a/examples/web-landing/settings.gradle.kts b/examples/web-landing/settings.gradle.kts index 6ffdb3e370..3fdc1a713c 100644 --- a/examples/web-landing/settings.gradle.kts +++ b/examples/web-landing/settings.gradle.kts @@ -2,10 +2,14 @@ pluginManagement { repositories { gradlePluginPortal() mavenCentral() - maven { url = uri("https://maven.pkg.jetbrains.space/public/p/compose/dev") } - google() + maven("https://maven.pkg.jetbrains.space/public/p/compose/dev") } + plugins { + kotlin("multiplatform").version(extra["kotlin.version"] as String) + id("org.jetbrains.compose").version(extra["compose.version"] as String) + } } + rootProject.name = "compose-web-lp" diff --git a/examples/web-with-react/build.gradle.kts b/examples/web-with-react/build.gradle.kts index 0db3c55979..658afacc94 100644 --- a/examples/web-with-react/build.gradle.kts +++ b/examples/web-with-react/build.gradle.kts @@ -1,7 +1,7 @@ import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension plugins { - kotlin("multiplatform") version "1.5.31" - id("org.jetbrains.compose") version "1.0.0" + kotlin("multiplatform") + id("org.jetbrains.compose") } repositories { diff --git a/examples/web-with-react/gradle.properties b/examples/web-with-react/gradle.properties index 29e08e8ca8..06bacfe25f 100644 --- a/examples/web-with-react/gradle.properties +++ b/examples/web-with-react/gradle.properties @@ -1 +1,3 @@ -kotlin.code.style=official \ No newline at end of file +kotlin.code.style=official +kotlin.version=1.5.31 +compose.version=1.0.0 diff --git a/examples/web-with-react/settings.gradle.kts b/examples/web-with-react/settings.gradle.kts index 2080023004..ddc33e90fa 100644 --- a/examples/web-with-react/settings.gradle.kts +++ b/examples/web-with-react/settings.gradle.kts @@ -1,8 +1,13 @@ pluginManagement { repositories { gradlePluginPortal() + mavenCentral() maven("https://maven.pkg.jetbrains.space/public/p/compose/dev") - google() + } + + plugins { + kotlin("multiplatform").version(extra["kotlin.version"] as String) + id("org.jetbrains.compose").version(extra["compose.version"] as String) } } diff --git a/examples/widgets-gallery/build.gradle.kts b/examples/widgets-gallery/build.gradle.kts index c85c02f1d7..45172c70e6 100644 --- a/examples/widgets-gallery/build.gradle.kts +++ b/examples/widgets-gallery/build.gradle.kts @@ -1,20 +1,3 @@ -buildscript { - repositories { - mavenLocal() - google() - mavenCentral() - maven("https://maven.pkg.jetbrains.space/public/p/compose/dev") - } - - dependencies { - // __LATEST_COMPOSE_RELEASE_VERSION__ - classpath("org.jetbrains.compose:compose-gradle-plugin:1.0.0") - classpath("com.android.tools.build:gradle:4.2.0") - // __KOTLIN_COMPOSE_VERSION__ - classpath(kotlin("gradle-plugin", version = "1.5.31")) - } -} - allprojects { repositories { google() diff --git a/examples/widgets-gallery/gradle.properties b/examples/widgets-gallery/gradle.properties index 4d15d015f8..b728e12c2b 100644 --- a/examples/widgets-gallery/gradle.properties +++ b/examples/widgets-gallery/gradle.properties @@ -18,4 +18,7 @@ android.useAndroidX=true # Automatically convert third-party libraries to use AndroidX android.enableJetifier=true # Kotlin code style for this project: "official" or "obsolete": -kotlin.code.style=official \ No newline at end of file +kotlin.code.style=official +kotlin.version=1.5.31 +compose.version=1.0.0 +agp.version=4.2.2 diff --git a/examples/widgets-gallery/settings.gradle.kts b/examples/widgets-gallery/settings.gradle.kts index 9a0d554e9b..f4ac8d1ff7 100644 --- a/examples/widgets-gallery/settings.gradle.kts +++ b/examples/widgets-gallery/settings.gradle.kts @@ -1 +1,22 @@ +pluginManagement { + repositories { + gradlePluginPortal() + maven("https://maven.pkg.jetbrains.space/public/p/compose/dev") + google() + } + + plugins { + val kotlinVersion = extra["kotlin.version"] as String + val agpVersion = extra["agp.version"] as String + val composeVersion = extra["compose.version"] as String + + kotlin("jvm").version(kotlinVersion) + kotlin("multiplatform").version(kotlinVersion) + kotlin("android").version(kotlinVersion) + id("com.android.application").version(agpVersion) + id("com.android.library").version(agpVersion) + id("org.jetbrains.compose").version(composeVersion) + } +} + include(":common", ":android", ":desktop") diff --git a/experimental/build_from_cli/build_and_run_from_cli_example.sh b/experimental/build_from_cli/build_and_run_from_cli_example.sh index 534b4d3919..eea1d27afc 100644 --- a/experimental/build_from_cli/build_and_run_from_cli_example.sh +++ b/experimental/build_from_cli/build_and_run_from_cli_example.sh @@ -20,9 +20,7 @@ function mavenDep { PLATFORM=macos-x64 SKIKO_VERSION=0.2.33 -# __KOTLIN_COMPOSE_VERSION__ KOTLIN_VERSION=1.5.0 -# __LATEST_COMPOSE_RELEASE_VERSION__ COMPOSE_VERSION=0.4.0-build209 COROUTINES_VERSION=1.3.6 COLLECTIONS_VERSION=0.3 diff --git a/experimental/cef/build.gradle.kts b/experimental/cef/build.gradle.kts index 38ceaf72f9..25c45b4ac9 100644 --- a/experimental/cef/build.gradle.kts +++ b/experimental/cef/build.gradle.kts @@ -4,9 +4,7 @@ import de.undercouch.gradle.tasks.download.Download import kotlin.text.capitalize plugins { - // __KOTLIN_COMPOSE_VERSION__ kotlin("jvm") version "1.5.21" - // __LATEST_COMPOSE_RELEASE_VERSION__ id("org.jetbrains.compose") version "1.0.0-alpha1" id("de.undercouch.download") version "4.1.1" application diff --git a/experimental/components/build.gradle.kts b/experimental/components/build.gradle.kts index 73d20416c1..d15b16f54a 100644 --- a/experimental/components/build.gradle.kts +++ b/experimental/components/build.gradle.kts @@ -9,7 +9,6 @@ buildscript { dependencies { classpath("org.jetbrains.compose:compose-gradle-plugin:$composeVersion") - // __KOTLIN_COMPOSE_VERSION__ classpath(kotlin("gradle-plugin", version = "1.5.31")) } } diff --git a/experimental/components/gradle.properties b/experimental/components/gradle.properties index 7421193a8e..f153c2b797 100644 --- a/experimental/components/gradle.properties +++ b/experimental/components/gradle.properties @@ -2,6 +2,4 @@ org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 android.useAndroidX=true android.enableJetifier=true kotlin.code.style=official - -# __LATEST_COMPOSE_RELEASE_VERSION__ compose.version=1.0.0 diff --git a/experimental/lwjgl-integration/build.gradle.kts b/experimental/lwjgl-integration/build.gradle.kts index 47df4259e8..5a38ca3a1f 100644 --- a/experimental/lwjgl-integration/build.gradle.kts +++ b/experimental/lwjgl-integration/build.gradle.kts @@ -2,10 +2,8 @@ import org.jetbrains.compose.compose import org.jetbrains.compose.desktop.application.dsl.TargetFormat plugins { - // __KOTLIN_COMPOSE_VERSION__ kotlin("jvm") version "1.5.31" - // __LATEST_COMPOSE_RELEASE_VERSION__ - id("org.jetbrains.compose") version (System.getenv("COMPOSE_TEMPLATE_COMPOSE_VERSION") ?: "1.0.0") + id("org.jetbrains.compose") version "1.0.0" } repositories { diff --git a/gradle-plugins/build.gradle.kts b/gradle-plugins/build.gradle.kts index e402154995..3b35fa20ac 100644 --- a/gradle-plugins/build.gradle.kts +++ b/gradle-plugins/build.gradle.kts @@ -1,7 +1,6 @@ import com.gradle.publish.PluginBundleExtension plugins { - // __KOTLIN_COMPOSE_VERSION__ kotlin("jvm") version "1.5.10" apply false id("com.gradle.plugin-publish") version "0.17.0" apply false } diff --git a/gradle-plugins/compose/src/test/kotlin/org/jetbrains/compose/test/TestKotlinVersion.kt b/gradle-plugins/compose/src/test/kotlin/org/jetbrains/compose/test/TestKotlinVersion.kt index 11a92b536b..2a39d3496b 100644 --- a/gradle-plugins/compose/src/test/kotlin/org/jetbrains/compose/test/TestKotlinVersion.kt +++ b/gradle-plugins/compose/src/test/kotlin/org/jetbrains/compose/test/TestKotlinVersion.kt @@ -7,7 +7,6 @@ package org.jetbrains.compose.test @Suppress("EnumEntryName") enum class TestKotlinVersion(val versionString: String) { - // __KOTLIN_COMPOSE_VERSION__ Default("1.5.31"), V1_5_20("1.5.20") } \ No newline at end of file diff --git a/gradle-plugins/gradle.properties b/gradle-plugins/gradle.properties index 5083a55a8f..7ebd48084e 100644 --- a/gradle-plugins/gradle.properties +++ b/gradle-plugins/gradle.properties @@ -5,7 +5,6 @@ kotlin.code.style=official # that will be used by published Gradle plugin, # unless overridden by COMPOSE_GRADLE_PLUGIN_COMPOSE_VERSION env var. # -# __LATEST_COMPOSE_RELEASE_VERSION__ compose.version=1.0.0 compose.with.web=false diff --git a/idea-plugin/examples/simple-preview-example/build.gradle.kts b/idea-plugin/examples/simple-preview-example/build.gradle.kts index ab3325fc72..bc87468882 100644 --- a/idea-plugin/examples/simple-preview-example/build.gradle.kts +++ b/idea-plugin/examples/simple-preview-example/build.gradle.kts @@ -5,9 +5,7 @@ buildscript { maven("https://maven.pkg.jetbrains.space/public/p/compose/dev") } dependencies { - // __LATEST_COMPOSE_RELEASE_VERSION__ classpath("org.jetbrains.compose:compose-gradle-plugin:0.0.9-preview-images") - // __KOTLIN_COMPOSE_VERSION__ classpath(kotlin("gradle-plugin", version = "1.5.31")) } } diff --git a/templates/desktop-template/build.gradle.kts b/templates/desktop-template/build.gradle.kts index 731ca13d51..6ea0689457 100644 --- a/templates/desktop-template/build.gradle.kts +++ b/templates/desktop-template/build.gradle.kts @@ -2,10 +2,8 @@ import org.jetbrains.compose.compose import org.jetbrains.compose.desktop.application.dsl.TargetFormat plugins { - // __KOTLIN_COMPOSE_VERSION__ - kotlin("jvm") version "1.5.31" - // __LATEST_COMPOSE_RELEASE_VERSION__ - id("org.jetbrains.compose") version (System.getenv("COMPOSE_TEMPLATE_COMPOSE_VERSION") ?: "1.0.0") + kotlin("jvm") + id("org.jetbrains.compose") } repositories { diff --git a/templates/desktop-template/gradle.properties b/templates/desktop-template/gradle.properties index f1a9d3306a..431cc21904 100644 --- a/templates/desktop-template/gradle.properties +++ b/templates/desktop-template/gradle.properties @@ -1,2 +1,4 @@ org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 -kotlin.code.style=official \ No newline at end of file +kotlin.code.style=official +kotlin.version=1.5.31 +compose.version=1.0.0 \ No newline at end of file diff --git a/templates/desktop-template/settings.gradle.kts b/templates/desktop-template/settings.gradle.kts index 781ae9381e..9474fbaae5 100644 --- a/templates/desktop-template/settings.gradle.kts +++ b/templates/desktop-template/settings.gradle.kts @@ -3,4 +3,9 @@ pluginManagement { gradlePluginPortal() maven("https://maven.pkg.jetbrains.space/public/p/compose/dev") } -} \ No newline at end of file + + plugins { + kotlin("jvm").version(extra["kotlin.version"] as String) + id("org.jetbrains.compose").version(extra["compose.version"] as String) + } +} diff --git a/templates/multiplatform-template/android/src/main/AndroidManifest.xml b/templates/multiplatform-template/android/src/main/AndroidManifest.xml index 6020c11eb2..f4fea5dec1 100644 --- a/templates/multiplatform-template/android/src/main/AndroidManifest.xml +++ b/templates/multiplatform-template/android/src/main/AndroidManifest.xml @@ -10,6 +10,7 @@ android:supportsRtl="true" android:theme="@style/Theme.AppCompat.Light.NoActionBar"> diff --git a/templates/multiplatform-template/build.gradle.kts b/templates/multiplatform-template/build.gradle.kts index 85128fa822..45172c70e6 100644 --- a/templates/multiplatform-template/build.gradle.kts +++ b/templates/multiplatform-template/build.gradle.kts @@ -1,21 +1,3 @@ -buildscript { - // __LATEST_COMPOSE_RELEASE_VERSION__ - val composeVersion = System.getenv("COMPOSE_TEMPLATE_COMPOSE_VERSION") ?: "1.0.0" - - repositories { - mavenCentral() - maven("https://maven.pkg.jetbrains.space/public/p/compose/dev") - google() - } - - dependencies { - classpath("org.jetbrains.compose:compose-gradle-plugin:$composeVersion") - classpath("com.android.tools.build:gradle:4.1.3") - // __KOTLIN_COMPOSE_VERSION__ - classpath(kotlin("gradle-plugin", version = "1.5.31")) - } -} - allprojects { repositories { google() diff --git a/templates/multiplatform-template/gradle.properties b/templates/multiplatform-template/gradle.properties index a9d5d0bc15..dba9f49d9c 100644 --- a/templates/multiplatform-template/gradle.properties +++ b/templates/multiplatform-template/gradle.properties @@ -1,4 +1,7 @@ org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 android.useAndroidX=true android.enableJetifier=true -kotlin.code.style=official \ No newline at end of file +kotlin.code.style=official +kotlin.version=1.5.31 +agp.version=4.2.2 +compose.version=1.0.0 diff --git a/templates/multiplatform-template/settings.gradle.kts b/templates/multiplatform-template/settings.gradle.kts index 9a0d554e9b..55535932b5 100644 --- a/templates/multiplatform-template/settings.gradle.kts +++ b/templates/multiplatform-template/settings.gradle.kts @@ -1 +1,18 @@ +pluginManagement { + repositories { + gradlePluginPortal() + maven("https://maven.pkg.jetbrains.space/public/p/compose/dev") + google() + } + + plugins { + kotlin("jvm").version(extra["kotlin.version"] as String) + kotlin("multiplatform").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.library").version(extra["agp.version"] as String) + id("org.jetbrains.compose").version(extra["compose.version"] as String) + } +} + include(":common", ":android", ":desktop") diff --git a/templates/web-template/build.gradle.kts b/templates/web-template/build.gradle.kts index 613a584385..f76d475c3b 100644 --- a/templates/web-template/build.gradle.kts +++ b/templates/web-template/build.gradle.kts @@ -3,10 +3,8 @@ import org.jetbrains.compose.desktop.application.dsl.TargetFormat import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension plugins { - // __KOTLIN_COMPOSE_VERSION__ - kotlin("multiplatform") version "1.5.31" - // __LATEST_COMPOSE_RELEASE_VERSION__ - id("org.jetbrains.compose") version ("1.0.0") + kotlin("multiplatform") + id("org.jetbrains.compose") } repositories { @@ -35,7 +33,7 @@ kotlin { // a temporary workaround for a bug in jsRun invocation - see https://youtrack.jetbrains.com/issue/KT-48273 afterEvaluate { - rootProject.extensions.configure { + rootProject.extensions.configure { versions.webpackDevServer.version = "4.0.0" versions.webpackCli.version = "4.9.0" } diff --git a/templates/web-template/gradle.properties b/templates/web-template/gradle.properties index f1a9d3306a..431cc21904 100644 --- a/templates/web-template/gradle.properties +++ b/templates/web-template/gradle.properties @@ -1,2 +1,4 @@ org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 -kotlin.code.style=official \ No newline at end of file +kotlin.code.style=official +kotlin.version=1.5.31 +compose.version=1.0.0 \ No newline at end of file diff --git a/templates/web-template/settings.gradle.kts b/templates/web-template/settings.gradle.kts index 781ae9381e..d9760597a2 100644 --- a/templates/web-template/settings.gradle.kts +++ b/templates/web-template/settings.gradle.kts @@ -3,4 +3,9 @@ pluginManagement { gradlePluginPortal() maven("https://maven.pkg.jetbrains.space/public/p/compose/dev") } + + plugins { + kotlin("multiplatform").version(extra["kotlin.version"] as String) + id("org.jetbrains.compose").version(extra["compose.version"] as String) + } } \ No newline at end of file diff --git a/tools/replace.sh b/tools/replace.sh index c1fc62fda7..46512a1c10 100755 --- a/tools/replace.sh +++ b/tools/replace.sh @@ -1,13 +1,51 @@ #!/bin/bash + +# Replace hard-coded Compose version in Compose repo projects. Usage: ./replace.sh 1.0.0-rc6 + ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"/.. -COMPOSE_OLDVER=0.4.0-rc2 -COMPOSE_NEWVER=0.4.0 -find -E $ROOT -regex '.*\.(kts|properties|kt)' -exec sed -i '' -e "s/$COMPOSE_OLDVER/$COMPOSE_NEWVER/g" {} \; -APPCOMPAT_OLDVER=1.1.0 -APPCOMPAT_NEWVER=1.3.0-beta01 -find -E $ROOT -regex '.*\.(kts|properties|kt)' -exec sed -i '' -e "s/$APPCOMPAT_OLDVER/$APPCOMPAT_NEWVER/g" {} \; -KOTLIN_OLDVER=1.5.10 -KOTLIN_NEWVER=1.5.10 -find -E $ROOT -regex '.*\.(kts|properties|kt)' -exec sed -i '' -e "s/$KOTLIN_OLDVER/$KOTLIN_NEWVER/g" {} \; -git grep -C 1 __KOTLIN_COMPOSE_VERSION__ $ROOT -git grep -C 1 __LATEST_COMPOSE_RELEASE_VERSION__ $ROOT + +# Add folders which should contain up-to-date versions +declare -a folders=( + "templates" + "examples" + "gradle-plugins" + "components" + "ci" + "web" + "tutorials" +) + +if [ -z "$@" ]; then +echo "Specify Compose version. For example: ./replace.sh 1.0.0-rc6" +exit 1 +fi +COMPOSE_VERSION=$@ + +if [[ $OSTYPE == 'darwin'* ]]; then + SED=gsed +else + SED=sed +fi + +replaceCompose() { + $SED -i -e "s/$1/$2/g" $3 +} + +replaceComposeInFile() { + echo "Replace in $1" + replaceCompose '^compose.version=.*' 'compose.version='"$COMPOSE_VERSION"'' $1 + replaceCompose '^COMPOSE_CORE_VERSION=.*' 'COMPOSE_CORE_VERSION='"$COMPOSE_VERSION"'' $1 + replaceCompose '^COMPOSE_WEB_VERSION=.*' 'COMPOSE_WEB_VERSION='"$COMPOSE_VERSION"'' $1 + replaceCompose 'id("org.jetbrains.compose") version ".*"' 'id("org.jetbrains.compose") version "'"$COMPOSE_VERSION"'"' $1 + replaceCompose '"org.jetbrains.compose:compose-gradle-plugin:.*"' '"org.jetbrains.compose:compose-gradle-plugin:'"$COMPOSE_VERSION"'"' $1 +} + +replaceComposeInFolder() { + find $ROOT/$1 -wholename $2 -not -path "**/build**" -not -path "**/.gradle**" | while read file; do replaceComposeInFile "$file"; done +} + +for folder in "${folders[@]}" +do + replaceComposeInFolder $folder "**gradle.properties" + replaceComposeInFolder $folder "**README.md" +done diff --git a/tutorials/Getting_Started/README.md b/tutorials/Getting_Started/README.md index 81b0f79e64..a5435677f7 100644 --- a/tutorials/Getting_Started/README.md +++ b/tutorials/Getting_Started/README.md @@ -40,7 +40,7 @@ just search for "Compose Multiplatform". ### Update the wizard plugin -The Compose plugin version used in the wizard above may be not the last. Update the version of the plugin to the latest available by editing the `build.gradle.kts` file, finding and updating the version information as shown below. In this example the latest version of the plugin was 1.0.0 and a compatible version of kotlin was 1.5.31. For the latest versions, see the [latest versions](https://github.com/JetBrains/compose-jb/releases) site and the [Kotlin](https://kotlinlang.org/) site. +The Compose plugin version used in the wizard above may be not the last. Update the version of the plugin to the latest available by editing the `build.gradle.kts` file, finding and updating the version information as shown below. For the latest versions, see the [latest versions](https://github.com/JetBrains/compose-jb/releases) site and the [Kotlin](https://kotlinlang.org/) site. ``` plugins { kotlin("jvm") version "1.5.31" diff --git a/tutorials/checker/build.gradle.kts b/tutorials/checker/build.gradle.kts index c46fac1018..d34c542639 100644 --- a/tutorials/checker/build.gradle.kts +++ b/tutorials/checker/build.gradle.kts @@ -50,18 +50,31 @@ fun cloneTemplate(template: String, index: Int, content: String): File { return tempDir } +@OptIn(ExperimentalStdlibApi::class) fun checkDirs(dirs: List, template: String, buildCmd: String = "build") { val snippets = findSnippets(dirs) snippets.forEachIndexed { index, snippet -> println("process snippet $index at ${snippet.file}:${snippet.lineNumber} with $template") snippet.tempDir = cloneTemplate(template, index, snippet.content) val isWin = System.getProperty("os.name").startsWith("Win") - val procBuilder = if (isWin) { - ProcessBuilder("gradlew.bat", "$buildCmd") - } else { - ProcessBuilder("bash", "./gradlew", "$buildCmd") + val args = buildList { + if (isWin) { + add("gradlew.bat") + } else { + add("bash") + add("./gradlew") + } + + add(buildCmd) + + project.findProperty("kotlin.version")?.also { + add("-Pkotlin.version=$it") + } + project.findProperty("compose.version")?.also { + add("-Pcompose.version=$it") + } } - val proc = procBuilder + val proc = ProcessBuilder(*args.toTypedArray()) .directory(snippet.tempDir) .redirectOutput(ProcessBuilder.Redirect.PIPE) .redirectError(ProcessBuilder.Redirect.PIPE) diff --git a/web/compose-compiler-integration/README.md b/web/compose-compiler-integration/README.md index 25ae6ecbdb..8bbe517667 100644 --- a/web/compose-compiler-integration/README.md +++ b/web/compose-compiler-integration/README.md @@ -1,9 +1,8 @@ RUN from project root directory: `./gradlew :compose-compiler-integration:checkComposeCases` - -To use specific version (the default is 0.0.0-SNASPHOT): -`./gradlew :compose-compiler-integration:checkComposeCases -PCOMPOSE_CORE_VERSION=0.5.0-build243` +To use specific version: +`./gradlew :compose-compiler-integration:checkComposeCases -PCOMPOSE_CORE_VERSION=1.0.0 -PCOMPOSE_WEB_VERSION=1.0.0 To fun only filtered cases (check for contained in file path): `./gradlew :compose-compiler-integration:checkComposeCases -PFILTER_CASES=CaseName` diff --git a/web/gradle.properties b/web/gradle.properties index 2344ce7b37..f0c428cfe8 100644 --- a/web/gradle.properties +++ b/web/gradle.properties @@ -1,4 +1,3 @@ -# __LATEST_COMPOSE_RELEASE_VERSION__ COMPOSE_CORE_VERSION=1.0.0 COMPOSE_WEB_VERSION=1.0.0 compose.web.buildSamples=false