Clara Fok | 93e1812 | 2024-04-23 10:28:10 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2017-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. |
| 3 | */ |
| 4 | |
Sergey Shanshin | 4236a7e | 2021-02-03 22:32:37 +0300 | [diff] [blame] | 5 | import java.util.* |
Leonid Startsev | 920f589 | 2021-09-06 15:09:45 +0300 | [diff] [blame] | 6 | import java.io.FileInputStream |
Sergey Shanshin | 4236a7e | 2021-02-03 22:32:37 +0300 | [diff] [blame] | 7 | |
| 8 | plugins { |
| 9 | `kotlin-dsl` |
| 10 | } |
| 11 | |
| 12 | repositories { |
Leonid Startsev | 6a8dc86 | 2021-02-04 17:03:31 +0300 | [diff] [blame] | 13 | mavenCentral() |
Clara Fok | 93e1812 | 2024-04-23 10:28:10 -0700 | [diff] [blame] | 14 | mavenLocal() |
| 15 | if (project.hasProperty("kotlin_repo_url")) { |
| 16 | maven(project.properties["kotlin_repo_url"] as String) |
| 17 | } |
| 18 | // kotlin-dev with space redirector |
| 19 | maven("https://cache-redirector.jetbrains.com/maven.pkg.jetbrains.space/kotlin/p/kotlin/dev") |
Sergey Shanshin | 4236a7e | 2021-02-03 22:32:37 +0300 | [diff] [blame] | 20 | } |
| 21 | |
Clara Fok | 93e1812 | 2024-04-23 10:28:10 -0700 | [diff] [blame] | 22 | val kotlinVersion = run { |
| 23 | if (project.hasProperty("build_snapshot_train")) { |
| 24 | val ver = project.properties["kotlin_snapshot_version"] as? String |
| 25 | require(!ver.isNullOrBlank()) {"kotlin_snapshot_version must be present if build_snapshot_train is used" } |
| 26 | return@run ver |
| 27 | } |
| 28 | if (project.hasProperty("kotlin_repo_url")) { |
| 29 | val ver = project.properties["kotlin_version"] as? String |
| 30 | require(!ver.isNullOrBlank()) {"kotlin_version must be present if kotlin_repo_url is used" } |
| 31 | return@run ver |
| 32 | } |
| 33 | val targetProp = if (project.hasProperty("bootstrap")) "kotlin.version.snapshot" else "kotlin.version" |
| 34 | FileInputStream(file("../gradle.properties")).use { propFile -> |
| 35 | val ver = project.findProperty("kotlin.version")?.toString() ?: Properties().apply { load(propFile) }[targetProp] |
| 36 | require(ver is String) { "$targetProp must be string in ../gradle.properties, got $ver instead" } |
| 37 | ver |
| 38 | } |
Leonid Startsev | 920f589 | 2021-09-06 15:09:45 +0300 | [diff] [blame] | 39 | } |
| 40 | |
Gerard de Leeuw | cf6e41a | 2021-09-03 16:08:35 +0200 | [diff] [blame] | 41 | dependencies { |
Gerard de Leeuw | 8384772 | 2021-09-08 17:01:50 +0200 | [diff] [blame] | 42 | implementation(kotlin("gradle-plugin", kotlinVersion)) |
Gerard de Leeuw | cf6e41a | 2021-09-03 16:08:35 +0200 | [diff] [blame] | 43 | } |
| 44 | |