blob: 73cd7ffd3aa226b7731f1ebc29e585846d8f7763 [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 Startsevb0fd1202018-12-12 19:42:48 +030012 ext.experimentalsEnabled = ["-progressive", "-Xuse-experimental=kotlin.Experimental",
Leonid Startsevc1bb4d22018-10-23 18:50:39 +030013 "-Xuse-experimental=kotlin.ExperimentalMultiplatform",
Vsevolod Tolstopyatov74b48022019-04-02 18:56:29 +030014 ]
Leonid Startsevc1bb4d22018-10-23 18:50:39 +030015
Leonid Startsevb0fd1202018-12-12 19:42:48 +030016 ext.experimentalsInTestEnabled = ["-progressive", "-Xuse-experimental=kotlin.Experimental",
Vsevolod Tolstopyatov74b48022019-04-02 18:56:29 +030017 "-Xuse-experimental=kotlin.ExperimentalMultiplatform",
18 "-Xuse-experimental=kotlinx.serialization.ImplicitReflectionSerializer",
19 "-Xuse-experimental=kotlinx.serialization.UnstableDefault"
20 ]
Leonid Startsev08d3ca02017-07-26 15:16:23 +030021
Vsevolod Tolstopyatovfa2231c2019-05-29 17:39:15 +030022 /*
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 Startsev08d3ca02017-07-26 15:16:23 +030041 repositories {
Leonid Startsev6fbc2152017-09-21 16:18:32 +030042 mavenLocal()
Leonid Startsev45aa7c72019-04-23 21:29:03 +030043 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 Startsevbae49f92018-05-03 19:57:01 +030047 maven { url "https://dl.bintray.com/jetbrains/kotlin-native-dependencies" }
Leonid Startsev97b71872019-02-05 13:04:43 +030048 jcenter()
Leonid Startsev45aa7c72019-04-23 21:29:03 +030049 gradlePluginPortal()
Leonid Startsev08d3ca02017-07-26 15:16:23 +030050 }
51
Leonid Startsevd656e5a2019-06-14 12:06:23 +030052 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 Startsev08d3ca02017-07-26 15:16:23 +030060 dependencies {
Leonid Startsev45aa7c72019-04-23 21:29:03 +030061 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 Startsevbae49f92018-05-03 19:57:01 +030065
Leonid Startsev45aa7c72019-04-23 21:29:03 +030066 // Protobuf is udes in JVM tests
67 classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.8'
Leonid Startsevbae49f92018-05-03 19:57:01 +030068
Leonid Startsev45aa7c72019-04-23 21:29:03 +030069 // 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 Startsev08d3ca02017-07-26 15:16:23 +030073 }
74}
75
Leonid Startsev45aa7c72019-04-23 21:29:03 +030076apply plugin: 'kotlinx.team.infra'
Vsevolod Tolstopyatovfa2231c2019-05-29 17:39:15 +030077// To make it visible for compilerVersion.gradle
78ext.compilerVersion = org.jetbrains.kotlin.config.KotlinCompilerVersion.VERSION
Leonid Startsev45aa7c72019-04-23 21:29:03 +030079
80infra {
81 teamcity {}
Leonid Startsev00dd4f52017-08-23 16:09:21 +030082}
83
84allprojects {
85 group 'org.jetbrains.kotlinx'
Leonid Startsev476b7222018-06-26 17:06:14 +030086
87 if (project.hasProperty("bootstrap")) {
88 version = version + '-SNAPSHOT'
89 }
Leonid Startsev84062e12017-09-25 16:41:38 +030090
Vsevolod Tolstopyatovfa2231c2019-05-29 17:39:15 +030091 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 Startsev84062e12017-09-25 16:41:38 +0300100 repositories {
Leonid Startsev84062e12017-09-25 16:41:38 +0300101 mavenLocal()
Leonid Startsev97b71872019-02-05 13:04:43 +0300102 jcenter()
Leonid Startsev45aa7c72019-04-23 21:29:03 +0300103 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 Startsev84062e12017-09-25 16:41:38 +0300106 }
Leonid Startsev00dd4f52017-08-23 16:09:21 +0300107}
Leonid Startsev08d3ca02017-07-26 15:16:23 +0300108
Leonid Startsev1c35d912017-10-04 12:26:43 +0300109subprojects {
Leonid Startsevc1bb4d22018-10-23 18:50:39 +0300110 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 Startsev45aa7c72019-04-23 21:29:03 +0300118 // Configure publishing for some artifacts
Leonid Startsev133194c2018-07-13 12:58:36 +0300119 if (project.name.contains("benchmark")) return
Leonid Startsev45aa7c72019-04-23 21:29:03 +0300120 apply from: rootProject.file('gradle/publishing.gradle')
121}
Leonid Startseved87fbd2017-08-04 17:33:09 +0300122
Vsevolod Tolstopyatovfa2231c2019-05-29 17:39:15 +0300123apply from: rootProject.file('gradle/compilerVersion.gradle')