blob: ba762a78fd4f475186edac0e03b6ca2fc9d1ac86 [file] [log] [blame]
Roman Elizarov26af9192017-09-21 18:12:04 +03001/*
Vsevolod Tolstopyatov74b48022019-04-02 18:56:29 +03002 * Copyright 2017-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
Roman Elizarov26af9192017-09-21 18:12:04 +03003 */
4
Leonid Startsev08d3ca02017-07-26 15:16:23 +03005buildscript {
Leonid Startsevca620912017-11-09 19:55:51 +03006 if (project.hasProperty("bootstrap")) {
Leonid Startsev45aa7c72019-04-23 21:29:03 +03007 ext.kotlin_version = property('kotlin.version.snapshot')
Leonid Startsevcea9b432019-11-19 14:14:26 +03008 ext["kotlin.native.home"] = System.getenv("KONAN_LOCAL_DIST")
Leonid Startsevca620912017-11-09 19:55:51 +03009 } else {
Leonid Startsev45aa7c72019-04-23 21:29:03 +030010 ext.kotlin_version = property('kotlin.version')
Leonid Startsevca620912017-11-09 19:55:51 +030011 }
Leonid Startsev78d5d2d2019-07-25 13:51:54 +030012 if (project.hasProperty("library.version")) {
13 ext.overriden_version = property('library.version')
14 }
Leonid Startsevb0fd1202018-12-12 19:42:48 +030015 ext.experimentalsEnabled = ["-progressive", "-Xuse-experimental=kotlin.Experimental",
Leonid Startsevc1bb4d22018-10-23 18:50:39 +030016 "-Xuse-experimental=kotlin.ExperimentalMultiplatform",
Vsevolod Tolstopyatov0d830ae2019-09-09 20:06:42 +030017 "-Xuse-experimental=kotlinx.serialization.InternalSerializationApi"
Vsevolod Tolstopyatov74b48022019-04-02 18:56:29 +030018 ]
Leonid Startsevc1bb4d22018-10-23 18:50:39 +030019
Leonid Startsevb0fd1202018-12-12 19:42:48 +030020 ext.experimentalsInTestEnabled = ["-progressive", "-Xuse-experimental=kotlin.Experimental",
Vsevolod Tolstopyatov74b48022019-04-02 18:56:29 +030021 "-Xuse-experimental=kotlin.ExperimentalMultiplatform",
22 "-Xuse-experimental=kotlinx.serialization.ImplicitReflectionSerializer",
Vsevolod Tolstopyatov0d830ae2019-09-09 20:06:42 +030023 "-Xuse-experimental=kotlinx.serialization.UnstableDefault",
24 "-Xuse-experimental=kotlinx.serialization.InternalSerializationApi"
Vsevolod Tolstopyatov74b48022019-04-02 18:56:29 +030025 ]
Leonid Startsev08d3ca02017-07-26 15:16:23 +030026
Vsevolod Tolstopyatovfa2231c2019-05-29 17:39:15 +030027 /*
Leonid Startsevcea9b432019-11-19 14:14:26 +030028 * This property group is used to build kotlinx.serialization against Kotlin compiler snapshot.
Vsevolod Tolstopyatovfa2231c2019-05-29 17:39:15 +030029 * 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 }
45
Leonid Startsev08d3ca02017-07-26 15:16:23 +030046 repositories {
Leonid Startsev6fbc2152017-09-21 16:18:32 +030047 mavenLocal()
Michael Kuzmin4b5cd432019-12-16 22:53:24 +030048 maven {
49 url "https://kotlin.bintray.com/kotlin-dev"
50 credentials {
51 username = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER') ?: ""
52 password = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_API_KEY') ?: ""
53 }
54 }
Leonid Startsev45aa7c72019-04-23 21:29:03 +030055 maven { url 'https://kotlin.bintray.com/kotlin-eap' }
56 maven { url 'https://kotlin.bintray.com/kotlinx' }
Leonid Startsevbae49f92018-05-03 19:57:01 +030057 maven { url "https://dl.bintray.com/jetbrains/kotlin-native-dependencies" }
Leonid Startsev97b71872019-02-05 13:04:43 +030058 jcenter()
Leonid Startsev45aa7c72019-04-23 21:29:03 +030059 gradlePluginPortal()
Leonid Startsev08d3ca02017-07-26 15:16:23 +030060 }
61
Leonid Startsevd656e5a2019-06-14 12:06:23 +030062 configurations.classpath {
63 resolutionStrategy.eachDependency { DependencyResolveDetails details ->
64 if (details.requested.group == 'org.jetbrains.kotlin') {
65 details.useVersion kotlin_version
66 }
67 }
68 }
69
Leonid Startsev08d3ca02017-07-26 15:16:23 +030070 dependencies {
Leonid Startsev45aa7c72019-04-23 21:29:03 +030071 classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
72 classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version"
Leonid Startsev45aa7c72019-04-23 21:29:03 +030073 classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:$bintray_version"
Leonid Startsev45aa7c72019-04-23 21:29:03 +030074 classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.8'
Leonid Startsevbae49f92018-05-03 19:57:01 +030075
Leonid Startsev45aa7c72019-04-23 21:29:03 +030076 // Various benchmarking stuff
77 classpath "com.github.jengelman.gradle.plugins:shadow:4.0.2"
78 classpath "me.champeau.gradle:jmh-gradle-plugin:0.4.8"
79 classpath "net.ltgt.gradle:gradle-apt-plugin:0.21"
Leonid Startsev08d3ca02017-07-26 15:16:23 +030080 }
81}
82
Leonid Startsev9f6d3b42019-10-09 18:07:41 +030083// To make it visible for compilerVersion.gradle
Vsevolod Tolstopyatovfa2231c2019-05-29 17:39:15 +030084ext.compilerVersion = org.jetbrains.kotlin.config.KotlinCompilerVersion.VERSION
Leonid Startsev45aa7c72019-04-23 21:29:03 +030085
Leonid Startsev00dd4f52017-08-23 16:09:21 +030086
87allprojects {
88 group 'org.jetbrains.kotlinx'
Leonid Startsev476b7222018-06-26 17:06:14 +030089
Leonid Startsevf5accd12020-02-25 20:42:46 +030090 def deployVersion = properties['DeployVersion']
91 if (deployVersion != null) version = deployVersion
Leonid Startsev78d5d2d2019-07-25 13:51:54 +030092
Leonid Startsev476b7222018-06-26 17:06:14 +030093 if (project.hasProperty("bootstrap")) {
94 version = version + '-SNAPSHOT'
95 }
Leonid Startsev84062e12017-09-25 16:41:38 +030096
Leonid Startsev9f6d3b42019-10-09 18:07:41 +030097 // the only place where HostManager could be instantiated
98 project.ext.hostManager = new org.jetbrains.kotlin.konan.target.HostManager()
99
Vsevolod Tolstopyatovfa2231c2019-05-29 17:39:15 +0300100 if (build_snapshot_train) {
101 // Snapshot-specific
Vsevolod Tolstopyatovfa2231c2019-05-29 17:39:15 +0300102 repositories {
103 mavenLocal()
104 maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
105 }
106 }
Leonid Startsevcf1db5c2019-09-17 19:33:44 +0300107
108 configurations.all {
109 resolutionStrategy.eachDependency { DependencyResolveDetails details ->
110 if (details.requested.group == 'org.jetbrains.kotlin') {
111 details.useVersion kotlin_version
112 }
113 }
114 }
115
Leonid Startsev84062e12017-09-25 16:41:38 +0300116 repositories {
Leonid Startsev84062e12017-09-25 16:41:38 +0300117 mavenLocal()
Leonid Startsev97b71872019-02-05 13:04:43 +0300118 jcenter()
Leonid Startsev45aa7c72019-04-23 21:29:03 +0300119 maven { url "https://dl.bintray.com/kotlin/kotlinx" }
Michael Kuzmin4b5cd432019-12-16 22:53:24 +0300120 maven {
121 url "https://kotlin.bintray.com/kotlin-dev"
122 credentials {
123 username = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER') ?: ""
124 password = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_API_KEY') ?: ""
125 }
126 }
Leonid Startsev45aa7c72019-04-23 21:29:03 +0300127 maven { url "https://dl.bintray.com/kotlin/kotlin-eap" }
Leonid Startsev84062e12017-09-25 16:41:38 +0300128 }
Leonid Startsev00dd4f52017-08-23 16:09:21 +0300129}
Leonid Startsev08d3ca02017-07-26 15:16:23 +0300130
Leonid Startsev1c35d912017-10-04 12:26:43 +0300131subprojects {
Leonid Startsevc1bb4d22018-10-23 18:50:39 +0300132 tasks.withType(org.jetbrains.kotlin.gradle.tasks.AbstractKotlinCompile).all { task ->
133 if (task.name.contains("Test") || task.name.contains("Jmh")) {
134 task.kotlinOptions.freeCompilerArgs += experimentalsInTestEnabled
135 } else {
136 task.kotlinOptions.freeCompilerArgs += experimentalsEnabled
137 }
138 }
139
Leonid Startsev9f6d3b42019-10-09 18:07:41 +0300140 apply from: rootProject.file('gradle/teamcity.gradle')
Leonid Startsev45aa7c72019-04-23 21:29:03 +0300141 // Configure publishing for some artifacts
Leonid Startsev133194c2018-07-13 12:58:36 +0300142 if (project.name.contains("benchmark")) return
Leonid Startsev45aa7c72019-04-23 21:29:03 +0300143 apply from: rootProject.file('gradle/publishing.gradle')
144}
Leonid Startseved87fbd2017-08-04 17:33:09 +0300145
Vsevolod Tolstopyatovfa2231c2019-05-29 17:39:15 +0300146apply from: rootProject.file('gradle/compilerVersion.gradle')