| /* |
| * 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.serializationCoordinates = "org.jetbrains.kotlin:kotlin-serialization" |
| } else { |
| ext.compilerVersion = property('kotlin.version') |
| ext.librariesVersion = property('kotlin.version') |
| ext.serializationPluginVersion = property('plugin.version') |
| ext.serializationCoordinates = "org.jetbrains.kotlin:kotlin-serialization" |
| } |
| ext.eapChannel = 'https://dl.bintray.com/kotlin/kotlin-eap' |
| ext.serializationRepo = 'https://kotlin.bintray.com/kotlinx' |
| |
| repositories { |
| jcenter() |
| mavenLocal() |
| maven { url "https://plugins.gradle.org/m2/" } |
| maven { url eapChannel } |
| maven { url serializationRepo } |
| maven { url "https://dl.bintray.com/jetbrains/kotlin-native-dependencies" } |
| } |
| |
| dependencies { |
| classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$compilerVersion" |
| classpath "$serializationCoordinates:$serializationPluginVersion" |
| classpath "org.jetbrains.kotlin:kotlin-native-gradle-plugin:${property('konan.version')}" |
| |
| classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.2' |
| |
| if (deployNative) { |
| // use patched version which supports Gradle metadata, but is not compatible with Maven publications |
| classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.2-SNAPSHOT' |
| } else { |
| classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.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 property('library.version') |
| |
| if (project.hasProperty("bootstrap")) { |
| version = version + '-SNAPSHOT' |
| } |
| |
| repositories { |
| jcenter() |
| mavenLocal() |
| maven { url eapChannel } |
| maven { url serializationRepo } |
| } |
| } |
| |
| apply plugin: 'kotlin' |
| |
| subprojects { |
| if (project.name.contains("native")) return |
| |
| apply plugin: 'kotlinx-serialization' |
| |
| 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.gradleModuleMetadataFile = null |
| tasks.matching { it.name == "generateMetadataFileFor${pub.name.capitalize()}Publication" }.all { |
| onlyIf { false } |
| } |
| } |
| } |
| } |