forked from JetBrains/kotlin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
versions.gradle.kts
49 lines (40 loc) · 1.38 KB
/
versions.gradle.kts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import java.util.*
import java.io.*
var propertiesFile = rootProject.file("versions.properties");
if (!propertiesFile.exists()) {
//work-around for buildSrc
propertiesFile = rootProject.file("../versions.properties");
}
FileReader(propertiesFile).use {
val properties = Properties()
properties.load(it)
properties.forEach { (k, v) ->
extra[k.toString()] = v
}
}
val gradleJars = listOf(
"gradle-api",
"gradle-tooling-api",
"gradle-base-services",
"gradle-wrapper",
"gradle-core",
"gradle-base-services-groovy"
)
val androidStudioVersion = if (extra.has("versions.androidStudioRelease"))
extra["versions.androidStudioRelease"]?.toString()?.replace(".", "")?.substring(0, 2)
else
null
val intellijVersion = rootProject.extra["versions.intellijSdk"] as String
val intellijVersionDelimiterIndex = intellijVersion.indexOfAny(charArrayOf('.', '-'))
if (intellijVersionDelimiterIndex == -1) {
error("Invalid IDEA version $intellijVersion")
}
val platformBaseVersion = intellijVersion.substring(0, intellijVersionDelimiterIndex)
val platform = androidStudioVersion?.let { "AS$it" } ?: platformBaseVersion
rootProject.extra["versions.platform"] = platform
for (jar in gradleJars) {
extra["versions.jar.$jar"] = extra["versions.gradle-api"]
}
if (!extra.has("versions.androidStudioRelease")) {
extra["ignore.jar.android-base-common"] = true
}