Browse Source

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
pull/102/head
Alexey Tsvetkov 4 years ago committed by Alexey Tsvetkov
parent
commit
ad0b6fc916
  1. 9
      gradle-plugins/buildSrc/src/main/kotlin/BuildProperties.kt
  2. 11
      gradle-plugins/gradle.properties

9
gradle-plugins/buildSrc/src/main/kotlin/BuildProperties.kt

@ -7,8 +7,9 @@ object BuildProperties {
const val website = "https://jetbrains.org/compose" const val website = "https://jetbrains.org/compose"
const val vcs = "https://github.com/JetBrains/compose-jb" const val vcs = "https://github.com/JetBrains/compose-jb"
fun composeVersion(project: Project): String = fun composeVersion(project: Project): String =
project.findProperty("compose.version") as? String System.getenv("COMPOSE_GRADLE_PLUGIN_COMPOSE_VERSION")
?: System.getenv("COMPOSE_GRADLE_PLUGIN_COMPOSE_VERSION") ?: project.findProperty("compose.version") as String
?: "0.1.0-SNAPSHOT" fun deployVersion(project: Project): String =
fun deployVersion(project: Project): String = System.getenv("COMPOSE_GRADLE_PLUGIN_VERSION") ?: composeVersion(project) System.getenv("COMPOSE_GRADLE_PLUGIN_VERSION")
?: project.findProperty("deploy.version") as String
} }

11
gradle-plugins/gradle.properties

@ -1,4 +1,13 @@
org.gradle.parallel=true org.gradle.parallel=true
kotlin.code.style=official kotlin.code.style=official
#compose.version=0.1.0-m1-build57 # 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
Loading…
Cancel
Save