@@ -8,6 +8,7 @@ apply plugin: 'maven'
8
8
apply plugin : ' maven-publish'
9
9
apply plugin : ' com.jfrog.bintray'
10
10
apply plugin : ' com.jfrog.artifactory'
11
+ apply plugin : " com.github.johnrengelman.shadow"
11
12
12
13
apply from : project. rootProject. file(' gradle/maven-central.gradle' )
13
14
@@ -16,13 +17,13 @@ def coroutines_core = platformLib("kotlinx-coroutines-core", platform)
16
17
17
18
// ------------- tasks
18
19
19
- def isNative = project. name. endsWith(" native" )
20
+ def isNative () { return project. name. endsWith(" native" ) }
20
21
def bUser = project. hasProperty(' bintrayUser' ) ? project. property(' bintrayUser' ) : System . getenv(' BINTRAY_USER' )
21
22
def bKey = project. hasProperty(' bintrayApiKey' ) ? project. property(' bintrayApiKey' ) : System . getenv(' BINTRAY_API_KEY' )
22
23
23
24
task sourcesJar (type : Jar ) {
24
25
classifier = ' sources'
25
- if (! isNative) {
26
+ if (! isNative() ) {
26
27
from sourceSets. main. allSource
27
28
}
28
29
@@ -32,19 +33,15 @@ task sourcesJar(type: Jar) {
32
33
}
33
34
}
34
35
36
+
35
37
publishing {
36
38
repositories {
37
39
maven { url = ' https://kotlin.bintray.com/kotlinx' }
38
40
}
39
41
40
42
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)
48
45
}
49
46
}
50
47
}
@@ -58,15 +55,8 @@ artifactory {
58
55
password = bKey
59
56
}
60
57
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)
70
60
}
71
61
72
62
defaults {
@@ -75,9 +65,21 @@ artifactory {
75
65
}
76
66
}
77
67
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
+
78
81
task publishDevelopSnapshot () {
79
82
def branch = System . getenv(' currentBranch' )
80
- println " Current branch: $branch "
81
83
if (branch == " develop" ) {
82
84
dependsOn(" :artifactoryPublish" )
83
85
}
@@ -112,7 +114,7 @@ bintrayUpload.doFirst {
112
114
}
113
115
114
116
// TODO :kludge this is required to disable publish of metadata for all but native
115
- if (! isNative) {
117
+ if (! isNative() ) {
116
118
afterEvaluate {
117
119
publishing. publications. each { pub ->
118
120
pub. gradleModuleMetadataFile = null
0 commit comments