blob: 69017532b7e277fc724504f7fe9c76402a26fd78 [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 Startsev12a00032018-11-08 19:05:36 +03008 ext["org.jetbrains.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 /*
28 * These property group is used to build kotlinx.serialization against Kotlin compiler snapshot.
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 }
45
Leonid Startsev08d3ca02017-07-26 15:16:23 +030046 repositories {
Leonid Startsev6fbc2152017-09-21 16:18:32 +030047 mavenLocal()
Leonid Startsev45aa7c72019-04-23 21:29:03 +030048 maven { url 'https://kotlin.bintray.com/kotlin-dev' }
49 maven { url 'https://kotlin.bintray.com/kotlin-eap' }
50 maven { url 'https://kotlin.bintray.com/kotlinx' }
51 maven { url "https://dl.bintray.com/orangy/maven" }
Leonid Startsevbae49f92018-05-03 19:57:01 +030052 maven { url "https://dl.bintray.com/jetbrains/kotlin-native-dependencies" }
Leonid Startsev97b71872019-02-05 13:04:43 +030053 jcenter()
Leonid Startsev45aa7c72019-04-23 21:29:03 +030054 gradlePluginPortal()
Leonid Startsev08d3ca02017-07-26 15:16:23 +030055 }
56
Leonid Startsevd656e5a2019-06-14 12:06:23 +030057 configurations.classpath {
58 resolutionStrategy.eachDependency { DependencyResolveDetails details ->
59 if (details.requested.group == 'org.jetbrains.kotlin') {
60 details.useVersion kotlin_version
61 }
62 }
63 }
64
Leonid Startsev08d3ca02017-07-26 15:16:23 +030065 dependencies {
Leonid Startsev45aa7c72019-04-23 21:29:03 +030066 classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
67 classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version"
68 classpath "kotlinx.team:kotlinx.team.infra:$infra_version"
69 classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:$bintray_version"
Leonid Startsevbae49f92018-05-03 19:57:01 +030070
Leonid Startsev45aa7c72019-04-23 21:29:03 +030071 // Protobuf is udes in JVM tests
72 classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.8'
Leonid Startsevbae49f92018-05-03 19:57:01 +030073
Leonid Startsev45aa7c72019-04-23 21:29:03 +030074 // Various benchmarking stuff
75 classpath "com.github.jengelman.gradle.plugins:shadow:4.0.2"
76 classpath "me.champeau.gradle:jmh-gradle-plugin:0.4.8"
77 classpath "net.ltgt.gradle:gradle-apt-plugin:0.21"
Leonid Startsev08d3ca02017-07-26 15:16:23 +030078 }
79}
80
Leonid Startsev45aa7c72019-04-23 21:29:03 +030081apply plugin: 'kotlinx.team.infra'
Vsevolod Tolstopyatovfa2231c2019-05-29 17:39:15 +030082// To make it visible for compilerVersion.gradle
83ext.compilerVersion = org.jetbrains.kotlin.config.KotlinCompilerVersion.VERSION
Leonid Startsev45aa7c72019-04-23 21:29:03 +030084
85infra {
86 teamcity {}
Leonid Startsev00dd4f52017-08-23 16:09:21 +030087}
88
89allprojects {
90 group 'org.jetbrains.kotlinx'
Leonid Startsev476b7222018-06-26 17:06:14 +030091
Leonid Startsev78d5d2d2019-07-25 13:51:54 +030092 if (ext.has('overriden_version')) {
93 version = overriden_version
94 }
95
Leonid Startsev476b7222018-06-26 17:06:14 +030096 if (project.hasProperty("bootstrap")) {
97 version = version + '-SNAPSHOT'
98 }
Leonid Startsev84062e12017-09-25 16:41:38 +030099
Vsevolod Tolstopyatovfa2231c2019-05-29 17:39:15 +0300100 if (build_snapshot_train) {
101 // Snapshot-specific
102 def deployVersion = properties['DeployVersion']
103 if (deployVersion != null) version = deployVersion
104 repositories {
105 mavenLocal()
106 maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
107 }
108 }
Leonid Startsev84062e12017-09-25 16:41:38 +0300109 repositories {
Leonid Startsev84062e12017-09-25 16:41:38 +0300110 mavenLocal()
Leonid Startsev97b71872019-02-05 13:04:43 +0300111 jcenter()
Leonid Startsev45aa7c72019-04-23 21:29:03 +0300112 maven { url "https://dl.bintray.com/kotlin/kotlinx" }
113 maven { url 'https://dl.bintray.com/kotlin/kotlin-dev' }
114 maven { url "https://dl.bintray.com/kotlin/kotlin-eap" }
Leonid Startsev84062e12017-09-25 16:41:38 +0300115 }
Leonid Startsev00dd4f52017-08-23 16:09:21 +0300116}
Leonid Startsev08d3ca02017-07-26 15:16:23 +0300117
Leonid Startsev1c35d912017-10-04 12:26:43 +0300118subprojects {
Leonid Startsevc1bb4d22018-10-23 18:50:39 +0300119 tasks.withType(org.jetbrains.kotlin.gradle.tasks.AbstractKotlinCompile).all { task ->
120 if (task.name.contains("Test") || task.name.contains("Jmh")) {
121 task.kotlinOptions.freeCompilerArgs += experimentalsInTestEnabled
122 } else {
123 task.kotlinOptions.freeCompilerArgs += experimentalsEnabled
124 }
125 }
126
Leonid Startsev45aa7c72019-04-23 21:29:03 +0300127 // Configure publishing for some artifacts
Leonid Startsev133194c2018-07-13 12:58:36 +0300128 if (project.name.contains("benchmark")) return
Leonid Startsev45aa7c72019-04-23 21:29:03 +0300129 apply from: rootProject.file('gradle/publishing.gradle')
130}
Leonid Startseved87fbd2017-08-04 17:33:09 +0300131
Vsevolod Tolstopyatovfa2231c2019-05-29 17:39:15 +0300132apply from: rootProject.file('gradle/compilerVersion.gradle')