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
This commit is contained in:
Igor Demin
2021-12-08 10:32:18 +03:00
committed by GitHub
parent 046f225846
commit dbd0a21949
74 changed files with 372 additions and 246 deletions

View File

@@ -3,11 +3,8 @@ import kotlinx.benchmark.gradle.*
import org.jetbrains.kotlin.allopen.gradle.* import org.jetbrains.kotlin.allopen.gradle.*
plugins { plugins {
// __KOTLIN_COMPOSE_VERSION__
kotlin("jvm") version "1.4.20" kotlin("jvm") version "1.4.20"
// __LATEST_COMPOSE_RELEASE_VERSION__
id("org.jetbrains.compose") version "0.2.0-build132" id("org.jetbrains.compose") version "0.2.0-build132"
// __KOTLIN_COMPOSE_VERSION__
kotlin("plugin.allopen") version "1.4.20" kotlin("plugin.allopen") version "1.4.20"
id("kotlinx.benchmark") version "0.3.0" id("kotlinx.benchmark") version "0.3.0"
} }

View File

@@ -1,3 +1,2 @@
# __LATEST_COMPOSE_RELEASE_VERSION__
compose.version=1.0.0 compose.version=1.0.0
kotlin.code.style=official kotlin.code.style=official

View File

@@ -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 { subprojects {
version = findProperty("deploy.version") ?: property("compose.version")!! version = findProperty("deploy.version") ?: property("compose.version")!!

View File

@@ -2,6 +2,5 @@ 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.5.31
# __LATEST_COMPOSE_RELEASE_VERSION__ compose.version=1.0.0
compose.version=1.0.0

View File

@@ -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:library")
include(":SplitPane:demo") include(":SplitPane:demo")

View File

@@ -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 { allprojects {
repositories { repositories {
google() google()

View File

@@ -18,4 +18,7 @@ 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 code style for this project: "official" or "obsolete": # Kotlin code style for this project: "official" or "obsolete":
kotlin.code.style=official kotlin.code.style=official
kotlin.version=1.5.31
agp.version=4.2.2
compose.version=1.0.0

View File

@@ -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") include(":common", ":android", ":desktop")

View File

@@ -3,8 +3,8 @@ import org.jetbrains.compose.compose
import org.jetbrains.compose.desktop.application.dsl.TargetFormat import org.jetbrains.compose.desktop.application.dsl.TargetFormat
plugins { plugins {
kotlin("multiplatform") version "1.5.31" kotlin("multiplatform")
id("org.jetbrains.compose") version "1.0.0" id("org.jetbrains.compose")
} }
version = "1.0-SNAPSHOT" version = "1.0-SNAPSHOT"

View File

@@ -0,0 +1,2 @@
kotlin.version=1.5.31
compose.version=1.0.0

View File

@@ -2,10 +2,14 @@ pluginManagement {
repositories { repositories {
gradlePluginPortal() gradlePluginPortal()
mavenCentral() mavenCentral()
maven { url = uri("https://maven.pkg.jetbrains.space/public/p/compose/dev") } 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 = "falling_balls_with_web" rootProject.name = "falling_balls_with_web"

View File

@@ -1,17 +1,16 @@
package org.jetbrains.compose.common.demo 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.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() { class JvmGame : Game() {
override fun now() = System.nanoTime() override fun now() = System.nanoTime()
} }
fun main() { fun main() {
Window(title = "Demo", size = IntSize(600, 400)) { singleWindowApplication(title = "Demo") {
fallingBalls( fallingBalls(
remember { remember {
JvmGame().apply { JvmGame().apply {

View File

@@ -2,11 +2,11 @@ package org.jetbrains.compose.common.demo
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import org.jetbrains.compose.common.ui.Modifier 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.ui.unit.Dp
import org.jetbrains.compose.common.internal.castOrCreate import org.jetbrains.compose.common.internal.castOrCreate
import org.jetbrains.compose.common.ui.unit.implementation import org.jetbrains.compose.common.ui.unit.implementation
import androidx.compose.foundation.layout.offset import androidx.compose.foundation.layout.offset
import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
@Composable @Composable
@OptIn(ExperimentalComposeWebWidgetsApi::class) @OptIn(ExperimentalComposeWebWidgetsApi::class)

View File

@@ -3,10 +3,8 @@ import org.jetbrains.compose.desktop.application.dsl.TargetFormat
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins { plugins {
// __KOTLIN_COMPOSE_VERSION__ kotlin("jvm")
kotlin("jvm") version "1.5.31" id("org.jetbrains.compose")
// __LATEST_COMPOSE_RELEASE_VERSION__
id("org.jetbrains.compose") version "1.0.0"
} }
group = "me.user" group = "me.user"

View File

@@ -1 +1,3 @@
kotlin.code.style=official kotlin.code.style=official
kotlin.version=1.5.31
compose.version=1.0.0

View File

@@ -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" rootProject.name = "falling_balls"

View File

@@ -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 { allprojects {
repositories { repositories {
google() google()

View File

@@ -18,4 +18,7 @@ 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 code style for this project: "official" or "obsolete": # Kotlin code style for this project: "official" or "obsolete":
kotlin.code.style=official kotlin.code.style=official
kotlin.version=1.5.31
agp.version=4.2.2
compose.version=1.0.0

View File

@@ -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") include(":common", ":android", ":desktop")

View File

@@ -3,9 +3,8 @@ import org.jetbrains.compose.compose
plugins { plugins {
id("org.jetbrains.intellij") version "1.1.4" id("org.jetbrains.intellij") version "1.1.4"
java java
kotlin("jvm") version "1.5.31" kotlin("jvm")
// __LATEST_COMPOSE_RELEASE_VERSION__ id("org.jetbrains.compose")
id("org.jetbrains.compose") version "1.0.0"
id("idea") id("idea")
} }

View File

@@ -1 +1,3 @@
kotlin.code.style=official kotlin.code.style=official
kotlin.version=1.5.31
compose.version=1.0.0

View File

@@ -1,9 +1,8 @@
rootProject.name = "ComposeDemoPlugin" rootProject.name = "ComposeDemoPlugin"
pluginManagement { pluginManagement {
repositories { plugins {
gradlePluginPortal() kotlin("jvm").version(extra["kotlin.version"] as String)
mavenCentral() id("org.jetbrains.compose").version(extra["compose.version"] as String)
maven { url = uri("https://maven.pkg.jetbrains.space/public/p/compose/dev") }
} }
} }

View File

@@ -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 { allprojects {
repositories { repositories {
mavenLocal() mavenLocal()

View File

@@ -18,4 +18,7 @@ kotlin.code.style=official
# https://developer.android.com/topic/libraries/support-library/androidx-rn # https://developer.android.com/topic/libraries/support-library/androidx-rn
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.5.31
agp.version=4.2.2
compose.version=1.0.0

View File

@@ -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") include(":common", ":android", ":desktop")

View File

@@ -2,10 +2,8 @@ import org.jetbrains.compose.compose
import org.jetbrains.compose.desktop.application.dsl.TargetFormat import org.jetbrains.compose.desktop.application.dsl.TargetFormat
plugins { plugins {
// __KOTLIN_COMPOSE_VERSION__ kotlin("jvm")
kotlin("jvm") version "1.5.31" id("org.jetbrains.compose")
// __LATEST_COMPOSE_RELEASE_VERSION__
id("org.jetbrains.compose") version ("1.0.0")
} }
repositories { repositories {

View File

@@ -1,2 +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.5.31
compose.version=1.0.0

View File

@@ -3,4 +3,9 @@ pluginManagement {
gradlePluginPortal() gradlePluginPortal()
maven("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)
}
}

View File

@@ -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 { allprojects {
repositories { repositories {
google() google()

View File

@@ -18,4 +18,7 @@ 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 code style for this project: "official" or "obsolete": # Kotlin code style for this project: "official" or "obsolete":
kotlin.code.style=official kotlin.code.style=official
kotlin.version=1.5.31
agp.version=4.2.2
compose.version=1.0.0

View File

@@ -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") include(":common", ":android", ":desktop")

View File

@@ -10,8 +10,8 @@ repositories {
} }
dependencies { dependencies {
implementation(Deps.JetBrains.Compose.gradlePlugin) implementation(Deps.JetBrains.Compose(project).gradlePlugin)
implementation(Deps.JetBrains.Kotlin.gradlePlugin) implementation(Deps.JetBrains.Kotlin(project).gradlePlugin)
implementation(Deps.Android.Tools.Build.gradlePlugin) implementation(Deps.Android.Tools.Build.gradlePlugin)
implementation(Deps.Squareup.SQLDelight.gradlePlugin) implementation(Deps.Squareup.SQLDelight.gradlePlugin)
} }

View File

@@ -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 JetBrains {
object Kotlin { class Kotlin(private val project: Project) {
// __KOTLIN_COMPOSE_VERSION__ private val VERSION = project.properties["kotlin.version"]
private const val VERSION = "1.5.31" val gradlePlugin = "org.jetbrains.kotlin:kotlin-gradle-plugin:$VERSION"
const val gradlePlugin = "org.jetbrains.kotlin:kotlin-gradle-plugin:$VERSION" val testCommon = "org.jetbrains.kotlin:kotlin-test-common:$VERSION"
const val testCommon = "org.jetbrains.kotlin:kotlin-test-common:$VERSION" val testJunit = "org.jetbrains.kotlin:kotlin-test-junit:$VERSION"
const val testJunit = "org.jetbrains.kotlin:kotlin-test-junit:$VERSION" val testJs = "org.jetbrains.kotlin:kotlin-test-js:$VERSION"
const val testJs = "org.jetbrains.kotlin:kotlin-test-js:$VERSION" val testAnnotationsCommon = "org.jetbrains.kotlin:kotlin-test-annotations-common:$VERSION"
const val testAnnotationsCommon = "org.jetbrains.kotlin:kotlin-test-annotations-common:$VERSION"
} }
object Compose { class Compose(private val project: Project) {
// __LATEST_COMPOSE_RELEASE_VERSION__ private val VERSION = project.properties["compose.version"]
private const val VERSION = "1.0.0" val gradlePlugin = "org.jetbrains.compose:compose-gradle-plugin:$VERSION"
const val gradlePlugin = "org.jetbrains.compose:compose-gradle-plugin:$VERSION"
} }
} }

View File

@@ -0,0 +1,2 @@
kotlin.version=1.5.31
compose.version=1.0.0

View File

@@ -15,24 +15,24 @@ kotlin {
sourceSets { sourceSets {
named("commonTest") { named("commonTest") {
dependencies { dependencies {
implementation(Deps.JetBrains.Kotlin.testCommon) implementation(Deps.JetBrains.Kotlin(project).testCommon)
implementation(Deps.JetBrains.Kotlin.testAnnotationsCommon) implementation(Deps.JetBrains.Kotlin(project).testAnnotationsCommon)
} }
} }
named("androidTest") { named("androidTest") {
dependencies { dependencies {
implementation(Deps.JetBrains.Kotlin.testJunit) implementation(Deps.JetBrains.Kotlin(project).testJunit)
} }
} }
named("desktopTest") { named("desktopTest") {
dependencies { dependencies {
implementation(Deps.JetBrains.Kotlin.testJunit) implementation(Deps.JetBrains.Kotlin(project).testJunit)
} }
} }
named("jsTest") { named("jsTest") {
dependencies { dependencies {
implementation(Deps.JetBrains.Kotlin.testJs) implementation(Deps.JetBrains.Kotlin(project).testJs)
} }
} }
} }

View File

@@ -3,10 +3,8 @@ import org.jetbrains.compose.desktop.application.dsl.TargetFormat
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins { plugins {
// __KOTLIN_COMPOSE_VERSION__ kotlin("jvm")
kotlin("jvm") version "1.5.31" id("org.jetbrains.compose")
// __LATEST_COMPOSE_RELEASE_VERSION__
id("org.jetbrains.compose") version "1.0.0"
} }
group = "me.user" group = "me.user"

View File

@@ -1 +1,3 @@
kotlin.code.style=official kotlin.code.style=official
kotlin.version=1.5.31
compose.version=1.0.0

View File

@@ -1,10 +1,13 @@
pluginManagement { pluginManagement {
repositories { repositories {
gradlePluginPortal() gradlePluginPortal()
mavenCentral() maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
maven { url = uri("https://maven.pkg.jetbrains.space/public/p/compose/dev") }
} }
}
rootProject.name = "visual-effects"
plugins {
kotlin("jvm").version(extra["kotlin.version"] as String)
id("org.jetbrains.compose").version(extra["compose.version"] as String)
}
}
rootProject.name = "visual-effects"

View File

@@ -1,8 +1,8 @@
import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension
plugins { plugins {
kotlin("multiplatform") version "1.5.31" kotlin("multiplatform")
id("org.jetbrains.compose") version "1.0.0" id("org.jetbrains.compose")
} }
group = "com.theapache64.composebird" group = "com.theapache64.composebird"
version = "1.0.0-alpha01" version = "1.0.0-alpha01"

View File

@@ -1,2 +1,4 @@
kotlin.code.style=official kotlin.code.style=official
org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=1024m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=1024m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
kotlin.version=1.5.31
compose.version=1.0.0

View File

@@ -1,9 +1,15 @@
pluginManagement { pluginManagement {
repositories { repositories {
gradlePluginPortal() gradlePluginPortal()
mavenCentral()
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev") 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" rootProject.name = "web-compose-bird"

View File

@@ -1,8 +1,8 @@
import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension
plugins { plugins {
kotlin("multiplatform") version "1.5.31" kotlin("multiplatform")
id("org.jetbrains.compose") version "1.0.0" id("org.jetbrains.compose")
} }
repositories { repositories {

View File

@@ -1 +1,3 @@
kotlin.code.style=official kotlin.code.style=official
kotlin.version=1.5.31
compose.version=1.0.0

View File

@@ -2,10 +2,14 @@ pluginManagement {
repositories { repositories {
gradlePluginPortal() gradlePluginPortal()
mavenCentral() mavenCentral()
maven { url = uri("https://maven.pkg.jetbrains.space/public/p/compose/dev") } 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 = "compose-web-lp" rootProject.name = "compose-web-lp"

View File

@@ -1,7 +1,7 @@
import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension
plugins { plugins {
kotlin("multiplatform") version "1.5.31" kotlin("multiplatform")
id("org.jetbrains.compose") version "1.0.0" id("org.jetbrains.compose")
} }
repositories { repositories {

View File

@@ -1 +1,3 @@
kotlin.code.style=official kotlin.code.style=official
kotlin.version=1.5.31
compose.version=1.0.0

View File

@@ -1,8 +1,13 @@
pluginManagement { pluginManagement {
repositories { repositories {
gradlePluginPortal() gradlePluginPortal()
mavenCentral()
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev") 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)
} }
} }

View File

@@ -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 { allprojects {
repositories { repositories {
google() google()

View File

@@ -18,4 +18,7 @@ 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 code style for this project: "official" or "obsolete": # Kotlin code style for this project: "official" or "obsolete":
kotlin.code.style=official kotlin.code.style=official
kotlin.version=1.5.31
compose.version=1.0.0
agp.version=4.2.2

View File

@@ -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") include(":common", ":android", ":desktop")

View File

@@ -20,9 +20,7 @@ function mavenDep {
PLATFORM=macos-x64 PLATFORM=macos-x64
SKIKO_VERSION=0.2.33 SKIKO_VERSION=0.2.33
# __KOTLIN_COMPOSE_VERSION__
KOTLIN_VERSION=1.5.0 KOTLIN_VERSION=1.5.0
# __LATEST_COMPOSE_RELEASE_VERSION__
COMPOSE_VERSION=0.4.0-build209 COMPOSE_VERSION=0.4.0-build209
COROUTINES_VERSION=1.3.6 COROUTINES_VERSION=1.3.6
COLLECTIONS_VERSION=0.3 COLLECTIONS_VERSION=0.3

View File

@@ -4,9 +4,7 @@ import de.undercouch.gradle.tasks.download.Download
import kotlin.text.capitalize import kotlin.text.capitalize
plugins { plugins {
// __KOTLIN_COMPOSE_VERSION__
kotlin("jvm") version "1.5.21" kotlin("jvm") version "1.5.21"
// __LATEST_COMPOSE_RELEASE_VERSION__
id("org.jetbrains.compose") version "1.0.0-alpha1" id("org.jetbrains.compose") version "1.0.0-alpha1"
id("de.undercouch.download") version "4.1.1" id("de.undercouch.download") version "4.1.1"
application application

View File

@@ -9,7 +9,6 @@ buildscript {
dependencies { dependencies {
classpath("org.jetbrains.compose:compose-gradle-plugin:$composeVersion") classpath("org.jetbrains.compose:compose-gradle-plugin:$composeVersion")
// __KOTLIN_COMPOSE_VERSION__
classpath(kotlin("gradle-plugin", version = "1.5.31")) classpath(kotlin("gradle-plugin", version = "1.5.31"))
} }
} }

View File

@@ -2,6 +2,4 @@ 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
# __LATEST_COMPOSE_RELEASE_VERSION__
compose.version=1.0.0 compose.version=1.0.0

View File

@@ -2,10 +2,8 @@ import org.jetbrains.compose.compose
import org.jetbrains.compose.desktop.application.dsl.TargetFormat import org.jetbrains.compose.desktop.application.dsl.TargetFormat
plugins { plugins {
// __KOTLIN_COMPOSE_VERSION__
kotlin("jvm") version "1.5.31" kotlin("jvm") version "1.5.31"
// __LATEST_COMPOSE_RELEASE_VERSION__ id("org.jetbrains.compose") version "1.0.0"
id("org.jetbrains.compose") version (System.getenv("COMPOSE_TEMPLATE_COMPOSE_VERSION") ?: "1.0.0")
} }
repositories { repositories {

View File

@@ -1,7 +1,6 @@
import com.gradle.publish.PluginBundleExtension import com.gradle.publish.PluginBundleExtension
plugins { plugins {
// __KOTLIN_COMPOSE_VERSION__
kotlin("jvm") version "1.5.10" apply false kotlin("jvm") version "1.5.10" apply false
id("com.gradle.plugin-publish") version "0.17.0" apply false id("com.gradle.plugin-publish") version "0.17.0" apply false
} }

View File

@@ -7,7 +7,6 @@ package org.jetbrains.compose.test
@Suppress("EnumEntryName") @Suppress("EnumEntryName")
enum class TestKotlinVersion(val versionString: String) { enum class TestKotlinVersion(val versionString: String) {
// __KOTLIN_COMPOSE_VERSION__
Default("1.5.31"), Default("1.5.31"),
V1_5_20("1.5.20") V1_5_20("1.5.20")
} }

View File

@@ -5,7 +5,6 @@ kotlin.code.style=official
# that will be used by published Gradle plugin, # that will be used by published Gradle plugin,
# unless overridden by COMPOSE_GRADLE_PLUGIN_COMPOSE_VERSION env var. # unless overridden by COMPOSE_GRADLE_PLUGIN_COMPOSE_VERSION env var.
# #
# __LATEST_COMPOSE_RELEASE_VERSION__
compose.version=1.0.0 compose.version=1.0.0
compose.with.web=false compose.with.web=false

View File

@@ -5,9 +5,7 @@ buildscript {
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev") maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
} }
dependencies { dependencies {
// __LATEST_COMPOSE_RELEASE_VERSION__
classpath("org.jetbrains.compose:compose-gradle-plugin:0.0.9-preview-images") classpath("org.jetbrains.compose:compose-gradle-plugin:0.0.9-preview-images")
// __KOTLIN_COMPOSE_VERSION__
classpath(kotlin("gradle-plugin", version = "1.5.31")) classpath(kotlin("gradle-plugin", version = "1.5.31"))
} }
} }

View File

@@ -2,10 +2,8 @@ import org.jetbrains.compose.compose
import org.jetbrains.compose.desktop.application.dsl.TargetFormat import org.jetbrains.compose.desktop.application.dsl.TargetFormat
plugins { plugins {
// __KOTLIN_COMPOSE_VERSION__ kotlin("jvm")
kotlin("jvm") version "1.5.31" id("org.jetbrains.compose")
// __LATEST_COMPOSE_RELEASE_VERSION__
id("org.jetbrains.compose") version (System.getenv("COMPOSE_TEMPLATE_COMPOSE_VERSION") ?: "1.0.0")
} }
repositories { repositories {

View File

@@ -1,2 +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.5.31
compose.version=1.0.0

View File

@@ -3,4 +3,9 @@ pluginManagement {
gradlePluginPortal() gradlePluginPortal()
maven("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)
}
}

View File

@@ -10,6 +10,7 @@
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/Theme.AppCompat.Light.NoActionBar"> android:theme="@style/Theme.AppCompat.Light.NoActionBar">
<activity <activity
android:exported="true"
android:name=".MainActivity" android:name=".MainActivity"
android:label="@string/app_name"> android:label="@string/app_name">
<intent-filter> <intent-filter>

View File

@@ -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 { allprojects {
repositories { repositories {
google() google()

View File

@@ -1,4 +1,7 @@
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 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.5.31
agp.version=4.2.2
compose.version=1.0.0

View File

@@ -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") include(":common", ":android", ":desktop")

View File

@@ -3,10 +3,8 @@ import org.jetbrains.compose.desktop.application.dsl.TargetFormat
import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension
plugins { plugins {
// __KOTLIN_COMPOSE_VERSION__ kotlin("multiplatform")
kotlin("multiplatform") version "1.5.31" id("org.jetbrains.compose")
// __LATEST_COMPOSE_RELEASE_VERSION__
id("org.jetbrains.compose") version ("1.0.0")
} }
repositories { repositories {
@@ -35,7 +33,7 @@ kotlin {
// a temporary workaround for a bug in jsRun invocation - see https://youtrack.jetbrains.com/issue/KT-48273 // a temporary workaround for a bug in jsRun invocation - see https://youtrack.jetbrains.com/issue/KT-48273
afterEvaluate { afterEvaluate {
rootProject.extensions.configure<NodeJsRootExtension> { rootProject.extensions.configure<NodeJsRootExtension> {
versions.webpackDevServer.version = "4.0.0" versions.webpackDevServer.version = "4.0.0"
versions.webpackCli.version = "4.9.0" versions.webpackCli.version = "4.9.0"
} }

View File

@@ -1,2 +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.5.31
compose.version=1.0.0

View File

@@ -3,4 +3,9 @@ pluginManagement {
gradlePluginPortal() gradlePluginPortal()
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev") 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)
}
} }

View File

@@ -1,13 +1,51 @@
#!/bin/bash #!/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 )"/.. ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"/..
COMPOSE_OLDVER=0.4.0-rc2
COMPOSE_NEWVER=0.4.0 # Add folders which should contain up-to-date versions
find -E $ROOT -regex '.*\.(kts|properties|kt)' -exec sed -i '' -e "s/$COMPOSE_OLDVER/$COMPOSE_NEWVER/g" {} \; declare -a folders=(
APPCOMPAT_OLDVER=1.1.0 "templates"
APPCOMPAT_NEWVER=1.3.0-beta01 "examples"
find -E $ROOT -regex '.*\.(kts|properties|kt)' -exec sed -i '' -e "s/$APPCOMPAT_OLDVER/$APPCOMPAT_NEWVER/g" {} \; "gradle-plugins"
KOTLIN_OLDVER=1.5.10 "components"
KOTLIN_NEWVER=1.5.10 "ci"
find -E $ROOT -regex '.*\.(kts|properties|kt)' -exec sed -i '' -e "s/$KOTLIN_OLDVER/$KOTLIN_NEWVER/g" {} \; "web"
git grep -C 1 __KOTLIN_COMPOSE_VERSION__ $ROOT "tutorials"
git grep -C 1 __LATEST_COMPOSE_RELEASE_VERSION__ $ROOT )
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

View File

@@ -40,7 +40,7 @@ just search for "Compose Multiplatform".
### Update the wizard plugin ### 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 { plugins {
kotlin("jvm") version "1.5.31" kotlin("jvm") version "1.5.31"

View File

@@ -50,18 +50,31 @@ fun cloneTemplate(template: String, index: Int, content: String): File {
return tempDir return tempDir
} }
@OptIn(ExperimentalStdlibApi::class)
fun checkDirs(dirs: List<String>, template: String, buildCmd: String = "build") { fun checkDirs(dirs: List<String>, template: String, buildCmd: String = "build") {
val snippets = findSnippets(dirs) val snippets = findSnippets(dirs)
snippets.forEachIndexed { index, snippet -> snippets.forEachIndexed { index, snippet ->
println("process snippet $index at ${snippet.file}:${snippet.lineNumber} with $template") println("process snippet $index at ${snippet.file}:${snippet.lineNumber} with $template")
snippet.tempDir = cloneTemplate(template, index, snippet.content) snippet.tempDir = cloneTemplate(template, index, snippet.content)
val isWin = System.getProperty("os.name").startsWith("Win") val isWin = System.getProperty("os.name").startsWith("Win")
val procBuilder = if (isWin) { val args = buildList {
ProcessBuilder("gradlew.bat", "$buildCmd") if (isWin) {
} else { add("gradlew.bat")
ProcessBuilder("bash", "./gradlew", "$buildCmd") } 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) .directory(snippet.tempDir)
.redirectOutput(ProcessBuilder.Redirect.PIPE) .redirectOutput(ProcessBuilder.Redirect.PIPE)
.redirectError(ProcessBuilder.Redirect.PIPE) .redirectError(ProcessBuilder.Redirect.PIPE)

View File

@@ -1,9 +1,8 @@
RUN from project root directory: RUN from project root directory:
`./gradlew :compose-compiler-integration:checkComposeCases` `./gradlew :compose-compiler-integration:checkComposeCases`
To use specific version:
To use specific version (the default is 0.0.0-SNASPHOT): `./gradlew :compose-compiler-integration:checkComposeCases -PCOMPOSE_CORE_VERSION=1.0.0 -PCOMPOSE_WEB_VERSION=1.0.0
`./gradlew :compose-compiler-integration:checkComposeCases -PCOMPOSE_CORE_VERSION=0.5.0-build243`
To fun only filtered cases (check for contained in file path): To fun only filtered cases (check for contained in file path):
`./gradlew :compose-compiler-integration:checkComposeCases -PFILTER_CASES=CaseName` `./gradlew :compose-compiler-integration:checkComposeCases -PFILTER_CASES=CaseName`

View File

@@ -1,4 +1,3 @@
# __LATEST_COMPOSE_RELEASE_VERSION__
COMPOSE_CORE_VERSION=1.0.0 COMPOSE_CORE_VERSION=1.0.0
COMPOSE_WEB_VERSION=1.0.0 COMPOSE_WEB_VERSION=1.0.0
compose.web.buildSamples=false compose.web.buildSamples=false