blob: 01e8bae476ebc9df1cf52c95b7deccbfa3c2ed00 [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
52 dependencies {
Leonid Startsev45aa7c72019-04-23 21:29:03 +030053 classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
54 classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version"
55 classpath "kotlinx.team:kotlinx.team.infra:$infra_version"
56 classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:$bintray_version"
Leonid Startsevbae49f92018-05-03 19:57:01 +030057
Leonid Startsev45aa7c72019-04-23 21:29:03 +030058 // Protobuf is udes in JVM tests
59 classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.8'
Leonid Startsevbae49f92018-05-03 19:57:01 +030060
Leonid Startsev45aa7c72019-04-23 21:29:03 +030061 // Various benchmarking stuff
62 classpath "com.github.jengelman.gradle.plugins:shadow:4.0.2"
63 classpath "me.champeau.gradle:jmh-gradle-plugin:0.4.8"
64 classpath "net.ltgt.gradle:gradle-apt-plugin:0.21"
Leonid Startsev08d3ca02017-07-26 15:16:23 +030065 }
66}
67
Leonid Startsev45aa7c72019-04-23 21:29:03 +030068apply plugin: 'kotlinx.team.infra'
Vsevolod Tolstopyatovfa2231c2019-05-29 17:39:15 +030069// To make it visible for compilerVersion.gradle
70ext.compilerVersion = org.jetbrains.kotlin.config.KotlinCompilerVersion.VERSION
Leonid Startsev45aa7c72019-04-23 21:29:03 +030071
72infra {
73 teamcity {}
74 node {
75 version = '10.15.1'
76 mocha('4.1.0')
77 install("source-map-support", "0.5.3")
78 install("mocha-teamcity-reporter", "2.2.2")
79 }
Leonid Startsev00dd4f52017-08-23 16:09:21 +030080}
81
82allprojects {
83 group 'org.jetbrains.kotlinx'
Leonid Startsev476b7222018-06-26 17:06:14 +030084
85 if (project.hasProperty("bootstrap")) {
86 version = version + '-SNAPSHOT'
87 }
Leonid Startsev84062e12017-09-25 16:41:38 +030088
Vsevolod Tolstopyatovfa2231c2019-05-29 17:39:15 +030089 if (build_snapshot_train) {
90 // Snapshot-specific
91 def deployVersion = properties['DeployVersion']
92 if (deployVersion != null) version = deployVersion
93 repositories {
94 mavenLocal()
95 maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
96 }
97 }
Leonid Startsev84062e12017-09-25 16:41:38 +030098 repositories {
Leonid Startsev84062e12017-09-25 16:41:38 +030099 mavenLocal()
Leonid Startsev97b71872019-02-05 13:04:43 +0300100 jcenter()
Leonid Startsev45aa7c72019-04-23 21:29:03 +0300101 maven { url "https://dl.bintray.com/kotlin/kotlinx" }
102 maven { url 'https://dl.bintray.com/kotlin/kotlin-dev' }
103 maven { url "https://dl.bintray.com/kotlin/kotlin-eap" }
Leonid Startsev84062e12017-09-25 16:41:38 +0300104 }
Leonid Startsev00dd4f52017-08-23 16:09:21 +0300105}
Leonid Startsev08d3ca02017-07-26 15:16:23 +0300106
Leonid Startsev1c35d912017-10-04 12:26:43 +0300107subprojects {
Leonid Startsevc1bb4d22018-10-23 18:50:39 +0300108 tasks.withType(org.jetbrains.kotlin.gradle.tasks.AbstractKotlinCompile).all { task ->
109 if (task.name.contains("Test") || task.name.contains("Jmh")) {
110 task.kotlinOptions.freeCompilerArgs += experimentalsInTestEnabled
111 } else {
112 task.kotlinOptions.freeCompilerArgs += experimentalsEnabled
113 }
114 }
115
Leonid Startsev45aa7c72019-04-23 21:29:03 +0300116 // Configure publishing for some artifacts
Leonid Startsev133194c2018-07-13 12:58:36 +0300117 if (project.name.contains("benchmark")) return
Leonid Startsev45aa7c72019-04-23 21:29:03 +0300118 apply from: rootProject.file('gradle/publishing.gradle')
119}
Leonid Startseved87fbd2017-08-04 17:33:09 +0300120
Vsevolod Tolstopyatovfa2231c2019-05-29 17:39:15 +0300121apply from: rootProject.file('gradle/compilerVersion.gradle')