@@ -8,6 +8,7 @@ apply plugin: 'maven'
88apply plugin : ' maven-publish'
99apply plugin : ' com.jfrog.bintray'
1010apply plugin : ' com.jfrog.artifactory'
11+ apply plugin : " com.github.johnrengelman.shadow"
1112
1213apply from : project. rootProject. file(' gradle/maven-central.gradle' )
1314
@@ -16,13 +17,13 @@ def coroutines_core = platformLib("kotlinx-coroutines-core", platform)
1617
1718// ------------- tasks
1819
19- def isNative = project. name. endsWith(" native" )
20+ def isNative () { return project. name. endsWith(" native" ) }
2021def bUser = project. hasProperty(' bintrayUser' ) ? project. property(' bintrayUser' ) : System . getenv(' BINTRAY_USER' )
2122def bKey = project. hasProperty(' bintrayApiKey' ) ? project. property(' bintrayApiKey' ) : System . getenv(' BINTRAY_API_KEY' )
2223
2324task sourcesJar (type : Jar ) {
2425 classifier = ' sources'
25- if (! isNative) {
26+ if (! isNative() ) {
2627 from sourceSets. main. allSource
2728 }
2829
@@ -32,19 +33,15 @@ task sourcesJar(type: Jar) {
3233 }
3334}
3435
36+
3537publishing {
3638 repositories {
3739 maven { url = ' https://kotlin.bintray.com/kotlinx' }
3840 }
3941
4042 publications {
41- maven(MavenPublication ) {
42- if (! isNative) {
43- from components. java
44- artifact javadocJar
45- artifact sourcesJar
46- }
47- pom. withXml(configureMavenCentralMetadata)
43+ maven(MavenPublication ) { publication ->
44+ preparePublication(publication)
4845 }
4946 }
5047}
@@ -58,15 +55,8 @@ artifactory {
5855 password = bKey
5956 }
6057
61- publications {
62- maven(MavenPublication ) {
63- if (! isNative) {
64- from components. java
65- artifact javadocJar
66- artifact sourcesJar
67- }
68- pom. withXml(configureMavenCentralMetadata)
69- }
58+ maven(MavenPublication ) { publication ->
59+ preparePublication(publication)
7060 }
7161
7262 defaults {
@@ -75,9 +65,21 @@ artifactory {
7565 }
7666}
7767
68+ def preparePublication (MavenPublication publication ) {
69+ if (! isNative()) {
70+ if (project. name == " kotlinx-coroutines-debug" ) {
71+ project. shadow. component(publication)
72+ } else {
73+ publication. from components. java
74+ }
75+ publication. artifact javadocJar
76+ publication. artifact sourcesJar
77+ }
78+ publication. pom. withXml(configureMavenCentralMetadata)
79+ }
80+
7881task publishDevelopSnapshot () {
7982 def branch = System . getenv(' currentBranch' )
80- println " Current branch: $branch "
8183 if (branch == " develop" ) {
8284 dependsOn(" :artifactoryPublish" )
8385 }
@@ -112,7 +114,7 @@ bintrayUpload.doFirst {
112114}
113115
114116// TODO :kludge this is required to disable publish of metadata for all but native
115- if (! isNative) {
117+ if (! isNative() ) {
116118 afterEvaluate {
117119 publishing. publications. each { pub ->
118120 pub. gradleModuleMetadataFile = null
0 commit comments