Skip to content

Commit fe4e05c

Browse files
committed
Module with kotlinx-coroutines BOM for better dependency management
* Snapshot publication is removed as no longer needed
1 parent 4809393 commit fe4e05c

File tree

6 files changed

+52
-41
lines changed

6 files changed

+52
-41
lines changed

binary-compatibility-validator/resources/api.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44

55
module.roots=/ integration reactive ui
66
module.marker=build.gradle
7-
module.ignore=kotlinx-coroutines-rx-example stdlib-stubs benchmarks knit binary-compatibility-validator site publication-validator
7+
module.ignore=kotlinx-coroutines-rx-example stdlib-stubs benchmarks knit binary-compatibility-validator site publication-validator kotlinx-coroutines-bom
88

99
packages.internal=kotlinx.coroutines.internal

build.gradle

+19-13
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ apply from: rootProject.file("gradle/experimental.gradle")
88
def rootModule = "kotlinx.coroutines"
99
def coreModule = "kotlinx-coroutines-core"
1010
// Not applicable for Kotlin plugin
11-
def sourceless = ['kotlinx.coroutines', 'site']
12-
def internal = sourceless + ['benchmarks', 'knit', 'js-stub', 'stdlib-stubs', 'binary-compatibility-validator']
11+
def sourceless = ['kotlinx.coroutines', 'site', 'kotlinx-coroutines-bom']
12+
def internal = ['kotlinx.coroutines', 'site', 'benchmarks', 'knit', 'js-stub', 'stdlib-stubs', 'binary-compatibility-validator']
1313
// Not published
1414
def unpublished = internal + ['kotlinx-coroutines-rx-example', 'example-frontend-js', 'android-unit-tests']
1515

@@ -58,12 +58,12 @@ buildscript {
5858
}
5959

6060
dependencies {
61-
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:$artifactory_plugin_version"
6261
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
6362
classpath "org.jetbrains.dokka:dokka-gradle-plugin:$dokka_version"
6463
classpath "org.jetbrains.kotlinx:atomicfu-gradle-plugin:$atomicfu_version"
6564
classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:$bintray_version"
6665
classpath "com.moowork.gradle:gradle-node-plugin:$gradle_node_version"
66+
classpath "io.spring.gradle:dependency-management-plugin:$spring_dependency_management_version"
6767

6868
// JMH plugins
6969
classpath "com.github.jengelman.gradle.plugins:shadow:4.0.2"
@@ -95,6 +95,8 @@ allprojects {
9595
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
9696
}
9797
}
98+
99+
ext.unpublished = unpublished
98100
}
99101

