Roman Elizarov | 26af919 | 2017-09-21 18:12:04 +0300 | [diff] [blame] | 1 | /* |
Leonid Startsev | bc9c8f4 | 2020-04-06 22:30:25 +0300 | [diff] [blame] | 2 | * Copyright 2017-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. |
Roman Elizarov | 26af919 | 2017-09-21 18:12:04 +0300 | [diff] [blame] | 3 | */ |
| 4 | |
Leonid Startsev | 08d3ca0 | 2017-07-26 15:16:23 +0300 | [diff] [blame] | 5 | buildscript { |
Leonid Startsev | ca62091 | 2017-11-09 19:55:51 +0300 | [diff] [blame] | 6 | if (project.hasProperty("bootstrap")) { |
Leonid Startsev | 45aa7c7 | 2019-04-23 21:29:03 +0300 | [diff] [blame] | 7 | ext.kotlin_version = property('kotlin.version.snapshot') |
Leonid Startsev | cea9b43 | 2019-11-19 14:14:26 +0300 | [diff] [blame] | 8 | ext["kotlin.native.home"] = System.getenv("KONAN_LOCAL_DIST") |
Leonid Startsev | ca62091 | 2017-11-09 19:55:51 +0300 | [diff] [blame] | 9 | } else { |
Leonid Startsev | 45aa7c7 | 2019-04-23 21:29:03 +0300 | [diff] [blame] | 10 | ext.kotlin_version = property('kotlin.version') |
Leonid Startsev | ca62091 | 2017-11-09 19:55:51 +0300 | [diff] [blame] | 11 | } |
Leonid Startsev | 78d5d2d | 2019-07-25 13:51:54 +0300 | [diff] [blame] | 12 | if (project.hasProperty("library.version")) { |
| 13 | ext.overriden_version = property('library.version') |
| 14 | } |
Leonid Startsev | b0fd120 | 2018-12-12 19:42:48 +0300 | [diff] [blame] | 15 | ext.experimentalsEnabled = ["-progressive", "-Xuse-experimental=kotlin.Experimental", |
Leonid Startsev | c1bb4d2 | 2018-10-23 18:50:39 +0300 | [diff] [blame] | 16 | "-Xuse-experimental=kotlin.ExperimentalMultiplatform", |
Vsevolod Tolstopyatov | 0d830ae | 2019-09-09 20:06:42 +0300 | [diff] [blame] | 17 | "-Xuse-experimental=kotlinx.serialization.InternalSerializationApi" |
Vsevolod Tolstopyatov | 74b4802 | 2019-04-02 18:56:29 +0300 | [diff] [blame] | 18 | ] |
Leonid Startsev | c1bb4d2 | 2018-10-23 18:50:39 +0300 | [diff] [blame] | 19 | |
Leonid Startsev | b0fd120 | 2018-12-12 19:42:48 +0300 | [diff] [blame] | 20 | ext.experimentalsInTestEnabled = ["-progressive", "-Xuse-experimental=kotlin.Experimental", |
Vsevolod Tolstopyatov | 74b4802 | 2019-04-02 18:56:29 +0300 | [diff] [blame] | 21 | "-Xuse-experimental=kotlin.ExperimentalMultiplatform", |
Vsevolod Tolstopyatov | 419ddb9 | 2020-08-11 05:08:17 -0700 | [diff] [blame] | 22 | "-Xuse-experimental=kotlinx.serialization.ExperimentalSerializationApi", |
Roman Elizarov | 5459c10 | 2020-08-11 12:27:36 +0300 | [diff] [blame] | 23 | "-Xuse-experimental=kotlinx.serialization.InternalSerializationApi", |
| 24 | "-Xuse-experimental=kotlin.ExperimentalUnsignedTypes" |
Vsevolod Tolstopyatov | 74b4802 | 2019-04-02 18:56:29 +0300 | [diff] [blame] | 25 | ] |
Leonid Startsev | 08d3ca0 | 2017-07-26 15:16:23 +0300 | [diff] [blame] | 26 | |
Vsevolod Tolstopyatov | fa2231c | 2019-05-29 17:39:15 +0300 | [diff] [blame] | 27 | /* |
Leonid Startsev | cea9b43 | 2019-11-19 14:14:26 +0300 | [diff] [blame] | 28 | * This property group is used to build kotlinx.serialization against Kotlin compiler snapshot. |
Vsevolod Tolstopyatov | fa2231c | 2019-05-29 17:39:15 +0300 | [diff] [blame] | 29 | * When build_snapshot_train is set to true, kotlin_version property is overridden with kotlin_snapshot_version. |
| 30 | * DO NOT change the name of these properties without adapting kotlinx.train build chain. |
| 31 | */ |
| 32 | def prop = rootProject.properties['build_snapshot_train'] |
| 33 | ext.build_snapshot_train = prop != null && prop != "" |
| 34 | if (build_snapshot_train) { |
| 35 | ext.kotlin_version = rootProject.properties['kotlin_snapshot_version'] |
| 36 | if (kotlin_version == null) { |
| 37 | throw new IllegalArgumentException("'kotlin_snapshot_version' should be defined when building with snapshot compiler") |
| 38 | } |
| 39 | repositories { |
| 40 | mavenLocal() |
| 41 | maven { url "https://oss.sonatype.org/content/repositories/snapshots" } |
| 42 | maven { url "https://bintray.com/jetbrains/kotlin-native-dependencies" } |
| 43 | } |
| 44 | } |
Alexander Likhachev | 2e56542 | 2020-11-17 13:09:24 +0300 | [diff] [blame] | 45 | // These two flags are enabled in train builds for JVM IR compiler testing |
| 46 | ext.jvm_ir_enabled = rootProject.properties['enable_jvm_ir'] != null |
| 47 | ext.jvm_ir_api_check_enabled = rootProject.properties['enable_jvm_ir_api_check'] != null |
Vsevolod Tolstopyatov | fa2231c | 2019-05-29 17:39:15 +0300 | [diff] [blame] | 48 | |
Leonid Startsev | 08d3ca0 | 2017-07-26 15:16:23 +0300 | [diff] [blame] | 49 | repositories { |
Leonid Startsev | 6fbc215 | 2017-09-21 16:18:32 +0300 | [diff] [blame] | 50 | mavenLocal() |
Vsevolod Tolstopyatov | 6995ef1 | 2020-08-24 16:01:54 +0300 | [diff] [blame] | 51 | // Future replacement for kotlin-dev, with cache redirector |
| 52 | maven { url "https://cache-redirector.jetbrains.com/maven.pkg.jetbrains.space/kotlin/p/kotlin/dev" } |
Michael Kuzmin | 4b5cd43 | 2019-12-16 22:53:24 +0300 | [diff] [blame] | 53 | maven { |
| 54 | url "https://kotlin.bintray.com/kotlin-dev" |
| 55 | credentials { |
| 56 | username = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER') ?: "" |
| 57 | password = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_API_KEY') ?: "" |
| 58 | } |
| 59 | } |
Leonid Startsev | 45aa7c7 | 2019-04-23 21:29:03 +0300 | [diff] [blame] | 60 | maven { url 'https://kotlin.bintray.com/kotlin-eap' } |
| 61 | maven { url 'https://kotlin.bintray.com/kotlinx' } |
Leonid Startsev | bae49f9 | 2018-05-03 19:57:01 +0300 | [diff] [blame] | 62 | maven { url "https://dl.bintray.com/jetbrains/kotlin-native-dependencies" } |
Vsevolod Tolstopyatov | d3d2dca | 2020-10-03 06:18:32 -0700 | [diff] [blame] | 63 | maven { url 'https://maven.pkg.jetbrains.space/kotlin/p/dokka/dev' } |
Leonid Startsev | 97b7187 | 2019-02-05 13:04:43 +0300 | [diff] [blame] | 64 | jcenter() |
Leonid Startsev | 45aa7c7 | 2019-04-23 21:29:03 +0300 | [diff] [blame] | 65 | gradlePluginPortal() |
Leonid Startsev | 08d3ca0 | 2017-07-26 15:16:23 +0300 | [diff] [blame] | 66 | } |
| 67 | |
Leonid Startsev | d656e5a | 2019-06-14 12:06:23 +0300 | [diff] [blame] | 68 | configurations.classpath { |
| 69 | resolutionStrategy.eachDependency { DependencyResolveDetails details -> |
| 70 | if (details.requested.group == 'org.jetbrains.kotlin') { |
| 71 | details.useVersion kotlin_version |
| 72 | } |
| 73 | } |
| 74 | } |
| 75 | |
Leonid Startsev | 08d3ca0 | 2017-07-26 15:16:23 +0300 | [diff] [blame] | 76 | dependencies { |
Leonid Startsev | 45aa7c7 | 2019-04-23 21:29:03 +0300 | [diff] [blame] | 77 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" |
| 78 | classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version" |
Leonid Startsev | bc9c8f4 | 2020-04-06 22:30:25 +0300 | [diff] [blame] | 79 | classpath "org.jetbrains.dokka:dokka-gradle-plugin:$dokka_version" |
Vsevolod Tolstopyatov | 6de9648 | 2020-06-17 06:41:00 -0700 | [diff] [blame] | 80 | classpath "org.jetbrains.kotlinx:binary-compatibility-validator:$validator_version" |
Roman Elizarov | 5459c10 | 2020-08-11 12:27:36 +0300 | [diff] [blame] | 81 | classpath "org.jetbrains.kotlinx:kotlinx-knit:$knit_version" |
Leonid Startsev | bc9c8f4 | 2020-04-06 22:30:25 +0300 | [diff] [blame] | 82 | |
Leonid Startsev | 45aa7c7 | 2019-04-23 21:29:03 +0300 | [diff] [blame] | 83 | classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.8' |
Leonid Startsev | bae49f9 | 2018-05-03 19:57:01 +0300 | [diff] [blame] | 84 | |
Leonid Startsev | 45aa7c7 | 2019-04-23 21:29:03 +0300 | [diff] [blame] | 85 | // Various benchmarking stuff |
| 86 | classpath "com.github.jengelman.gradle.plugins:shadow:4.0.2" |
| 87 | classpath "me.champeau.gradle:jmh-gradle-plugin:0.4.8" |
| 88 | classpath "net.ltgt.gradle:gradle-apt-plugin:0.21" |
Leonid Startsev | 08d3ca0 | 2017-07-26 15:16:23 +0300 | [diff] [blame] | 89 | } |
| 90 | } |
| 91 | |
Vsevolod Tolstopyatov | 608cbad | 2020-09-14 15:38:02 +0300 | [diff] [blame] | 92 | // To make it visible for compiler-version.gradle |
Vsevolod Tolstopyatov | fa2231c | 2019-05-29 17:39:15 +0300 | [diff] [blame] | 93 | ext.compilerVersion = org.jetbrains.kotlin.config.KotlinCompilerVersion.VERSION |
Vsevolod Tolstopyatov | 07f730a | 2021-01-22 03:32:08 -0800 | [diff] [blame^] | 94 | ext.nativeDebugBuild = org.jetbrains.kotlin.gradle.plugin.mpp.NativeBuildType.DEBUG |
Vsevolod Tolstopyatov | 6de9648 | 2020-06-17 06:41:00 -0700 | [diff] [blame] | 95 | apply plugin: 'binary-compatibility-validator' |
Leonid Startsev | 45aa7c7 | 2019-04-23 21:29:03 +0300 | [diff] [blame] | 96 | |
Vsevolod Tolstopyatov | 6de9648 | 2020-06-17 06:41:00 -0700 | [diff] [blame] | 97 | apiValidation { |
Roman Elizarov | 5459c10 | 2020-08-11 12:27:36 +0300 | [diff] [blame] | 98 | ignoredProjects += ["benchmark", "guide", "kotlinx-serialization"] |
Vsevolod Tolstopyatov | 6de9648 | 2020-06-17 06:41:00 -0700 | [diff] [blame] | 99 | } |
Leonid Startsev | 00dd4f5 | 2017-08-23 16:09:21 +0300 | [diff] [blame] | 100 | |
Roman Elizarov | 5459c10 | 2020-08-11 12:27:36 +0300 | [diff] [blame] | 101 | apply plugin: 'base' |
| 102 | apply plugin: 'kotlinx-knit' |
| 103 | |
| 104 | knit { |
| 105 | siteRoot = "https://kotlin.github.io/kotlinx.serialization" |
Vsevolod Tolstopyatov | d3d2dca | 2020-10-03 06:18:32 -0700 | [diff] [blame] | 106 | moduleDocs = "build/dokka/htmlMultiModule" |
Roman Elizarov | 5459c10 | 2020-08-11 12:27:36 +0300 | [diff] [blame] | 107 | } |
| 108 | |
| 109 | // Build API docs for all modules with dokka before running Knit |
| 110 | knitPrepare.dependsOn "dokka" |
| 111 | |
Leonid Startsev | 00dd4f5 | 2017-08-23 16:09:21 +0300 | [diff] [blame] | 112 | allprojects { |
| 113 | group 'org.jetbrains.kotlinx' |
Leonid Startsev | 476b722 | 2018-06-26 17:06:14 +0300 | [diff] [blame] | 114 | |
Leonid Startsev | f5accd1 | 2020-02-25 20:42:46 +0300 | [diff] [blame] | 115 | def deployVersion = properties['DeployVersion'] |
| 116 | if (deployVersion != null) version = deployVersion |
Leonid Startsev | 78d5d2d | 2019-07-25 13:51:54 +0300 | [diff] [blame] | 117 | |
Leonid Startsev | 476b722 | 2018-06-26 17:06:14 +0300 | [diff] [blame] | 118 | if (project.hasProperty("bootstrap")) { |
| 119 | version = version + '-SNAPSHOT' |
| 120 | } |
Leonid Startsev | 84062e1 | 2017-09-25 16:41:38 +0300 | [diff] [blame] | 121 | |
Leonid Startsev | 9f6d3b4 | 2019-10-09 18:07:41 +0300 | [diff] [blame] | 122 | // the only place where HostManager could be instantiated |
| 123 | project.ext.hostManager = new org.jetbrains.kotlin.konan.target.HostManager() |
| 124 | |
Vsevolod Tolstopyatov | fa2231c | 2019-05-29 17:39:15 +0300 | [diff] [blame] | 125 | if (build_snapshot_train) { |
| 126 | // Snapshot-specific |
Vsevolod Tolstopyatov | fa2231c | 2019-05-29 17:39:15 +0300 | [diff] [blame] | 127 | repositories { |
| 128 | mavenLocal() |
| 129 | maven { url "https://oss.sonatype.org/content/repositories/snapshots" } |
| 130 | } |
| 131 | } |
Leonid Startsev | cf1db5c | 2019-09-17 19:33:44 +0300 | [diff] [blame] | 132 | |
| 133 | configurations.all { |
| 134 | resolutionStrategy.eachDependency { DependencyResolveDetails details -> |
| 135 | if (details.requested.group == 'org.jetbrains.kotlin') { |
| 136 | details.useVersion kotlin_version |
| 137 | } |
| 138 | } |
| 139 | } |
| 140 | |
Leonid Startsev | 84062e1 | 2017-09-25 16:41:38 +0300 | [diff] [blame] | 141 | repositories { |
Leonid Startsev | 84062e1 | 2017-09-25 16:41:38 +0300 | [diff] [blame] | 142 | mavenLocal() |
Leonid Startsev | 97b7187 | 2019-02-05 13:04:43 +0300 | [diff] [blame] | 143 | jcenter() |
Leonid Startsev | 45aa7c7 | 2019-04-23 21:29:03 +0300 | [diff] [blame] | 144 | maven { url "https://dl.bintray.com/kotlin/kotlinx" } |
Vsevolod Tolstopyatov | 6995ef1 | 2020-08-24 16:01:54 +0300 | [diff] [blame] | 145 | // Future replacement for kotlin-dev, with cache redirector |
| 146 | maven { url "https://cache-redirector.jetbrains.com/maven.pkg.jetbrains.space/kotlin/p/kotlin/dev" } |
Michael Kuzmin | 4b5cd43 | 2019-12-16 22:53:24 +0300 | [diff] [blame] | 147 | maven { |
| 148 | url "https://kotlin.bintray.com/kotlin-dev" |
| 149 | credentials { |
| 150 | username = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER') ?: "" |
| 151 | password = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_API_KEY') ?: "" |
| 152 | } |
| 153 | } |
Vsevolod Tolstopyatov | d3d2dca | 2020-10-03 06:18:32 -0700 | [diff] [blame] | 154 | maven { url 'https://maven.pkg.jetbrains.space/kotlin/p/dokka/dev' } |
Leonid Startsev | 45aa7c7 | 2019-04-23 21:29:03 +0300 | [diff] [blame] | 155 | maven { url "https://dl.bintray.com/kotlin/kotlin-eap" } |
Leonid Startsev | 84062e1 | 2017-09-25 16:41:38 +0300 | [diff] [blame] | 156 | } |
Leonid Startsev | 00dd4f5 | 2017-08-23 16:09:21 +0300 | [diff] [blame] | 157 | } |
Leonid Startsev | 08d3ca0 | 2017-07-26 15:16:23 +0300 | [diff] [blame] | 158 | |
Leonid Startsev | 1c35d91 | 2017-10-04 12:26:43 +0300 | [diff] [blame] | 159 | subprojects { |
Leonid Startsev | c1bb4d2 | 2018-10-23 18:50:39 +0300 | [diff] [blame] | 160 | tasks.withType(org.jetbrains.kotlin.gradle.tasks.AbstractKotlinCompile).all { task -> |
| 161 | if (task.name.contains("Test") || task.name.contains("Jmh")) { |
| 162 | task.kotlinOptions.freeCompilerArgs += experimentalsInTestEnabled |
| 163 | } else { |
| 164 | task.kotlinOptions.freeCompilerArgs += experimentalsEnabled |
| 165 | } |
| 166 | } |
| 167 | |
Leonid Startsev | 9f6d3b4 | 2019-10-09 18:07:41 +0300 | [diff] [blame] | 168 | apply from: rootProject.file('gradle/teamcity.gradle') |
Leonid Startsev | 45aa7c7 | 2019-04-23 21:29:03 +0300 | [diff] [blame] | 169 | // Configure publishing for some artifacts |
Roman Elizarov | 5459c10 | 2020-08-11 12:27:36 +0300 | [diff] [blame] | 170 | if (project.name != "benchmark" && project.name != "guide") { |
| 171 | apply from: rootProject.file('gradle/publishing.gradle') |
| 172 | } |
| 173 | |
Leonid Startsev | 45aa7c7 | 2019-04-23 21:29:03 +0300 | [diff] [blame] | 174 | } |
Leonid Startsev | ed87fbd | 2017-08-04 17:33:09 +0300 | [diff] [blame] | 175 | |
Vsevolod Tolstopyatov | 608cbad | 2020-09-14 15:38:02 +0300 | [diff] [blame] | 176 | apply from: rootProject.file('gradle/compiler-version.gradle') |
Leonid Startsev | bc9c8f4 | 2020-04-06 22:30:25 +0300 | [diff] [blame] | 177 | apply from: rootProject.file("gradle/dokka.gradle") |
Alexander Likhachev | 2e56542 | 2020-11-17 13:09:24 +0300 | [diff] [blame] | 178 | |
| 179 | // Disable binary compatibility check for JVM IR compiler output by default |
| 180 | if (jvm_ir_enabled) { |
| 181 | subprojects { project -> |
| 182 | afterEvaluate { |
| 183 | configure(tasks.matching { it.name == "apiCheck" }) { |
| 184 | enabled = enabled && jvm_ir_api_check_enabled |
| 185 | } |
| 186 | } |
| 187 | } |
Vsevolod Tolstopyatov | 07f730a | 2021-01-22 03:32:08 -0800 | [diff] [blame^] | 188 | } |