Roman Elizarov | 26af919 | 2017-09-21 18:12:04 +0300 | [diff] [blame] | 1 | /* |
Vsevolod Tolstopyatov | 74b4802 | 2019-04-02 18:56:29 +0300 | [diff] [blame] | 2 | * Copyright 2017-2019 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 | 12a0003 | 2018-11-08 19:05:36 +0300 | [diff] [blame] | 8 | ext["org.jetbrains.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 | b0fd120 | 2018-12-12 19:42:48 +0300 | [diff] [blame] | 12 | ext.experimentalsEnabled = ["-progressive", "-Xuse-experimental=kotlin.Experimental", |
Leonid Startsev | c1bb4d2 | 2018-10-23 18:50:39 +0300 | [diff] [blame] | 13 | "-Xuse-experimental=kotlin.ExperimentalMultiplatform", |
Vsevolod Tolstopyatov | 74b4802 | 2019-04-02 18:56:29 +0300 | [diff] [blame] | 14 | ] |
Leonid Startsev | c1bb4d2 | 2018-10-23 18:50:39 +0300 | [diff] [blame] | 15 | |
Leonid Startsev | b0fd120 | 2018-12-12 19:42:48 +0300 | [diff] [blame] | 16 | ext.experimentalsInTestEnabled = ["-progressive", "-Xuse-experimental=kotlin.Experimental", |
Vsevolod Tolstopyatov | 74b4802 | 2019-04-02 18:56:29 +0300 | [diff] [blame] | 17 | "-Xuse-experimental=kotlin.ExperimentalMultiplatform", |
| 18 | "-Xuse-experimental=kotlinx.serialization.ImplicitReflectionSerializer", |
| 19 | "-Xuse-experimental=kotlinx.serialization.UnstableDefault" |
| 20 | ] |
Leonid Startsev | 08d3ca0 | 2017-07-26 15:16:23 +0300 | [diff] [blame] | 21 | |
Vsevolod Tolstopyatov | fa2231c | 2019-05-29 17:39:15 +0300 | [diff] [blame] | 22 | /* |
| 23 | * These property group is used to build kotlinx.serialization against Kotlin compiler snapshot. |
| 24 | * When build_snapshot_train is set to true, kotlin_version property is overridden with kotlin_snapshot_version. |
| 25 | * DO NOT change the name of these properties without adapting kotlinx.train build chain. |
| 26 | */ |
| 27 | def prop = rootProject.properties['build_snapshot_train'] |
| 28 | ext.build_snapshot_train = prop != null && prop != "" |
| 29 | if (build_snapshot_train) { |
| 30 | ext.kotlin_version = rootProject.properties['kotlin_snapshot_version'] |
| 31 | if (kotlin_version == null) { |
| 32 | throw new IllegalArgumentException("'kotlin_snapshot_version' should be defined when building with snapshot compiler") |
| 33 | } |
| 34 | repositories { |
| 35 | mavenLocal() |
| 36 | maven { url "https://oss.sonatype.org/content/repositories/snapshots" } |
| 37 | maven { url "https://bintray.com/jetbrains/kotlin-native-dependencies" } |
| 38 | } |
| 39 | } |
| 40 | |
Leonid Startsev | 08d3ca0 | 2017-07-26 15:16:23 +0300 | [diff] [blame] | 41 | repositories { |
Leonid Startsev | 6fbc215 | 2017-09-21 16:18:32 +0300 | [diff] [blame] | 42 | mavenLocal() |
Leonid Startsev | 45aa7c7 | 2019-04-23 21:29:03 +0300 | [diff] [blame] | 43 | maven { url 'https://kotlin.bintray.com/kotlin-dev' } |
| 44 | maven { url 'https://kotlin.bintray.com/kotlin-eap' } |
| 45 | maven { url 'https://kotlin.bintray.com/kotlinx' } |
| 46 | maven { url "https://dl.bintray.com/orangy/maven" } |
Leonid Startsev | bae49f9 | 2018-05-03 19:57:01 +0300 | [diff] [blame] | 47 | maven { url "https://dl.bintray.com/jetbrains/kotlin-native-dependencies" } |
Leonid Startsev | 97b7187 | 2019-02-05 13:04:43 +0300 | [diff] [blame] | 48 | jcenter() |
Leonid Startsev | 45aa7c7 | 2019-04-23 21:29:03 +0300 | [diff] [blame] | 49 | gradlePluginPortal() |
Leonid Startsev | 08d3ca0 | 2017-07-26 15:16:23 +0300 | [diff] [blame] | 50 | } |
| 51 | |
Leonid Startsev | d656e5a | 2019-06-14 12:06:23 +0300 | [diff] [blame^] | 52 | configurations.classpath { |
| 53 | resolutionStrategy.eachDependency { DependencyResolveDetails details -> |
| 54 | if (details.requested.group == 'org.jetbrains.kotlin') { |
| 55 | details.useVersion kotlin_version |
| 56 | } |
| 57 | } |
| 58 | } |
| 59 | |
Leonid Startsev | 08d3ca0 | 2017-07-26 15:16:23 +0300 | [diff] [blame] | 60 | dependencies { |
Leonid Startsev | 45aa7c7 | 2019-04-23 21:29:03 +0300 | [diff] [blame] | 61 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" |
| 62 | classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version" |
| 63 | classpath "kotlinx.team:kotlinx.team.infra:$infra_version" |
| 64 | classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:$bintray_version" |
Leonid Startsev | bae49f9 | 2018-05-03 19:57:01 +0300 | [diff] [blame] | 65 | |
Leonid Startsev | 45aa7c7 | 2019-04-23 21:29:03 +0300 | [diff] [blame] | 66 | // Protobuf is udes in JVM tests |
| 67 | classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.8' |
Leonid Startsev | bae49f9 | 2018-05-03 19:57:01 +0300 | [diff] [blame] | 68 | |
Leonid Startsev | 45aa7c7 | 2019-04-23 21:29:03 +0300 | [diff] [blame] | 69 | // Various benchmarking stuff |
| 70 | classpath "com.github.jengelman.gradle.plugins:shadow:4.0.2" |
| 71 | classpath "me.champeau.gradle:jmh-gradle-plugin:0.4.8" |
| 72 | classpath "net.ltgt.gradle:gradle-apt-plugin:0.21" |
Leonid Startsev | 08d3ca0 | 2017-07-26 15:16:23 +0300 | [diff] [blame] | 73 | } |
| 74 | } |
| 75 | |
Leonid Startsev | 45aa7c7 | 2019-04-23 21:29:03 +0300 | [diff] [blame] | 76 | apply plugin: 'kotlinx.team.infra' |
Vsevolod Tolstopyatov | fa2231c | 2019-05-29 17:39:15 +0300 | [diff] [blame] | 77 | // To make it visible for compilerVersion.gradle |
| 78 | ext.compilerVersion = org.jetbrains.kotlin.config.KotlinCompilerVersion.VERSION |
Leonid Startsev | 45aa7c7 | 2019-04-23 21:29:03 +0300 | [diff] [blame] | 79 | |
| 80 | infra { |
| 81 | teamcity {} |
Leonid Startsev | 00dd4f5 | 2017-08-23 16:09:21 +0300 | [diff] [blame] | 82 | } |
| 83 | |
| 84 | allprojects { |
| 85 | group 'org.jetbrains.kotlinx' |
Leonid Startsev | 476b722 | 2018-06-26 17:06:14 +0300 | [diff] [blame] | 86 | |
| 87 | if (project.hasProperty("bootstrap")) { |
| 88 | version = version + '-SNAPSHOT' |
| 89 | } |
Leonid Startsev | 84062e1 | 2017-09-25 16:41:38 +0300 | [diff] [blame] | 90 | |
Vsevolod Tolstopyatov | fa2231c | 2019-05-29 17:39:15 +0300 | [diff] [blame] | 91 | if (build_snapshot_train) { |
| 92 | // Snapshot-specific |
| 93 | def deployVersion = properties['DeployVersion'] |
| 94 | if (deployVersion != null) version = deployVersion |
| 95 | repositories { |
| 96 | mavenLocal() |
| 97 | maven { url "https://oss.sonatype.org/content/repositories/snapshots" } |
| 98 | } |
| 99 | } |
Leonid Startsev | 84062e1 | 2017-09-25 16:41:38 +0300 | [diff] [blame] | 100 | repositories { |
Leonid Startsev | 84062e1 | 2017-09-25 16:41:38 +0300 | [diff] [blame] | 101 | mavenLocal() |
Leonid Startsev | 97b7187 | 2019-02-05 13:04:43 +0300 | [diff] [blame] | 102 | jcenter() |
Leonid Startsev | 45aa7c7 | 2019-04-23 21:29:03 +0300 | [diff] [blame] | 103 | maven { url "https://dl.bintray.com/kotlin/kotlinx" } |
| 104 | maven { url 'https://dl.bintray.com/kotlin/kotlin-dev' } |
| 105 | maven { url "https://dl.bintray.com/kotlin/kotlin-eap" } |
Leonid Startsev | 84062e1 | 2017-09-25 16:41:38 +0300 | [diff] [blame] | 106 | } |
Leonid Startsev | 00dd4f5 | 2017-08-23 16:09:21 +0300 | [diff] [blame] | 107 | } |
Leonid Startsev | 08d3ca0 | 2017-07-26 15:16:23 +0300 | [diff] [blame] | 108 | |
Leonid Startsev | 1c35d91 | 2017-10-04 12:26:43 +0300 | [diff] [blame] | 109 | subprojects { |
Leonid Startsev | c1bb4d2 | 2018-10-23 18:50:39 +0300 | [diff] [blame] | 110 | tasks.withType(org.jetbrains.kotlin.gradle.tasks.AbstractKotlinCompile).all { task -> |
| 111 | if (task.name.contains("Test") || task.name.contains("Jmh")) { |
| 112 | task.kotlinOptions.freeCompilerArgs += experimentalsInTestEnabled |
| 113 | } else { |
| 114 | task.kotlinOptions.freeCompilerArgs += experimentalsEnabled |
| 115 | } |
| 116 | } |
| 117 | |
Leonid Startsev | 45aa7c7 | 2019-04-23 21:29:03 +0300 | [diff] [blame] | 118 | // Configure publishing for some artifacts |
Leonid Startsev | 133194c | 2018-07-13 12:58:36 +0300 | [diff] [blame] | 119 | if (project.name.contains("benchmark")) return |
Leonid Startsev | 45aa7c7 | 2019-04-23 21:29:03 +0300 | [diff] [blame] | 120 | apply from: rootProject.file('gradle/publishing.gradle') |
| 121 | } |
Leonid Startsev | ed87fbd | 2017-08-04 17:33:09 +0300 | [diff] [blame] | 122 | |
Vsevolod Tolstopyatov | fa2231c | 2019-05-29 17:39:15 +0300 | [diff] [blame] | 123 | apply from: rootProject.file('gradle/compilerVersion.gradle') |