100102
allprojects {
@@ -201,23 +203,27 @@ def core_docs_url = "https://kotlin.github.io/kotlinx.coroutines/$coreModule/"
201203
def core_docs_file = "$projectDir/kotlinx-coroutines-core/build/dokka/kotlinx-coroutines-core/package-list"
202204

203205
configure(subprojects.findAll { !unpublished.contains(it.name) }) {
204-
apply from: rootProject.file('gradle/dokka.gradle')
206+
if (it.name != 'kotlinx-coroutines-bom') {
207+
apply from: rootProject.file('gradle/dokka.gradle')
208+
}
205209
apply from: rootProject.file('gradle/publish-bintray.gradle')
206210
}
207211

208212
configure(subprojects.findAll { !unpublished.contains(it.name) }) {
209-
if (it.name != coreModule) {
210-
dokka.dependsOn project(":$coreModule").dokka
211-
tasks.withType(dokka.getClass()) {
212-
externalDocumentationLink {
213-
url = new URL(core_docs_url)
214-
packageListUrl = new URL("file://$core_docs_file")
213+
if (it.name != "kotlinx-coroutines-bom") {
214+
if (it.name != coreModule) {
215+
dokka.dependsOn project(":$coreModule").dokka
216+
tasks.withType(dokka.getClass()) {
217+
externalDocumentationLink {
218+
url = new URL(core_docs_url)
219+
packageListUrl = new URL("file://$core_docs_file")
220+
}
215221
}
216222
}
217-
}
218223

219-
if (platformOf(it) == "jvm") {
220-
dokkaJavadoc.dependsOn project(":$coreModule").dokka
224+
if (platformOf(it) == "jvm") {
225+
dokkaJavadoc.dependsOn project(":$coreModule").dokka
226+
}
221227
}
222228
}
223229

gradle.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ byte_buddy_version=1.9.3
1414
reactor_vesion=3.2.5.RELEASE
1515
reactive_streams_version=1.0.2
1616
rxjava2_version=2.2.8
17-
artifactory_plugin_version=4.7.3
1817

1918
# JS
2019
gradle_node_version=1.2.0
@@ -24,5 +23,6 @@ mocha_version=4.1.0
2423
mocha_headless_chrome_version=1.8.2
2524
mocha_teamcity_reporter_version=2.2.2
2625
source_map_support_version=0.5.3
26+
spring_dependency_management_version=1.0.8.RELEASE
2727

2828
kotlin.incremental.multiplatform=true

gradle/publish-bintray.gradle

+11-26
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
apply plugin: 'maven'
88
apply plugin: 'maven-publish'
99
apply plugin: 'com.jfrog.bintray'
10-
apply plugin: 'com.jfrog.artifactory'
1110
apply plugin: "com.github.johnrengelman.shadow"
1211

1312
apply from: project.rootProject.file('gradle/maven-central.gradle')
@@ -16,6 +15,8 @@ apply from: project.rootProject.file('gradle/maven-central.gradle')
1615

1716
def bUser = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER')
1817
def bKey = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_API_KEY')
18+
def isMultiplatform = project.name == "kotlinx-coroutines-core"
19+
def isBom = project.name == "kotlinx-coroutines-bom"
1920

2021
task stubSources(type: Jar) {
2122
classifier = 'sources'
@@ -32,7 +33,7 @@ task sourcesJar(type: Jar) {
3233
classifier = 'sources'
3334
if (project.name == "kotlinx-coroutines-core") {
3435
from kotlin.sourceSets.commonMain.kotlin
35-
} else {
36+
} else if (!isBom) {
3637
from sourceSets.main.allSource
3738
}
3839
}
@@ -61,14 +62,19 @@ def configureTransitiveDependencies = { Project project, Publication publication
6162
}
6263
}
6364

64-
def isMultiplatform = project.name == "kotlinx-coroutines-core"
65-
6665
publishing {
6766
repositories {
6867
maven { url = 'https://kotlin.bintray.com/kotlinx' }
6968
}
7069

71-
if (!isMultiplatform) {
70+
if (isBom) {
71+
publications {
72+
mavenBom(MavenPublication) {
73+
pom.withXml(configureMavenCentralMetadata)
74+
}
75+
}
76+
return
77+
} else if (!isMultiplatform) {
7278
publications {
7379
maven(MavenPublication) { publication ->
7480
if (project.name == "kotlinx-coroutines-debug") {
@@ -144,27 +150,6 @@ private void disableMetadataPublication() {
144150
}
145151
}
146152

147-
// snapshot publication is temporary disabled
148-
//artifactory {
149-
// contextUrl = 'https://oss.jfrog.org/artifactory'
150-
// publish {
151-
// repository {
152-
// repoKey = 'oss-snapshot-local'
153-
// username = bUser
154-
// password = bKey
155-
// }
156-
//
157-
// maven(MavenPublication) { publication ->
158-
// preparePublication(publication)
159-
// }
160-
//
161-
// defaults {
162-
// publications('maven')
163-
// }
164-
// }
165-
//}
166-
167-
168153
task publishDevelopSnapshot() {
169154
def branch = System.getenv('currentBranch')
170155
if (branch == "develop") {

kotlinx-coroutines-bom/build.gradle

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/*
2+
* Copyright 2016-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
3+
*/
4+
plugins {
5+
id 'io.spring.dependency-management'
6+
}
7+
8+
def name = project.name
9+
10+
dependencyManagement {
11+
dependencies {
12+
rootProject.subprojects.each {
13+
if (!ext.unpublished.contains(it.name) && it.name != name) {
14+
dependency(group: it.group, name: it.name, version: it.version)
15+
}
16+
}
17+
}
18+
}

settings.gradle

+2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ include "kotlinx-coroutines-core"
2525
module('kotlinx-coroutines-test')
2626
module('kotlinx-coroutines-debug')
2727
module('stdlib-stubs')
28+
module('kotlinx-coroutines-bom')
29+
2830

2931
module('integration/kotlinx-coroutines-guava')
3032
module('integration/kotlinx-coroutines-jdk8')

0 commit comments

Comments
 (0)