xref: /aosp_15_r20/external/kotlinx.serialization/buildSrc/build.gradle.kts (revision 57b5a4a64c534cf7f27ac9427ceab07f3d8ed3d8)
1 /*
<lambda>null2  * Copyright 2017-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
3  */
4 
5 import java.util.*
6 import java.io.FileInputStream
7 
8 plugins {
9     `kotlin-dsl`
10 }
11 
<lambda>null12 repositories {
13     mavenCentral()
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")
20 }
21 
<lambda>null22 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     }
39 }
40 
<lambda>null41 dependencies {
42     implementation(kotlin("gradle-plugin", kotlinVersion))
43 }
44 
45