diff options
author | Roman Elizarov <elizarov@gmail.com> | 2019-09-02 17:22:39 +0300 |
---|---|---|
committer | Roman Elizarov <elizarov@gmail.com> | 2019-09-04 16:21:45 +0300 |
commit | d2f4b2b677af999cfc9a60f452890fffe4f30bcb (patch) | |
tree | 0d6a36acb25a3c94637d0f4c6e44369c9d53c127 /gradle | |
parent | 4f8a38e278e8b84f11e8a3716995ececb27c11f5 (diff) | |
download | kotlinx.coroutines-d2f4b2b677af999cfc9a60f452890fffe4f30bcb.tar.gz |
Gradle version 5.6.1
* Gradle metadata format version 1.0 (stable)
* Using Gradle publish task for publishing
* Empty javadoc files (only) are published
* Using atomicfu 0.13.0
Diffstat (limited to 'gradle')
-rw-r--r-- | gradle/dokka.gradle | 15 | ||||
-rw-r--r-- | gradle/publish-bintray.gradle | 162 | ||||
-rw-r--r-- | gradle/publish-npm-js.gradle | 4 | ||||
-rw-r--r-- | gradle/wrapper/gradle-wrapper.properties | 7 |
4 files changed, 51 insertions, 137 deletions
diff --git a/gradle/dokka.gradle b/gradle/dokka.gradle index 051bc1c9..f1d8f21a 100644 --- a/gradle/dokka.gradle +++ b/gradle/dokka.gradle @@ -1,10 +1,9 @@ /* - * Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2016-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ // Configures generation of JavaDoc & Dokka artifacts - def makeLinkMapping(dokka, projectDir) { dokka.linkMapping { def relPath = rootProject.projectDir.toPath().relativize(projectDir.toPath()) @@ -16,6 +15,7 @@ def makeLinkMapping(dokka, projectDir) { configurations { dokkaStubs.extendsFrom compileOnly + configureKotlinJvmPlatform(dokkaStubs) } apply plugin: 'org.jetbrains.dokka' @@ -83,14 +83,3 @@ if (project.name == "kotlinx-coroutines-core") { } } } - -// real xxx-javadoc.jar for JVM -task dokkaJavadoc(type: dokka.getClass()) { - outputFormat = 'javadoc' - outputDirectory = "$buildDir/javadoc" -} - -task javadocJar(type: Jar, dependsOn: dokkaJavadoc) { - classifier = 'javadoc' - from "$buildDir/javadoc" -} diff --git a/gradle/publish-bintray.gradle b/gradle/publish-bintray.gradle index 0e37c678..dd528fe9 100644 --- a/gradle/publish-bintray.gradle +++ b/gradle/publish-bintray.gradle @@ -1,113 +1,87 @@ /* - * Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2016-2019 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 plugin: 'com.jfrog.bintray' apply plugin: "com.github.johnrengelman.shadow" apply from: project.rootProject.file('gradle/maven-central.gradle') // ------------- tasks -def bUser = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER') -def bKey = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_API_KEY') def isMultiplatform = project.name == "kotlinx-coroutines-core" def isBom = project.name == "kotlinx-coroutines-bom" -task stubSources(type: Jar) { - classifier = 'sources' -} - -task stubJavadoc(type: Jar) { - classifier = 'javadoc' -} - -task emptyJar(type: Jar) { -} +if (!isMultiplatform) { + // Regular java modules need 'java-library' plugin for proper publication + apply plugin: 'java-library' -task sourcesJar(type: Jar) { - classifier = 'sources' - if (project.name == "kotlinx-coroutines-core") { - from kotlin.sourceSets.commonMain.kotlin - } else if (!isBom) { + // MPP projects pack their sources automatically, java libraries need to explicitly pack them + task sourcesJar(type: Jar) { + archiveClassifier = 'sources' from sourceSets.main.allSource } } -def configureTransitiveDependencies = { Project project, Publication publication -> - project.configure(project) { - publication.pom.withXml { pom -> - def dependenciesNode = asNode().getAt("dependencies")[0] - if (dependenciesNode == null) return - dependenciesNode.dependency.each { - it.artifactId.each { node -> - def artifactId = node.text() - if (!artifactId.endsWith("native")) return - - switch (project.name) { - case 'metadata': - node.setValue("${artifactId[0..-8]}-common") - break - case 'js': - node.setValue("${artifactId[0..-8]}-js") - break - } - } - } - } - } +// empty xxx-javadoc.jar +task javadocJar(type: Jar) { + archiveClassifier = 'javadoc' } publishing { repositories { - maven { url = 'https://kotlin.bintray.com/kotlinx' } + maven { + def user = 'kotlin' + def repo = 'kotlinx' + def name = 'kotlinx.coroutines' + url = "https://api.bintray.com/maven/$user/$repo/$name/;publish=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 (isBom) { + // Configure mavenBom publication publications { - mavenBom(MavenPublication) { - pom.withXml(configureMavenCentralMetadata) - } + mavenBom(MavenPublication) {} } - return } else if (!isMultiplatform) { + // Configure java publications for regular non-MPP modules publications { - maven(MavenPublication) { publication -> - publication.artifact javadocJar - publication.artifact sourcesJar - publication.pom.withXml(configureMavenCentralMetadata) + maven(MavenPublication) { if (project.name == "kotlinx-coroutines-debug") { - project.shadow.component(publication) - publication.pom.withXml(configureMavenDependencies) + project.shadow.component(it) } else { - publication.from components.java + from components.java } + artifact sourcesJar } } - - disableMetadataPublicationKotlinJvm() - return } - // Rename artifacts for backward compatibility publications.all { + pom.withXml(configureMavenCentralMetadata) + + // add empty javadocs (no need for MPP root publication which publishes only pom file) + if (it.name != 'kotlinMultiplatform' && !isBom) { + it.artifact(javadocJar) + } + + // Rename MPP artifacts for backward compatibility def type = it.name switch (type) { case 'kotlinMultiplatform': it.artifactId = "$project.name-native" - it.artifact emptyJar - it.artifact stubJavadoc - it.artifact sourcesJar break - case 'metadata': it.artifactId = "$project.name-common" break - case 'jvm': it.artifactId = "$project.name" break @@ -117,36 +91,9 @@ publishing { break } - pom.withXml(configureMavenCentralMetadata) - configureTransitiveDependencies(project, it) - } - - disableMetadataPublication() -} - -private void disableMetadataPublicationKotlinJvm() { - publishing.publications.each { pub -> - pub.moduleDescriptorGenerator = null - tasks.matching { it.name == "generateMetadataFileFor${pub.name.capitalize()}Publication" }.all { - onlyIf { false } - } - } -} - -private void disableMetadataPublication() { - kotlin.targets.all { target -> - def publication = publishing.publications.findByName(target.name) - - if (publication != null) { - publication.artifact stubJavadoc - if (target.platformType.name != 'native') { - publication.moduleDescriptorGenerator = null - tasks.matching { it.name == "generateMetadataFileFor${name.capitalize()}Publication" }.all { - onlyIf { false } - } - } else { - publication.artifact emptyJar - } + // disable metadata everywhere, but in native modules + if (type == 'maven' || type == 'metadata' || type == 'jvm' || type == 'js') { + moduleDescriptorGenerator = null } } } @@ -154,34 +101,9 @@ private void disableMetadataPublication() { task publishDevelopSnapshot() { def branch = System.getenv('currentBranch') if (branch == "develop") { - dependsOn(":artifactoryPublish") + dependsOn(":publish") } } -bintray { - user = bUser - key = bKey - override = true // for multi-platform Kotlin/Native publishing - publications = ['maven'] - pkg { - userOrg = 'kotlin' - repo = 'kotlinx' - name = 'kotlinx.coroutines' - version { - name = project.version - vcsTag = project.version - released = new Date() - } - } -} - -// TODO :kludge this is required for K/N publishing -bintrayUpload.dependsOn publishToMavenLocal - -// This is for easier debugging of bintray uploading problems -bintrayUpload.doFirst { - publications = project.publishing.publications.findAll { !it.name.contains('-test') }.collect { - println("Uploading artifact '$it.groupId:$it.artifactId:$it.version' from publication '$it.name'") - it - } -}
\ No newline at end of file +// Compatibility with old TeamCity configurations that perform :kotlinx-coroutines-core:bintrayUpload +task bintrayUpload(dependsOn: publish)
\ No newline at end of file diff --git a/gradle/publish-npm-js.gradle b/gradle/publish-npm-js.gradle index 1667a551..a2991db4 100644 --- a/gradle/publish-npm-js.gradle +++ b/gradle/publish-npm-js.gradle @@ -1,5 +1,5 @@ /* - * Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2016-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ def prop(name, defVal) { @@ -14,7 +14,7 @@ def distTag(version) { return "latest" } -def npmTemplateDir = file("$projectDir/js/npm") +def npmTemplateDir = file("$projectDir/npm") def npmDeployDir = file("$buildDir/npm") def authToken = prop("kotlin.npmjs.auth.token", "") diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 603c4e11..c141e334 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,9 @@ -#Fri Mar 15 12:06:46 CET 2019 +# +# Copyright 2016-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. +# + distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.10-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.1-all.zip |