• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2016-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
3  */
4 
5 import java.util.*
6 
<lambda>null7 plugins {
8     `kotlin-dsl`
9 }
10 
11 val cacheRedirectorEnabled = System.getenv("CACHE_REDIRECTOR")?.toBoolean() == true
12 val buildSnapshotTrain = properties["build_snapshot_train"]?.toString()?.toBoolean() == true
13 val kotlinDevUrl = project.rootProject.properties["kotlin_repo_url"] as? String
14 
<lambda>null15 repositories {
16     mavenCentral()
17     if (cacheRedirectorEnabled) {
18         maven("https://cache-redirector.jetbrains.com/plugins.gradle.org/m2")
19     } else {
20         maven("https://plugins.gradle.org/m2")
21     }
22     if (!kotlinDevUrl.isNullOrEmpty()) {
23         maven(kotlinDevUrl)
24     }
25     if (buildSnapshotTrain) {
26         mavenLocal()
27     }
28 }
29 
<lambda>null30 val gradleProperties = Properties().apply {
31     file("../gradle.properties").inputStream().use { load(it) }
32 }
33 
versionnull34 fun version(target: String): String {
35     // Intercept reading from properties file
36     if (target == "kotlin") {
37         val snapshotVersion = properties["kotlin_snapshot_version"]
38         if (snapshotVersion != null) return snapshotVersion.toString()
39     }
40     val version = "${target}_version"
41     // Read from CLI first, used in aggregate builds
42     return properties[version]?.let{"$it"} ?: gradleProperties.getProperty(version)
43 }
44 
<lambda>null45 dependencies {
46     implementation(kotlin("gradle-plugin", version("kotlin")))
47     /*
48      * Dokka is compiled with language level = 1.4, but depends on Kotlin 1.6.0, while
49      * our version of Gradle bundles Kotlin 1.4.x and can read metadata only up to 1.5.x,
50      * thus we're excluding stdlib compiled with 1.6.0 from dependencies.
51      */
52     implementation("org.jetbrains.dokka:dokka-gradle-plugin:${version("dokka")}") {
53         exclude(group = "org.jetbrains.kotlin", module = "kotlin-stdlib-jdk8")
54         exclude(group = "org.jetbrains.kotlin", module = "kotlin-stdlib-jdk7")
55         exclude(group = "org.jetbrains.kotlin", module = "kotlin-stdlib")
56     }
57     implementation("org.jetbrains.dokka:dokka-core:${version("dokka")}") {
58         exclude(group = "org.jetbrains.kotlin", module = "kotlin-stdlib-jdk8")
59         exclude(group = "org.jetbrains.kotlin", module = "kotlin-stdlib-jdk7")
60         exclude(group = "org.jetbrains.kotlin", module = "kotlin-stdlib")
61     }
62     implementation("ru.vyarus:gradle-animalsniffer-plugin:1.5.3") // Android API check
63     implementation("org.jetbrains.kotlinx:kover-gradle-plugin:${version("kover")}") {
64         exclude(group = "org.jetbrains.kotlin", module = "kotlin-stdlib-jdk8")
65         exclude(group = "org.jetbrains.kotlin", module = "kotlin-stdlib-jdk7")
66         exclude(group = "org.jetbrains.kotlin", module = "kotlin-stdlib")
67     }
68 }
69