From ad0b6fc916ae3c993bb96eea11ca8ee606e4afde Mon Sep 17 00:00:00 2001 From: Alexey Tsvetkov Date: Thu, 12 Nov 2020 12:50:19 +0300 Subject: [PATCH] Provide default value for Compose version for Gradle plugin There are two versions used in the Gradle plugin: * The version of the plugin itself; * The version of Compose dependency used by the plugin. On CI both versions are set to the same value specific to the build. However, locally using 0.1.0-SNAPSHOT for the Compose version is inconvenient, because we don't publish 0.1.0-SNAPSHOT anywhere. Even if it existed, a moving version is not convenient for using in tests. This commit changes version handling: * The version of Compose is set via `compose.version` Gradle property to the latest stable version, unless overridden by `COMPOSE_GRADLE_PLUGIN_COMPOSE_VERSION` env. var. * The version of the plugin is set via `deploy.version` Gradle property to 0.1.0-SNAPSHOT, unless overridden by `COMPOSE_GRADLE_PLUGIN_VERSION` env. var --- .../buildSrc/src/main/kotlin/BuildProperties.kt | 9 +++++---- gradle-plugins/gradle.properties | 11 ++++++++++- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/gradle-plugins/buildSrc/src/main/kotlin/BuildProperties.kt b/gradle-plugins/buildSrc/src/main/kotlin/BuildProperties.kt index 18115620..8afb7c76 100644 --- a/gradle-plugins/buildSrc/src/main/kotlin/BuildProperties.kt +++ b/gradle-plugins/buildSrc/src/main/kotlin/BuildProperties.kt @@ -7,8 +7,9 @@ object BuildProperties { const val website = "https://jetbrains.org/compose" const val vcs = "https://github.com/JetBrains/compose-jb" fun composeVersion(project: Project): String = - project.findProperty("compose.version") as? String - ?: System.getenv("COMPOSE_GRADLE_PLUGIN_COMPOSE_VERSION") - ?: "0.1.0-SNAPSHOT" - fun deployVersion(project: Project): String = System.getenv("COMPOSE_GRADLE_PLUGIN_VERSION") ?: composeVersion(project) + System.getenv("COMPOSE_GRADLE_PLUGIN_COMPOSE_VERSION") + ?: project.findProperty("compose.version") as String + fun deployVersion(project: Project): String = + System.getenv("COMPOSE_GRADLE_PLUGIN_VERSION") + ?: project.findProperty("deploy.version") as String } diff --git a/gradle-plugins/gradle.properties b/gradle-plugins/gradle.properties index 2273c3c8..23cf8d30 100644 --- a/gradle-plugins/gradle.properties +++ b/gradle-plugins/gradle.properties @@ -1,4 +1,13 @@ org.gradle.parallel=true kotlin.code.style=official -#compose.version=0.1.0-m1-build57 \ No newline at end of file +# A version of Compose libraries, +# that will be used by published Gradle plugin, +# unless overridden by COMPOSE_GRADLE_PLUGIN_COMPOSE_VERSION env var. +# +# __LATEST_COMPOSE_RELEASE_VERSION__ +compose.version=0.1.0-build113 + +# A version of Gradle plugin, that will be published, +# unless overridden by COMPOSE_GRADLE_PLUGIN_VERSION env var. +deploy.version=0.1.0-SNAPSHOT \ No newline at end of file