/* * Copyright 2017-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ // Configures publishing of Maven artifacts to Bintray apply plugin: 'maven' apply plugin: 'maven-publish' apply from: project.rootProject.file('gradle/maven-central.gradle') // todo: figure out how we can check it in a generic way def isMultiplatform = project.name == 'atomicfu' if (!isMultiplatform) { // Regular java modules need 'java-library' plugin for proper publication apply plugin: 'java-library' // MPP projects pack their sources automtically, java libraries need to explicitly pack them task sourcesJar(type: Jar) { archiveClassifier = 'sources' from "src/main/kotlin" } } // empty xxx-javadoc.jar task javadocJar(type: Jar) { archiveClassifier = 'javadoc' } publishing { repositories { maven { def user = 'kotlin' def repo = 'kotlinx' def name = 'kotlinx.atomicfu' url = "https://api.bintray.com/maven/$user/$repo/$name/;publish=0;override=0" credentials { username = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER') password = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_API_KEY') } } } if (!isMultiplatform) { // Configure java publications for non-MPP projects publications { // plugin configures its own publication pluginMaven if (project.name == 'atomicfu-gradle-plugin') { pluginMaven(MavenPublication) { artifact sourcesJar } } else { maven(MavenPublication) { from components.java artifact sourcesJar if (project.name.endsWith("-maven-plugin")) { pom.packaging = 'maven-plugin' } } } } } publications.all { pom.withXml(configureMavenCentralMetadata) // add empty javadocs if (it.name != "kotlinMultiplatform") { // The root module gets the JVM's javadoc JAR it.artifact(javadocJar) } } }