7
7
apply plugin : ' maven'
8
8
apply plugin : ' maven-publish'
9
9
apply plugin : ' com.jfrog.bintray'
10
+ apply plugin : ' com.jfrog.artifactory'
10
11
11
12
apply from : project. rootProject. file(' gradle/maven-central.gradle' )
12
13
@@ -16,6 +17,8 @@ def coroutines_core = platformLib("kotlinx-coroutines-core", platform)
16
17
// ------------- tasks
17
18
18
19
def isNative = project. name. endsWith(" native" )
20
+ def bUser = project. hasProperty(' bintrayUser' ) ? project. property(' bintrayUser' ) : System . getenv(' BINTRAY_USER' )
21
+ def bKey = project. hasProperty(' bintrayApiKey' ) ? project. property(' bintrayApiKey' ) : System . getenv(' BINTRAY_API_KEY' )
19
22
20
23
task sourcesJar (type : Jar ) {
21
24
classifier = ' sources'
@@ -46,9 +49,53 @@ publishing {
46
49
}
47
50
}
48
51
52
+ artifactory {
53
+ contextUrl = ' https://oss.jfrog.org/artifactory'
54
+ publish {
55
+ repository {
56
+ repoKey = ' oss-snapshot-local'
57
+ username = bUser
58
+ password = bKey
59
+ }
60
+
61
+ publications {
62
+ maven(MavenPublication ) {
63
+ if (! isNative) {
64
+ from components. java
65
+ artifact javadocJar
66
+ artifact sourcesJar
67
+ }
68
+ pom. withXml(configureMavenCentralMetadata)
69
+ }
70
+ }
71
+
72
+ defaults {
73
+ publications(' maven' )
74
+ }
75
+ }
76
+ }
77
+
78
+ /*
79
+ * Workaround for missing 'conditional build step' on teamcity
80
+ */
81
+ def getWorkingBranch () {
82
+ def workingBranch = """ git --git-dir=${ rootDir} /../.git
83
+ --work-tree=${ rootDir} /..
84
+ rev-parse --abbrev-ref HEAD""" . execute(). text. trim()
85
+ return workingBranch
86
+ }
87
+
88
+ task publishDevelopSnapshot () {
89
+ def branch = getWorkingBranch()
90
+ println " Current branch: $branch "
91
+ if (branch == " develop" ) {
92
+ dependsOn(" :artifactoryPublish" )
93
+ }
94
+ }
95
+
49
96
bintray {
50
- user = project . hasProperty( ' bintrayUser ' ) ? project . property( ' bintrayUser ' ) : System . getenv( ' BINTRAY_USER ' )
51
- key = project . hasProperty( ' bintrayApiKey ' ) ? project . property( ' bintrayApiKey ' ) : System . getenv( ' BINTRAY_API_KEY ' )
97
+ user = bUser
98
+ key = bKey
52
99
override = true // for multi-platform Kotlin/Native publishing
53
100
publications = [' maven' ]
54
101
pkg {
0 commit comments