| /* |
| * Copyright 2018 JetBrains s.r.o. |
| * |
| * Licensed under the Apache License, Version 2.0 (the "License"); |
| * you may not use this file except in compliance with the License. |
| * You may obtain a copy of the License at |
| * |
| * http://www.apache.org/licenses/LICENSE-2.0 |
| * |
| * Unless required by applicable law or agreed to in writing, software |
| * distributed under the License is distributed on an "AS IS" BASIS, |
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| * See the License for the specific language governing permissions and |
| * limitations under the License. |
| */ |
| |
| buildscript { |
| def deployNative = property('native.deploy') == 'true' |
| |
| if (project.hasProperty("bootstrap")) { |
| ext.compilerVersion = property('kotlin.version.snapshot') |
| ext.librariesVersion = property('kotlin.version.snapshot') |
| ext.serializationPluginVersion = property('plugin.version.snapshot') |
| ext.konanVersion = property('konan.version.snapshot') |
| ext["org.jetbrains.kotlin.native.home"] = System.getenv("KONAN_LOCAL_DIST") |
| } else { |
| ext.compilerVersion = property('kotlin.version') |
| ext.librariesVersion = property('kotlin.version') |
| ext.serializationPluginVersion = property('plugin.version') |
| ext.konanVersion = property('konan.version') |
| } |
| ext.serializationVersion = property('library.version') |
| ext.serializationCoordinates = "org.jetbrains.kotlin:kotlin-serialization" |
| ext.tcChannel = 'https://teamcity.jetbrains.com/guestAuth/app/rest/builds/id:2082584/artifacts/content/maven' |
| ext.devChannel = 'https://kotlin.bintray.com/kotlin-dev' |
| ext.serializationRepo = 'https://kotlin.bintray.com/kotlinx' |
| ext.experimentalsEnabled = ["-progressive", "-Xuse-experimental=kotlin.Experimental", |
| "-Xuse-experimental=kotlin.ExperimentalMultiplatform", |
| ] |
| |
| ext.experimentalsInTestEnabled = ["-progressive", "-Xuse-experimental=kotlin.Experimental", |
| "-Xuse-experimental=kotlin.ExperimentalMultiplatform", |
| "-Xuse-experimental=kotlinx.serialization.ImplicitReflectionSerializer", |
| ] |
| |
| repositories { |
| mavenLocal() |
| maven { url tcChannel } |
| maven { url devChannel } |
| maven { url serializationRepo } |
| maven { url "https://plugins.gradle.org/m2/" } |
| maven { url "https://dl.bintray.com/jetbrains/kotlin-native-dependencies" } |
| jcenter() |
| } |
| |
| dependencies { |
| classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$compilerVersion" |
| classpath "$serializationCoordinates:$serializationPluginVersion" |
| classpath "org.jetbrains.kotlin:kotlin-native-gradle-plugin:$konanVersion" |
| |
| classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.2' |
| |
| // Custom bintray plugin to publish with Gradle Metadata |
| classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4-jetbrains-3" |
| |
| classpath "com.github.jengelman.gradle.plugins:shadow:2.0.2" |
| classpath "me.champeau.gradle:jmh-gradle-plugin:0.4.5" |
| classpath "net.ltgt.gradle:gradle-apt-plugin:0.10" |
| } |
| } |
| |
| ext { |
| libraries = [ |
| kotlin_stdlib: "org.jetbrains.kotlin:kotlin-stdlib:$librariesVersion", |
| kotlin_stdlib_common: "org.jetbrains.kotlin:kotlin-stdlib-common:$librariesVersion", |
| kotlin_stdlib_js: "org.jetbrains.kotlin:kotlin-stdlib-js:$librariesVersion", |
| kotlin_test: "org.jetbrains.kotlin:kotlin-test:$librariesVersion", |
| kotlin_test_junit: "org.jetbrains.kotlin:kotlin-test-junit:$librariesVersion", |
| kotlin_test_common: "org.jetbrains.kotlin:kotlin-test-common:$librariesVersion", |
| kotlin_test_annotations_common: "org.jetbrains.kotlin:kotlin-test-annotations-common:$librariesVersion", |
| kotlin_test_js: "org.jetbrains.kotlin:kotlin-test-js:$librariesVersion", |
| kotlin_reflect: "org.jetbrains.kotlin:kotlin-reflect:$librariesVersion", |
| ] |
| } |
| |
| allprojects { |
| group 'org.jetbrains.kotlinx' |
| version serializationVersion |
| |
| if (project.hasProperty("bootstrap")) { |
| version = version + '-SNAPSHOT' |
| } |
| |
| repositories { |
| mavenLocal() |
| maven { url tcChannel } |
| maven { url devChannel } |
| maven { url serializationRepo } |
| jcenter() |
| } |
| } |
| |
| apply plugin: 'kotlin' |
| |
| subprojects { |
| configurations.all { |
| resolutionStrategy.eachDependency { DependencyResolveDetails details -> |
| if (details.requested.group == 'org.jetbrains.kotlin' && details.requested.name == 'kotlinx-serialization-unshaded') { |
| details.useVersion serializationPluginVersion |
| details.because 'use not bundled one' |
| } |
| } |
| } |
| |
| if (project.name.contains("native")) return |
| |
| apply plugin: 'kotlinx-serialization' |
| |
| tasks.withType(org.jetbrains.kotlin.gradle.tasks.AbstractKotlinCompile).all { task -> |
| if (task.name.contains("Test") || task.name.contains("Jmh")) { |
| task.kotlinOptions.freeCompilerArgs += experimentalsInTestEnabled |
| } else { |
| task.kotlinOptions.freeCompilerArgs += experimentalsEnabled |
| } |
| } |
| |
| if (project.name.contains("benchmark")) return |
| |
| apply plugin: 'maven-publish' |
| |
| def varintName = "" |
| |
| if (project.name == "jvm") { |
| varintName = "${rootProject.name}" |
| } else { |
| varintName = "${rootProject.name}-${project.name}" |
| } |
| |
| afterEvaluate { |
| task sourceJar(type: Jar, dependsOn: classes) { |
| classifier 'sources' |
| from sourceSets.main.kotlin |
| if (project.name == "jvm" || project.name == "js") { |
| duplicatesStrategy = "exclude" |
| def platformSrc = sourceSets.main.kotlin |
| def commonSrc = project(':common').sourceSets.main.kotlin |
| from(platformSrc + commonSrc) |
| } |
| } |
| } |
| |
| tasks.withType(Jar) { |
| archivesBaseName = varintName |
| } |
| |
| apply from: "${rootProject.rootDir}/gradle/mavenMetadata.gradle" |
| |
| publishing { |
| publications { |
| mavenProject(MavenPublication) { |
| from components.java |
| groupId project.group |
| artifactId varintName |
| version project.version |
| |
| artifact sourceJar { |
| classifier "sources" |
| } |
| pom.withXml { |
| def root = it.asNode() |
| // NOTE: Don't try to move top-level things (especially "description") to the pomConfig block |
| // because they would resolve incorrectly to top-level project properties in Gradle/Groovy |
| root.appendNode('name', varintName) |
| root.appendNode('description', 'Kotlin multiplatform serialization runtime library') |
| root.appendNode('url', 'https://github.com/Kotlin/kotlinx.serialization') |
| root.children().last() + pomConfig |
| } |
| } |
| } |
| } |
| |
| apply plugin: 'com.jfrog.bintray' |
| |
| apply from: "${rootProject.rootDir}/gradle/bintray.gradle" |
| |
| // Disable metadata for non-native modules |
| afterEvaluate { |
| publishing.publications.each { pub -> |
| pub.moduleDescriptorGenerator = null |
| } |
| } |
| } |