Skip to content

Commit d2f4b2b

Browse files
committed
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
1 parent 4f8a38e commit d2f4b2b

File tree

11 files changed

+131
-184
lines changed

11 files changed

+131
-184
lines changed

binary-compatibility-validator/build.gradle

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
/*
2-
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
2+
* Copyright 2016-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
33
*/
44

55
configurations {
66
testArtifacts
7+
configureKotlinJvmPlatform(testArtifacts)
78
}
89

910
dependencies {

build.gradle

+8-6
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ buildscript {
6161
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
6262
classpath "org.jetbrains.dokka:dokka-gradle-plugin:$dokka_version"
6363
classpath "org.jetbrains.kotlinx:atomicfu-gradle-plugin:$atomicfu_version"
64-
classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:$bintray_version"
6564
classpath "com.moowork.gradle:gradle-node-plugin:$gradle_node_version"
6665
classpath "io.spring.gradle:dependency-management-plugin:$spring_dependency_management_version"
6766

@@ -72,6 +71,13 @@ buildscript {
7271
}
7372
}
7473

74+
import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType
75+
76+
// todo:KLUDGE: This is needed to workaround dependency resolution between Java and MPP modules
77+
def configureKotlinJvmPlatform(configuration) {
78+
configuration.attributes.attribute(KotlinPlatformType.attribute, KotlinPlatformType.jvm)
79+
}
80+
7581
allprojects {
7682
// the only place where HostManager could be instantiated
7783
project.ext.hostManager = new HostManager()
@@ -227,18 +233,14 @@ configure(subprojects.findAll { !unpublished.contains(it.name) }) {
227233
}
228234
}
229235
}
230-
231-
if (platformOf(it) == "jvm") {
232-
dokkaJavadoc.dependsOn project(":$coreModule").dokka
233-
}
234236
}
235237
}
236238

237239
// Report Kotlin compiler version when building project
238240
println("Using Kotlin compiler version: $org.jetbrains.kotlin.config.KotlinCompilerVersion.VERSION")
239241

240242
// --------------- Configure sub-projects that are published ---------------
241-
task deploy(dependsOn: getTasksByName("bintrayUpload", true) + getTasksByName("publishNpm", true))
243+
task deploy(dependsOn: getTasksByName("publish", true) + getTasksByName("publishNpm", true))
242244

243245
apply plugin: 'base'
244246

gradle.properties

+3-2
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,10 @@ kotlin_version=1.3.50
99

1010
# Dependencies
1111
junit_version=4.12
12-
atomicfu_version=0.12.11
12+
atomicfu_version=0.13.0
1313
html_version=0.6.8
1414
lincheck_version=2.0
1515
dokka_version=0.9.16-rdev-2-mpp-hacks
16-
bintray_version=1.8.4-jetbrains-5
1716
byte_buddy_version=1.9.3
1817
reactor_vesion=3.2.5.RELEASE
1918
reactive_streams_version=1.0.2
@@ -29,4 +28,6 @@ mocha_teamcity_reporter_version=2.2.2
2928
source_map_support_version=0.5.3
3029
spring_dependency_management_version=1.0.8.RELEASE
3130

31+
# Settings
3232
kotlin.incremental.multiplatform=true
33+
kotlin.native.ignoreDisabledTargets=true

gradle/dokka.gradle

+2-13
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
/*
2-
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
2+
* Copyright 2016-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
33
*/
44

55
// Configures generation of JavaDoc & Dokka artifacts
66

