blob: c999bcd262bebf844bf0e4c446da1e6944de1cdf [file] [log] [blame]
Clara Fok93e18122024-04-23 10:28:10 -07001/*
2 * Copyright 2017-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
3 */
4
Sergey Shanshin4236a7e2021-02-03 22:32:37 +03005import java.util.*
Leonid Startsev920f5892021-09-06 15:09:45 +03006import java.io.FileInputStream
Sergey Shanshin4236a7e2021-02-03 22:32:37 +03007
8plugins {
9 `kotlin-dsl`
10}
11
12repositories {
Leonid Startsev6a8dc862021-02-04 17:03:31 +030013 mavenCentral()
Clara Fok93e18122024-04-23 10:28:10 -070014 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 Shanshin4236a7e2021-02-03 22:32:37 +030020}
21
Clara Fok93e18122024-04-23 10:28:10 -070022val 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 Startsev920f5892021-09-06 15:09:45 +030039}
40
Gerard de Leeuwcf6e41a2021-09-03 16:08:35 +020041dependencies {
Gerard de Leeuw83847722021-09-08 17:01:50 +020042 implementation(kotlin("gradle-plugin", kotlinVersion))
Gerard de Leeuwcf6e41a2021-09-03 16:08:35 +020043}
44