• 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 
<lambda>null14 repositories {
15     mavenCentral()
16     if (cacheRedirectorEnabled) {
17         maven("https://cache-redirector.jetbrains.com/plugins.gradle.org/m2")
18     } else {
19         maven("https://plugins.gradle.org/m2")
20     }
21     maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev")
22     if (buildSnapshotTrain) {
23         mavenLocal()
24     }
25 }
26 
<lambda>null27 kotlinDslPluginOptions {
28     experimentalWarning.set(false)
29 }
30 
<lambda>null31 val props = Properties().apply {
32     file("../gradle.properties").inputStream().use { load(it) }
33 }
34 
versionnull35 fun version(target: String): String {
36     // Intercept reading from properties file
37     if (target == "kotlin") {
38         val snapshotVersion = properties["kotlin_snapshot_version"]
39         if (snapshotVersion != null) return snapshotVersion.toString()
40     }
41     return props.getProperty("${target}_version")
42 }
43 
<lambda>null44 dependencies {
45     implementation(kotlin("gradle-plugin", version("kotlin")))
46     /*
47      * Dokka is compiled with language level = 1.4, but depends on Kotlin 1.6.0, while
48      * our version of Gradle bundles Kotlin 1.4.x and can read metadata only up to 1.5.x,
49      * thus we're excluding stdlib compiled with 1.6.0 from dependencies.
50      */
51     implementation("org.jetbrains.dokka:dokka-gradle-plugin:${version("dokka")}") {
52         exclude(group = "org.jetbrains.kotlin", module = "kotlin-stdlib-jdk8")
53         exclude(group = "org.jetbrains.kotlin", module = "kotlin-stdlib-jdk7")
54         exclude(group = "org.jetbrains.kotlin", module = "kotlin-stdlib")
55     }
56     implementation("org.jetbrains.dokka:dokka-core:${version("dokka")}") {
57         exclude(group = "org.jetbrains.kotlin", module = "kotlin-stdlib-jdk8")
58         exclude(group = "org.jetbrains.kotlin", module = "kotlin-stdlib-jdk7")
59         exclude(group = "org.jetbrains.kotlin", module = "kotlin-stdlib")
60     }
61     implementation("ru.vyarus:gradle-animalsniffer-plugin:1.5.3") // Android API check
62     implementation("org.jetbrains.kotlinx:kover:${version("kover")}") {
63         exclude(group = "org.jetbrains.kotlin", module = "kotlin-stdlib-jdk8")
64         exclude(group = "org.jetbrains.kotlin", module = "kotlin-stdlib-jdk7")
65         exclude(group = "org.jetbrains.kotlin", module = "kotlin-stdlib")
66     }
67 }
68