Roman Elizarov | 26af919 | 2017-09-21 18:12:04 +0300 | [diff] [blame] | 1 | /* |
Vsevolod Tolstopyatov | 74b4802 | 2019-04-02 18:56:29 +0300 | [diff] [blame^] | 2 | * Copyright 2017-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. |
Roman Elizarov | 26af919 | 2017-09-21 18:12:04 +0300 | [diff] [blame] | 3 | */ |
| 4 | |
Leonid Startsev | 08d3ca0 | 2017-07-26 15:16:23 +0300 | [diff] [blame] | 5 | buildscript { |
Leonid Startsev | c563d23 | 2018-05-07 20:29:23 +0300 | [diff] [blame] | 6 | def deployNative = property('native.deploy') == 'true' |
| 7 | |
Leonid Startsev | ca62091 | 2017-11-09 19:55:51 +0300 | [diff] [blame] | 8 | if (project.hasProperty("bootstrap")) { |
Leonid Startsev | 14b57df | 2018-06-13 23:18:22 +0300 | [diff] [blame] | 9 | ext.compilerVersion = property('kotlin.version.snapshot') |
| 10 | ext.librariesVersion = property('kotlin.version.snapshot') |
Leonid Startsev | 476b722 | 2018-06-26 17:06:14 +0300 | [diff] [blame] | 11 | ext.serializationPluginVersion = property('plugin.version.snapshot') |
Leonid Startsev | e4c5404 | 2018-10-31 18:31:32 +0300 | [diff] [blame] | 12 | ext.konanVersion = property('konan.version.snapshot') |
Leonid Startsev | 12a0003 | 2018-11-08 19:05:36 +0300 | [diff] [blame] | 13 | ext["org.jetbrains.kotlin.native.home"] = System.getenv("KONAN_LOCAL_DIST") |
Leonid Startsev | ca62091 | 2017-11-09 19:55:51 +0300 | [diff] [blame] | 14 | } else { |
Leonid Startsev | 8642a1f | 2018-04-03 17:38:39 +0300 | [diff] [blame] | 15 | ext.compilerVersion = property('kotlin.version') |
| 16 | ext.librariesVersion = property('kotlin.version') |
Leonid Startsev | 14b57df | 2018-06-13 23:18:22 +0300 | [diff] [blame] | 17 | ext.serializationPluginVersion = property('plugin.version') |
Leonid Startsev | e4c5404 | 2018-10-31 18:31:32 +0300 | [diff] [blame] | 18 | ext.konanVersion = property('konan.version') |
Leonid Startsev | ca62091 | 2017-11-09 19:55:51 +0300 | [diff] [blame] | 19 | } |
Leonid Startsev | dafca6a | 2019-03-11 17:33:27 +0300 | [diff] [blame] | 20 | ext.serializationVersion = property('library.version') |
Leonid Startsev | c1bb4d2 | 2018-10-23 18:50:39 +0300 | [diff] [blame] | 21 | ext.serializationCoordinates = "org.jetbrains.kotlin:kotlin-serialization" |
Leonid Startsev | 1d3e150 | 2019-03-22 18:32:14 +0300 | [diff] [blame] | 22 | ext.tcChannel = 'https://teamcity.jetbrains.com/guestAuth/app/rest/builds/id:2082584/artifacts/content/maven' |
Leonid Startsev | 97b7187 | 2019-02-05 13:04:43 +0300 | [diff] [blame] | 23 | ext.devChannel = 'https://kotlin.bintray.com/kotlin-dev' |
Leonid Startsev | 1e737f2 | 2017-09-14 13:19:32 +0300 | [diff] [blame] | 24 | ext.serializationRepo = 'https://kotlin.bintray.com/kotlinx' |
Leonid Startsev | b0fd120 | 2018-12-12 19:42:48 +0300 | [diff] [blame] | 25 | ext.experimentalsEnabled = ["-progressive", "-Xuse-experimental=kotlin.Experimental", |
Leonid Startsev | c1bb4d2 | 2018-10-23 18:50:39 +0300 | [diff] [blame] | 26 | "-Xuse-experimental=kotlin.ExperimentalMultiplatform", |
Vsevolod Tolstopyatov | 74b4802 | 2019-04-02 18:56:29 +0300 | [diff] [blame^] | 27 | ] |
Leonid Startsev | c1bb4d2 | 2018-10-23 18:50:39 +0300 | [diff] [blame] | 28 | |
Leonid Startsev | b0fd120 | 2018-12-12 19:42:48 +0300 | [diff] [blame] | 29 | ext.experimentalsInTestEnabled = ["-progressive", "-Xuse-experimental=kotlin.Experimental", |
Vsevolod Tolstopyatov | 74b4802 | 2019-04-02 18:56:29 +0300 | [diff] [blame^] | 30 | "-Xuse-experimental=kotlin.ExperimentalMultiplatform", |
| 31 | "-Xuse-experimental=kotlinx.serialization.ImplicitReflectionSerializer", |
| 32 | "-Xuse-experimental=kotlinx.serialization.UnstableDefault" |
| 33 | ] |
Leonid Startsev | 08d3ca0 | 2017-07-26 15:16:23 +0300 | [diff] [blame] | 34 | |
| 35 | repositories { |
Leonid Startsev | 6fbc215 | 2017-09-21 16:18:32 +0300 | [diff] [blame] | 36 | mavenLocal() |
Leonid Startsev | 97b7187 | 2019-02-05 13:04:43 +0300 | [diff] [blame] | 37 | maven { url tcChannel } |
| 38 | maven { url devChannel } |
Leonid Startsev | 1e737f2 | 2017-09-14 13:19:32 +0300 | [diff] [blame] | 39 | maven { url serializationRepo } |
Leonid Startsev | 97b7187 | 2019-02-05 13:04:43 +0300 | [diff] [blame] | 40 | maven { url "https://plugins.gradle.org/m2/" } |
Leonid Startsev | bae49f9 | 2018-05-03 19:57:01 +0300 | [diff] [blame] | 41 | maven { url "https://dl.bintray.com/jetbrains/kotlin-native-dependencies" } |
Leonid Startsev | 97b7187 | 2019-02-05 13:04:43 +0300 | [diff] [blame] | 42 | jcenter() |
Leonid Startsev | 08d3ca0 | 2017-07-26 15:16:23 +0300 | [diff] [blame] | 43 | } |
| 44 | |
| 45 | dependencies { |
Leonid Startsev | 1e737f2 | 2017-09-14 13:19:32 +0300 | [diff] [blame] | 46 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$compilerVersion" |
Leonid Startsev | c652f29 | 2018-09-11 17:47:21 +0300 | [diff] [blame] | 47 | classpath "$serializationCoordinates:$serializationPluginVersion" |
Leonid Startsev | 477563f | 2018-10-31 16:19:27 +0300 | [diff] [blame] | 48 | classpath "org.jetbrains.kotlin:kotlin-native-gradle-plugin:$konanVersion" |
Leonid Startsev | bae49f9 | 2018-05-03 19:57:01 +0300 | [diff] [blame] | 49 | |
Leonid Startsev | ed87fbd | 2017-08-04 17:33:09 +0300 | [diff] [blame] | 50 | classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.2' |
Leonid Startsev | bae49f9 | 2018-05-03 19:57:01 +0300 | [diff] [blame] | 51 | |
Leonid Startsev | b4656a0 | 2019-01-17 16:19:12 +0300 | [diff] [blame] | 52 | // Custom bintray plugin to publish with Gradle Metadata |
| 53 | classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4-jetbrains-3" |
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 | dafca6a | 2019-03-11 17:33:27 +0300 | [diff] [blame] | 77 | version serializationVersion |
Leonid Startsev | 476b722 | 2018-06-26 17:06:14 +0300 | [diff] [blame] | 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 { |
Leonid Startsev | 84062e1 | 2017-09-25 16:41:38 +0300 | [diff] [blame] | 84 | mavenLocal() |
Leonid Startsev | 97b7187 | 2019-02-05 13:04:43 +0300 | [diff] [blame] | 85 | maven { url tcChannel } |
| 86 | maven { url devChannel } |
Leonid Startsev | aee4fc2 | 2018-08-07 14:42:28 +0300 | [diff] [blame] | 87 | maven { url serializationRepo } |
Leonid Startsev | 97b7187 | 2019-02-05 13:04:43 +0300 | [diff] [blame] | 88 | jcenter() |
Leonid Startsev | 84062e1 | 2017-09-25 16:41:38 +0300 | [diff] [blame] | 89 | } |
Leonid Startsev | 00dd4f5 | 2017-08-23 16:09:21 +0300 | [diff] [blame] | 90 | } |
Leonid Startsev | 08d3ca0 | 2017-07-26 15:16:23 +0300 | [diff] [blame] | 91 | |
Leonid Startsev | 08d3ca0 | 2017-07-26 15:16:23 +0300 | [diff] [blame] | 92 | apply plugin: 'kotlin' |
Leonid Startsev | 08d3ca0 | 2017-07-26 15:16:23 +0300 | [diff] [blame] | 93 | |
Leonid Startsev | 1c35d91 | 2017-10-04 12:26:43 +0300 | [diff] [blame] | 94 | subprojects { |
Leonid Startsev | 1d3e150 | 2019-03-22 18:32:14 +0300 | [diff] [blame] | 95 | configurations.all { |
| 96 | resolutionStrategy.eachDependency { DependencyResolveDetails details -> |
| 97 | if (details.requested.group == 'org.jetbrains.kotlin' && details.requested.name == 'kotlinx-serialization-unshaded') { |
| 98 | details.useVersion serializationPluginVersion |
| 99 | details.because 'use not bundled one' |
| 100 | } |
| 101 | } |
| 102 | } |
| 103 | |
Leonid Startsev | 0a9f0d6 | 2018-07-13 12:12:09 +0300 | [diff] [blame] | 104 | if (project.name.contains("native")) return |
Leonid Startsev | bae49f9 | 2018-05-03 19:57:01 +0300 | [diff] [blame] | 105 | |
Leonid Startsev | d79fb1f | 2017-09-15 18:02:59 +0300 | [diff] [blame] | 106 | apply plugin: 'kotlinx-serialization' |
Leonid Startsev | 08d3ca0 | 2017-07-26 15:16:23 +0300 | [diff] [blame] | 107 | |
Leonid Startsev | c1bb4d2 | 2018-10-23 18:50:39 +0300 | [diff] [blame] | 108 | 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 Startsev | 133194c | 2018-07-13 12:58:36 +0300 | [diff] [blame] | 116 | if (project.name.contains("benchmark")) return |
| 117 | |
Leonid Startsev | 00dd4f5 | 2017-08-23 16:09:21 +0300 | [diff] [blame] | 118 | apply plugin: 'maven-publish' |
Leonid Startsev | ed87fbd | 2017-08-04 17:33:09 +0300 | [diff] [blame] | 119 | |
Leonid Startsev | d79fb1f | 2017-09-15 18:02:59 +0300 | [diff] [blame] | 120 | def varintName = "" |
| 121 | |
| 122 | if (project.name == "jvm") { |
| 123 | varintName = "${rootProject.name}" |
| 124 | } else { |
| 125 | varintName = "${rootProject.name}-${project.name}" |
| 126 | } |
Leonid Startsev | a587393 | 2017-08-09 11:36:01 +0300 | [diff] [blame] | 127 | |
Leonid Startsev | ef12538 | 2017-09-22 16:50:39 +0300 | [diff] [blame] | 128 | afterEvaluate { |
| 129 | task sourceJar(type: Jar, dependsOn: classes) { |
| 130 | classifier 'sources' |
| 131 | from sourceSets.main.kotlin |
Leonid Startsev | 8818540 | 2018-02-01 16:03:25 +0300 | [diff] [blame] | 132 | if (project.name == "jvm" || project.name == "js") { |
| 133 | duplicatesStrategy = "exclude" |
| 134 | def platformSrc = sourceSets.main.kotlin |
| 135 | def commonSrc = project(':common').sourceSets.main.kotlin |
| 136 | from(platformSrc + commonSrc) |
| 137 | } |
Leonid Startsev | ef12538 | 2017-09-22 16:50:39 +0300 | [diff] [blame] | 138 | } |
Leonid Startsev | 00dd4f5 | 2017-08-23 16:09:21 +0300 | [diff] [blame] | 139 | } |
Leonid Startsev | a587393 | 2017-08-09 11:36:01 +0300 | [diff] [blame] | 140 | |
Leonid Startsev | 00dd4f5 | 2017-08-23 16:09:21 +0300 | [diff] [blame] | 141 | tasks.withType(Jar) { |
| 142 | archivesBaseName = varintName |
| 143 | } |
Leonid Startsev | a587393 | 2017-08-09 11:36:01 +0300 | [diff] [blame] | 144 | |
Leonid Startsev | fa9e920 | 2018-10-18 17:13:44 +0300 | [diff] [blame] | 145 | apply from: "${rootProject.rootDir}/gradle/mavenMetadata.gradle" |
| 146 | |
Leonid Startsev | 00dd4f5 | 2017-08-23 16:09:21 +0300 | [diff] [blame] | 147 | publishing { |
| 148 | publications { |
Leonid Startsev | 1e737f2 | 2017-09-14 13:19:32 +0300 | [diff] [blame] | 149 | mavenProject(MavenPublication) { |
Leonid Startsev | 00dd4f5 | 2017-08-23 16:09:21 +0300 | [diff] [blame] | 150 | from components.java |
| 151 | groupId project.group |
| 152 | artifactId varintName |
| 153 | version project.version |
| 154 | |
| 155 | artifact sourceJar { |
| 156 | classifier "sources" |
| 157 | } |
Leonid Startsev | fa9e920 | 2018-10-18 17:13:44 +0300 | [diff] [blame] | 158 | pom.withXml { |
| 159 | def root = it.asNode() |
| 160 | // NOTE: Don't try to move top-level things (especially "description") to the pomConfig block |
| 161 | // because they would resolve incorrectly to top-level project properties in Gradle/Groovy |
| 162 | root.appendNode('name', varintName) |
| 163 | root.appendNode('description', 'Kotlin multiplatform serialization runtime library') |
| 164 | root.appendNode('url', 'https://github.com/Kotlin/kotlinx.serialization') |
| 165 | root.children().last() + pomConfig |
| 166 | } |
Leonid Startsev | a587393 | 2017-08-09 11:36:01 +0300 | [diff] [blame] | 167 | } |
Leonid Startsev | 08d3ca0 | 2017-07-26 15:16:23 +0300 | [diff] [blame] | 168 | } |
| 169 | } |
Leonid Startsev | 1e737f2 | 2017-09-14 13:19:32 +0300 | [diff] [blame] | 170 | |
Leonid Startsev | bae49f9 | 2018-05-03 19:57:01 +0300 | [diff] [blame] | 171 | apply plugin: 'com.jfrog.bintray' |
Leonid Startsev | c563d23 | 2018-05-07 20:29:23 +0300 | [diff] [blame] | 172 | |
| 173 | apply from: "${rootProject.rootDir}/gradle/bintray.gradle" |
Leonid Startsev | 23dfc08 | 2018-10-19 14:34:14 +0300 | [diff] [blame] | 174 | |
| 175 | // Disable metadata for non-native modules |
| 176 | afterEvaluate { |
| 177 | publishing.publications.each { pub -> |
Leonid Startsev | b4656a0 | 2019-01-17 16:19:12 +0300 | [diff] [blame] | 178 | pub.moduleDescriptorGenerator = null |
Leonid Startsev | 23dfc08 | 2018-10-19 14:34:14 +0300 | [diff] [blame] | 179 | } |
| 180 | } |
Leonid Startsev | da728dd | 2018-03-07 12:41:47 +0300 | [diff] [blame] | 181 | } |