Skip to content

Commit 22c4301

Browse files
authored
Propagate kotlin_snapshot_version to buildSrc and kts files (#2332)
1 parent 3275d22 commit 22c4301

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

buildSrc/build.gradle.kts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ plugins {
99
}
1010

1111
val cacheRedirectorEnabled = System.getenv("CACHE_REDIRECTOR")?.toBoolean() == true
12+
val buildSnapshotTrain = properties["build_snapshot_train"]?.toString()?.toBoolean() == true
1213

1314
repositories {
1415
if (cacheRedirectorEnabled) {
@@ -20,6 +21,10 @@ repositories {
2021
maven("https://dl.bintray.com/kotlin/kotlin-eap")
2122
maven("https://dl.bintray.com/kotlin/kotlin-dev")
2223
}
24+
25+
if (buildSnapshotTrain) {
26+
mavenLocal()
27+
}
2328
}
2429

2530
kotlinDslPluginOptions {
@@ -30,8 +35,14 @@ val props = Properties().apply {
3035
file("../gradle.properties").inputStream().use { load(it) }
3136
}
3237

33-
fun version(target: String): String =
34-
props.getProperty("${target}_version")
38+
fun version(target: String): String {
39+
// Intercept reading from properties file
40+
if (target == "kotlin") {
41+
val snapshotVersion = properties["kotlin_snapshot_version"]
42+
if (snapshotVersion != null) return snapshotVersion.toString()
43+
}
44+
return props.getProperty("${target}_version")
45+
}
3546

3647
dependencies {
3748
implementation(kotlin("gradle-plugin", version("kotlin")))

buildSrc/settings.gradle.kts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
/*
22
* Copyright 2016-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
33
*/
4-
54
pluginManagement {
5+
val build_snapshot_train: String? by settings
66
repositories {
77
val cacheRedirectorEnabled = System.getenv("CACHE_REDIRECTOR")?.toBoolean() == true
8-
98
if (cacheRedirectorEnabled) {
109
println("Redirecting repositories for buildSrc buildscript")
11-
1210
maven("https://cache-redirector.jetbrains.com/plugins.gradle.org/m2")
1311
} else {
1412
maven("https://plugins.gradle.org/m2")
1513
}
14+
if (build_snapshot_train?.toBoolean() == true) {
15+
mavenLocal()
16+
}
1617
}
1718
}

0 commit comments

Comments
 (0)