Roman Elizarov | 85b1a2b | 2020-09-14 17:48:17 +0300 | [diff] [blame] | 1 | /* |
Aurimas Liutikas | e64dad7 | 2021-05-12 21:56:16 +0000 | [diff] [blame] | 2 | * Copyright 2016-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. |
Roman Elizarov | 85b1a2b | 2020-09-14 17:48:17 +0300 | [diff] [blame] | 3 | */ |
| 4 | |
Victor Turansky | 964cd92 | 2020-05-02 19:52:56 +0300 | [diff] [blame] | 5 | import java.util.* |
| 6 | |
Victor Turansky | 64d23a0 | 2020-04-24 15:41:07 +0300 | [diff] [blame] | 7 | plugins { |
| 8 | `kotlin-dsl` |
| 9 | } |
| 10 | |
Roman Elizarov | 85b1a2b | 2020-09-14 17:48:17 +0300 | [diff] [blame] | 11 | val cacheRedirectorEnabled = System.getenv("CACHE_REDIRECTOR")?.toBoolean() == true |
Vsevolod Tolstopyatov | 22c4301 | 2020-10-23 07:32:51 -0700 | [diff] [blame] | 12 | val buildSnapshotTrain = properties["build_snapshot_train"]?.toString()?.toBoolean() == true |
Roman Elizarov | 85b1a2b | 2020-09-14 17:48:17 +0300 | [diff] [blame] | 13 | |
Victor Turansky | 64d23a0 | 2020-04-24 15:41:07 +0300 | [diff] [blame] | 14 | repositories { |
Roman Elizarov | 85b1a2b | 2020-09-14 17:48:17 +0300 | [diff] [blame] | 15 | if (cacheRedirectorEnabled) { |
| 16 | maven("https://cache-redirector.jetbrains.com/plugins.gradle.org/m2") |
Aurimas Liutikas | e64dad7 | 2021-05-12 21:56:16 +0000 | [diff] [blame] | 17 | maven("https://cache-redirector.jetbrains.com/dl.bintray.com/kotlin/kotlin-eap") |
Roman Elizarov | 85b1a2b | 2020-09-14 17:48:17 +0300 | [diff] [blame] | 18 | maven("https://cache-redirector.jetbrains.com/dl.bintray.com/kotlin/kotlin-dev") |
| 19 | } else { |
| 20 | maven("https://plugins.gradle.org/m2") |
Aurimas Liutikas | e64dad7 | 2021-05-12 21:56:16 +0000 | [diff] [blame] | 21 | maven("https://dl.bintray.com/kotlin/kotlin-eap") |
Roman Elizarov | 85b1a2b | 2020-09-14 17:48:17 +0300 | [diff] [blame] | 22 | maven("https://dl.bintray.com/kotlin/kotlin-dev") |
| 23 | } |
Vsevolod Tolstopyatov | 22c4301 | 2020-10-23 07:32:51 -0700 | [diff] [blame] | 24 | |
| 25 | if (buildSnapshotTrain) { |
| 26 | mavenLocal() |
| 27 | } |
Victor Turansky | 64d23a0 | 2020-04-24 15:41:07 +0300 | [diff] [blame] | 28 | } |
| 29 | |
| 30 | kotlinDslPluginOptions { |
| 31 | experimentalWarning.set(false) |
| 32 | } |
Victor Turansky | 964cd92 | 2020-05-02 19:52:56 +0300 | [diff] [blame] | 33 | |
Vsevolod Tolstopyatov | 3af136f | 2020-10-05 10:07:06 -0700 | [diff] [blame] | 34 | val props = Properties().apply { |
Victor Turansky | 964cd92 | 2020-05-02 19:52:56 +0300 | [diff] [blame] | 35 | file("../gradle.properties").inputStream().use { load(it) } |
| 36 | } |
| 37 | |
Vsevolod Tolstopyatov | 22c4301 | 2020-10-23 07:32:51 -0700 | [diff] [blame] | 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 | } |
Victor Turansky | 964cd92 | 2020-05-02 19:52:56 +0300 | [diff] [blame] | 46 | |
| 47 | dependencies { |
| 48 | implementation(kotlin("gradle-plugin", version("kotlin"))) |
| 49 | implementation("org.jetbrains.dokka:dokka-gradle-plugin:${version("dokka")}") |
| 50 | } |