Roman Elizarov | 26af919 | 2017-09-21 18:12:04 +0300 | [diff] [blame] | 1 | /* |
Leonid Startsev | 0a9f0d6 | 2018-07-13 12:12:09 +0300 | [diff] [blame] | 2 | * Copyright 2018 JetBrains s.r.o. |
Roman Elizarov | 26af919 | 2017-09-21 18:12:04 +0300 | [diff] [blame] | 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
Leonid Startsev | 08d3ca0 | 2017-07-26 15:16:23 +0300 | [diff] [blame] | 17 | buildscript { |
Leonid Startsev | c563d23 | 2018-05-07 20:29:23 +0300 | [diff] [blame] | 18 | def deployNative = property('native.deploy') == 'true' |
| 19 | |
Leonid Startsev | ca62091 | 2017-11-09 19:55:51 +0300 | [diff] [blame] | 20 | if (project.hasProperty("bootstrap")) { |
Leonid Startsev | 14b57df | 2018-06-13 23:18:22 +0300 | [diff] [blame] | 21 | ext.compilerVersion = property('kotlin.version.snapshot') |
| 22 | ext.librariesVersion = property('kotlin.version.snapshot') |
Leonid Startsev | 476b722 | 2018-06-26 17:06:14 +0300 | [diff] [blame^] | 23 | ext.serializationPluginVersion = property('plugin.version.snapshot') |
Leonid Startsev | ca62091 | 2017-11-09 19:55:51 +0300 | [diff] [blame] | 24 | } else { |
Leonid Startsev | 8642a1f | 2018-04-03 17:38:39 +0300 | [diff] [blame] | 25 | ext.compilerVersion = property('kotlin.version') |
| 26 | ext.librariesVersion = property('kotlin.version') |
Leonid Startsev | 14b57df | 2018-06-13 23:18:22 +0300 | [diff] [blame] | 27 | ext.serializationPluginVersion = property('plugin.version') |
Leonid Startsev | ca62091 | 2017-11-09 19:55:51 +0300 | [diff] [blame] | 28 | } |
Leonid Startsev | 9f9df89 | 2017-12-22 18:24:52 +0300 | [diff] [blame] | 29 | ext.eapChannel = 'https://dl.bintray.com/kotlin/kotlin-eap' |
Leonid Startsev | 1e737f2 | 2017-09-14 13:19:32 +0300 | [diff] [blame] | 30 | ext.serializationRepo = 'https://kotlin.bintray.com/kotlinx' |
Leonid Startsev | 08d3ca0 | 2017-07-26 15:16:23 +0300 | [diff] [blame] | 31 | |
| 32 | repositories { |
Leonid Startsev | 1e737f2 | 2017-09-14 13:19:32 +0300 | [diff] [blame] | 33 | jcenter() |
Leonid Startsev | 6fbc215 | 2017-09-21 16:18:32 +0300 | [diff] [blame] | 34 | mavenLocal() |
Vsevolod Tolstopyatov | e593b42 | 2018-06-28 11:23:49 +0300 | [diff] [blame] | 35 | maven { url "https://plugins.gradle.org/m2/" } |
Leonid Startsev | 7dd8ad7 | 2017-11-22 19:24:02 +0300 | [diff] [blame] | 36 | maven { url eapChannel } |
Leonid Startsev | 1e737f2 | 2017-09-14 13:19:32 +0300 | [diff] [blame] | 37 | maven { url serializationRepo } |
Leonid Startsev | bae49f9 | 2018-05-03 19:57:01 +0300 | [diff] [blame] | 38 | maven { url "https://dl.bintray.com/jetbrains/kotlin-native-dependencies" } |
Leonid Startsev | 08d3ca0 | 2017-07-26 15:16:23 +0300 | [diff] [blame] | 39 | } |
| 40 | |
| 41 | dependencies { |
Leonid Startsev | 1e737f2 | 2017-09-14 13:19:32 +0300 | [diff] [blame] | 42 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$compilerVersion" |
Leonid Startsev | d79fb1f | 2017-09-15 18:02:59 +0300 | [diff] [blame] | 43 | classpath "org.jetbrains.kotlinx:kotlinx-gradle-serialization-plugin:$serializationPluginVersion" |
Leonid Startsev | bae49f9 | 2018-05-03 19:57:01 +0300 | [diff] [blame] | 44 | classpath "org.jetbrains.kotlin:kotlin-native-gradle-plugin:${property('konan.version')}" |
| 45 | |
Leonid Startsev | ed87fbd | 2017-08-04 17:33:09 +0300 | [diff] [blame] | 46 | classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.2' |
Leonid Startsev | bae49f9 | 2018-05-03 19:57:01 +0300 | [diff] [blame] | 47 | |
Leonid Startsev | c563d23 | 2018-05-07 20:29:23 +0300 | [diff] [blame] | 48 | if (deployNative) { |
| 49 | // use patched version which supports Gradle metadata, but is not compatible with Maven publications |
| 50 | classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.2-SNAPSHOT' |
| 51 | } else { |
| 52 | classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3' |
| 53 | } |
Leonid Startsev | bae49f9 | 2018-05-03 19:57:01 +0300 | [diff] [blame] | 54 | |
Vsevolod Tolstopyatov | e593b42 | 2018-06-28 11:23:49 +0300 | [diff] [blame] | 55 | classpath "com.github.jengelman.gradle.plugins:shadow:2.0.2" |
| 56 | classpath "me.champeau.gradle:jmh-gradle-plugin:0.4.5" |
| 57 | classpath "net.ltgt.gradle:gradle-apt-plugin:0.10" |
Leonid Startsev | 08d3ca0 | 2017-07-26 15:16:23 +0300 | [diff] [blame] | 58 | } |
| 59 | } |
| 60 | |
Leonid Startsev | 00dd4f5 | 2017-08-23 16:09:21 +0300 | [diff] [blame] | 61 | ext { |
| 62 | libraries = [ |
Leonid Startsev | 1e737f2 | 2017-09-14 13:19:32 +0300 | [diff] [blame] | 63 | kotlin_stdlib: "org.jetbrains.kotlin:kotlin-stdlib:$librariesVersion", |
| 64 | kotlin_stdlib_common: "org.jetbrains.kotlin:kotlin-stdlib-common:$librariesVersion", |
| 65 | kotlin_stdlib_js: "org.jetbrains.kotlin:kotlin-stdlib-js:$librariesVersion", |
| 66 | kotlin_test: "org.jetbrains.kotlin:kotlin-test:$librariesVersion", |
Leonid Startsev | 8642a1f | 2018-04-03 17:38:39 +0300 | [diff] [blame] | 67 | kotlin_test_junit: "org.jetbrains.kotlin:kotlin-test-junit:$librariesVersion", |
Leonid Startsev | 1e737f2 | 2017-09-14 13:19:32 +0300 | [diff] [blame] | 68 | kotlin_test_common: "org.jetbrains.kotlin:kotlin-test-common:$librariesVersion", |
Leonid Startsev | 7dd8ad7 | 2017-11-22 19:24:02 +0300 | [diff] [blame] | 69 | kotlin_test_annotations_common: "org.jetbrains.kotlin:kotlin-test-annotations-common:$librariesVersion", |
Leonid Startsev | 1e737f2 | 2017-09-14 13:19:32 +0300 | [diff] [blame] | 70 | kotlin_test_js: "org.jetbrains.kotlin:kotlin-test-js:$librariesVersion", |
| 71 | kotlin_reflect: "org.jetbrains.kotlin:kotlin-reflect:$librariesVersion", |
Leonid Startsev | 00dd4f5 | 2017-08-23 16:09:21 +0300 | [diff] [blame] | 72 | ] |
| 73 | } |
| 74 | |
| 75 | allprojects { |
| 76 | group 'org.jetbrains.kotlinx' |
Leonid Startsev | 476b722 | 2018-06-26 17:06:14 +0300 | [diff] [blame^] | 77 | version '0.5.2' |
| 78 | |
| 79 | if (project.hasProperty("bootstrap")) { |
| 80 | version = version + '-SNAPSHOT' |
| 81 | } |
Leonid Startsev | 84062e1 | 2017-09-25 16:41:38 +0300 | [diff] [blame] | 82 | |
| 83 | repositories { |
| 84 | jcenter() |
Leonid Startsev | 7dd8ad7 | 2017-11-22 19:24:02 +0300 | [diff] [blame] | 85 | maven { url eapChannel } |
Leonid Startsev | 84062e1 | 2017-09-25 16:41:38 +0300 | [diff] [blame] | 86 | mavenLocal() |
| 87 | } |
Leonid Startsev | 00dd4f5 | 2017-08-23 16:09:21 +0300 | [diff] [blame] | 88 | } |
Leonid Startsev | 08d3ca0 | 2017-07-26 15:16:23 +0300 | [diff] [blame] | 89 | |
Leonid Startsev | 08d3ca0 | 2017-07-26 15:16:23 +0300 | [diff] [blame] | 90 | apply plugin: 'kotlin' |
Leonid Startsev | 08d3ca0 | 2017-07-26 15:16:23 +0300 | [diff] [blame] | 91 | |
Leonid Startsev | 1c35d91 | 2017-10-04 12:26:43 +0300 | [diff] [blame] | 92 | subprojects { |
Leonid Startsev | 0a9f0d6 | 2018-07-13 12:12:09 +0300 | [diff] [blame] | 93 | if (project.name.contains("native")) return |
Leonid Startsev | bae49f9 | 2018-05-03 19:57:01 +0300 | [diff] [blame] | 94 | |
Leonid Startsev | d79fb1f | 2017-09-15 18:02:59 +0300 | [diff] [blame] | 95 | apply plugin: 'kotlinx-serialization' |
Leonid Startsev | 08d3ca0 | 2017-07-26 15:16:23 +0300 | [diff] [blame] | 96 | |
Leonid Startsev | 133194c | 2018-07-13 12:58:36 +0300 | [diff] [blame] | 97 | if (project.name.contains("benchmark")) return |
| 98 | |
Leonid Startsev | 00dd4f5 | 2017-08-23 16:09:21 +0300 | [diff] [blame] | 99 | apply plugin: 'maven-publish' |
Leonid Startsev | ed87fbd | 2017-08-04 17:33:09 +0300 | [diff] [blame] | 100 | |
Leonid Startsev | d79fb1f | 2017-09-15 18:02:59 +0300 | [diff] [blame] | 101 | def varintName = "" |
| 102 | |
| 103 | if (project.name == "jvm") { |
| 104 | varintName = "${rootProject.name}" |
| 105 | } else { |
| 106 | varintName = "${rootProject.name}-${project.name}" |
| 107 | } |
Leonid Startsev | a587393 | 2017-08-09 11:36:01 +0300 | [diff] [blame] | 108 | |
Leonid Startsev | ef12538 | 2017-09-22 16:50:39 +0300 | [diff] [blame] | 109 | afterEvaluate { |
| 110 | task sourceJar(type: Jar, dependsOn: classes) { |
| 111 | classifier 'sources' |
| 112 | from sourceSets.main.kotlin |
Leonid Startsev | 8818540 | 2018-02-01 16:03:25 +0300 | [diff] [blame] | 113 | if (project.name == "jvm" || project.name == "js") { |
| 114 | duplicatesStrategy = "exclude" |
| 115 | def platformSrc = sourceSets.main.kotlin |
| 116 | def commonSrc = project(':common').sourceSets.main.kotlin |
| 117 | from(platformSrc + commonSrc) |
| 118 | } |
Leonid Startsev | ef12538 | 2017-09-22 16:50:39 +0300 | [diff] [blame] | 119 | } |
Leonid Startsev | 00dd4f5 | 2017-08-23 16:09:21 +0300 | [diff] [blame] | 120 | } |
Leonid Startsev | a587393 | 2017-08-09 11:36:01 +0300 | [diff] [blame] | 121 | |
Leonid Startsev | 00dd4f5 | 2017-08-23 16:09:21 +0300 | [diff] [blame] | 122 | tasks.withType(Jar) { |
| 123 | archivesBaseName = varintName |
| 124 | } |
Leonid Startsev | a587393 | 2017-08-09 11:36:01 +0300 | [diff] [blame] | 125 | |
Leonid Startsev | 00dd4f5 | 2017-08-23 16:09:21 +0300 | [diff] [blame] | 126 | publishing { |
| 127 | publications { |
Leonid Startsev | 1e737f2 | 2017-09-14 13:19:32 +0300 | [diff] [blame] | 128 | mavenProject(MavenPublication) { |
Leonid Startsev | 00dd4f5 | 2017-08-23 16:09:21 +0300 | [diff] [blame] | 129 | from components.java |
| 130 | groupId project.group |
| 131 | artifactId varintName |
| 132 | version project.version |
| 133 | |
| 134 | artifact sourceJar { |
| 135 | classifier "sources" |
| 136 | } |
Leonid Startsev | a587393 | 2017-08-09 11:36:01 +0300 | [diff] [blame] | 137 | } |
Leonid Startsev | 08d3ca0 | 2017-07-26 15:16:23 +0300 | [diff] [blame] | 138 | } |
| 139 | } |
Leonid Startsev | 1e737f2 | 2017-09-14 13:19:32 +0300 | [diff] [blame] | 140 | |
Leonid Startsev | bae49f9 | 2018-05-03 19:57:01 +0300 | [diff] [blame] | 141 | apply plugin: 'com.jfrog.bintray' |
Leonid Startsev | c563d23 | 2018-05-07 20:29:23 +0300 | [diff] [blame] | 142 | |
| 143 | apply from: "${rootProject.rootDir}/gradle/bintray.gradle" |
Leonid Startsev | da728dd | 2018-03-07 12:41:47 +0300 | [diff] [blame] | 144 | } |