7-
87
def makeLinkMapping(dokka, projectDir) {
98
dokka.linkMapping {
109
def relPath = rootProject.projectDir.toPath().relativize(projectDir.toPath())
@@ -16,6 +15,7 @@ def makeLinkMapping(dokka, projectDir) {
1615

1716
configurations {
1817
dokkaStubs.extendsFrom compileOnly
18+
configureKotlinJvmPlatform(dokkaStubs)
1919
}
2020

2121
apply plugin: 'org.jetbrains.dokka'
@@ -83,14 +83,3 @@ if (project.name == "kotlinx-coroutines-core") {
8383
}
8484
}
8585
}
86-
87-
// real xxx-javadoc.jar for JVM
88-
task dokkaJavadoc(type: dokka.getClass()) {
89-
outputFormat = 'javadoc'
90-
outputDirectory = "$buildDir/javadoc"
91-
}
92-
93-
task javadocJar(type: Jar, dependsOn: dokkaJavadoc) {
94-
classifier = 'javadoc'
95-
from "$buildDir/javadoc"
96-
}

gradle/publish-bintray.gradle

+42-120
Original file line numberDiff line numberDiff line change
@@ -1,113 +1,87 @@
11
/*
2-
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
2+
* Copyright 2016-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
33
*/
44

55
// Configures publishing of Maven artifacts to Bintray
66

77
apply plugin: 'maven'
88
apply plugin: 'maven-publish'
9-
apply plugin: 'com.jfrog.bintray'
109
apply plugin: "com.github.johnrengelman.shadow"
1110

1211
apply from: project.rootProject.file('gradle/maven-central.gradle')
1312

1413
// ------------- tasks
1514

16-
def bUser = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER')
17-
def bKey = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_API_KEY')
1815
def isMultiplatform = project.name == "kotlinx-coroutines-core"
1916
def isBom = project.name == "kotlinx-coroutines-bom"
2017

21-
task stubSources(type: Jar) {
22-
classifier = 'sources'
23-
}
24-
25-
task stubJavadoc(type: Jar) {
26-
classifier = 'javadoc'
27-
}
28-
29-
task emptyJar(type: Jar) {
30-
}
18+
if (!isMultiplatform) {
19+
// Regular java modules need 'java-library' plugin for proper publication
20+
apply plugin: 'java-library'
3121

32-
task sourcesJar(type: Jar) {
33-
classifier = 'sources'
34-
if (project.name == "kotlinx-coroutines-core") {
35-
from kotlin.sourceSets.commonMain.kotlin
36-
} else if (!isBom) {
22+
// MPP projects pack their sources automatically, java libraries need to explicitly pack them
23+
task sourcesJar(type: Jar) {
24+
archiveClassifier = 'sources'
3725
from sourceSets.main.allSource
3826
}
3927
}
4028

41-
def configureTransitiveDependencies = { Project project, Publication publication ->
42-
project.configure(project) {
43-
publication.pom.withXml { pom ->
44-
def dependenciesNode = asNode().getAt("dependencies")[0]
45-
if (dependenciesNode == null) return
46-
dependenciesNode.dependency.each {
47-
it.artifactId.each { node ->
48-
def artifactId = node.text()
49-
if (!artifactId.endsWith("native")) return
50-
51-
switch (project.name) {
52-
case 'metadata':
53-
node.setValue("${artifactId[0..-8]}-common")
54-
break
55-
case 'js':
56-
node.setValue("${artifactId[0..-8]}-js")
57-
break
58-
}
59-
}
60-
}
61-
}
62-
}
29+
// empty xxx-javadoc.jar
30+
task javadocJar(type: Jar) {
31+
archiveClassifier = 'javadoc'
6332
}
6433

6534
publishing {
6635
repositories {
67-
maven { url = 'https://kotlin.bintray.com/kotlinx' }
36+
maven {
37+
def user = 'kotlin'
38+
def repo = 'kotlinx'
39+
def name = 'kotlinx.coroutines'
40+
url = "https://api.bintray.com/maven/$user/$repo/$name/;publish=0"
41+
42+
credentials {
43+
username = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER')
44+
password = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_API_KEY')
45+
}
46+
}
6847
}
6948

7049
if (isBom) {
50+
// Configure mavenBom publication
7151
publications {
72-
mavenBom(MavenPublication) {
73-
pom.withXml(configureMavenCentralMetadata)
74-
}
52+
mavenBom(MavenPublication) {}
7553
}
76-
return
7754
} else if (!isMultiplatform) {
55+
// Configure java publications for regular non-MPP modules
7856
publications {
79-
maven(MavenPublication) { publication ->
80-
publication.artifact javadocJar
81-
publication.artifact sourcesJar
82-
publication.pom.withXml(configureMavenCentralMetadata)
57+
maven(MavenPublication) {
8358
if (project.name == "kotlinx-coroutines-debug") {
84-
project.shadow.component(publication)
85-
publication.pom.withXml(configureMavenDependencies)
59+
project.shadow.component(it)
8660
} else {
87-
publication.from components.java
61+
from components.java
8862
}
63+
artifact sourcesJar
8964
}
9065
}
91-
92-
disableMetadataPublicationKotlinJvm()
93-
return
9466
}
9567

96-
// Rename artifacts for backward compatibility
9768
publications.all {
69+
pom.withXml(configureMavenCentralMetadata)
70+
71+
// add empty javadocs (no need for MPP root publication which publishes only pom file)
72+
if (it.name != 'kotlinMultiplatform' && !isBom) {
73+
it.artifact(javadocJar)
74+
}
75+
76+
// Rename MPP artifacts for backward compatibility
9877
def type = it.name
9978
switch (type) {
10079
case 'kotlinMultiplatform':
10180
it.artifactId = "$project.name-native"
102-
it.artifact emptyJar
103-
it.artifact stubJavadoc
104-
it.artifact sourcesJar
10581
break
106-
10782
case 'metadata':
10883
it.artifactId = "$project.name-common"
10984
break
110-
11185
case 'jvm':
11286
it.artifactId = "$project.name"
11387
break
@@ -117,71 +91,19 @@ publishing {
11791
break
11892
}
11993

120-
pom.withXml(configureMavenCentralMetadata)
121-
configureTransitiveDependencies(project, it)
122-
}
123-
124-
disableMetadataPublication()
125-
}
126-
127-
private void disableMetadataPublicationKotlinJvm() {
128-
publishing.publications.each { pub ->
129-
pub.moduleDescriptorGenerator = null
130-
tasks.matching { it.name == "generateMetadataFileFor${pub.name.capitalize()}Publication" }.all {
131-
onlyIf { false }
132-
}
133-
}
134-
}
135-
136-
private void disableMetadataPublication() {
137-
kotlin.targets.all { target ->
138-
def publication = publishing.publications.findByName(target.name)
139-
140-
if (publication != null) {
141-
publication.artifact stubJavadoc
142-
if (target.platformType.name != 'native') {
143-
publication.moduleDescriptorGenerator = null
144-
tasks.matching { it.name == "generateMetadataFileFor${name.capitalize()}Publication" }.all {
145-
onlyIf { false }
146-
}
147-
} else {
148-
publication.artifact emptyJar
149-
}
94+
// disable metadata everywhere, but in native modules
95+
if (type == 'maven' || type == 'metadata' || type == 'jvm' || type == 'js') {
96+
moduleDescriptorGenerator = null
15097
}
15198
}
15299
}
153100

154101
task publishDevelopSnapshot() {
155102
def branch = System.getenv('currentBranch')
156103
if (branch == "develop") {
157-
dependsOn(":artifactoryPublish")
104+
dependsOn(":publish")
158105
}
159106
}
160107

161-
bintray {
162-
user = bUser
163-
key = bKey
164-
override = true // for multi-platform Kotlin/Native publishing
165-
publications = ['maven']
166-
pkg {
167-
userOrg = 'kotlin'
168-
repo = 'kotlinx'
169-
name = 'kotlinx.coroutines'
170-
version {
171-
name = project.version
172-
vcsTag = project.version
173-
released = new Date()
174-
}
175-
}
176-
}
177-
178-
// TODO :kludge this is required for K/N publishing
179-
bintrayUpload.dependsOn publishToMavenLocal
180-
181-
// This is for easier debugging of bintray uploading problems
182-
bintrayUpload.doFirst {
183-
publications = project.publishing.publications.findAll { !it.name.contains('-test') }.collect {
184-
println("Uploading artifact '$it.groupId:$it.artifactId:$it.version' from publication '$it.name'")
185-
it
186-
}
187-
}
108+
// Compatibility with old TeamCity configurations that perform :kotlinx-coroutines-core:bintrayUpload
109+
task bintrayUpload(dependsOn: publish)

gradle/publish-npm-js.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
2+
* Copyright 2016-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
33
*/
44

55
def prop(name, defVal) {
@@ -14,7 +14,7 @@ def distTag(version) {
1414
return "latest"
1515
}
1616

17-
def npmTemplateDir = file("$projectDir/js/npm")
17+
def npmTemplateDir = file("$projectDir/npm")
1818
def npmDeployDir = file("$buildDir/npm")
1919

2020
def authToken = prop("kotlin.npmjs.auth.token", "")
+5-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
#Fri Mar 15 12:06:46 CET 2019
1+
#
2+
# Copyright 2016-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
3+
#
4+
25
distributionBase=GRADLE_USER_HOME
36
distributionPath=wrapper/dists
47
zipStoreBase=GRADLE_USER_HOME
58
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10-all.zip
9+
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.1-all.zip

kotlinx-coroutines-core/build.gradle

+4
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ kotlin {
4242
}
4343
}
4444

45+
configurations {
46+
configureKotlinJvmPlatform(kotlinCompilerPluginClasspath)
47+
}
48+
4549
kotlin.sourceSets {
4650
jvmTest.dependencies {
4751
api "com.devexperts.lincheck:lincheck:$lincheck_version"

kotlinx-coroutines-core/npm/README.md

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# kotlinx.coroutines
2+
3+
Library support for Kotlin coroutines in
4+
[Kotlin/JS](https://kotlinlang.org/docs/reference/js-overview.html).
5+
6+
```kotlin
7+
suspend fun main() = coroutineScope {
8+
launch {
9+
delay(1000)
10+
println("Kotlin Coroutines World!")
11+
}
12+
println("Hello")
13+
}
14+
```
15+
16+
## Documentation
17+
18+
* [Guide to kotlinx.coroutines by example on JVM](https://kotlinlang.org/docs/reference/coroutines/coroutines-guide.html) (**read it first**)
19+
* [Full kotlinx.coroutines API reference](https://kotlin.github.io/kotlinx.coroutines)

0 commit comments

Comments
 (0)