Skip to content

Commit

Permalink
Ability to publish develop branch to oss.jfrog
Browse files Browse the repository at this point in the history
  • Loading branch information
qwwdfsad committed Nov 12, 2018
1 parent 6591c4e commit 3179683
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 2 deletions.
1 change: 1 addition & 0 deletions build.gradle
Expand Up @@ -31,6 +31,7 @@ buildscript {
}
}
dependencies {
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:$artifactory_plugin_version"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.kotlin:kotlin-native-gradle-plugin:$kotlin_native_version"
classpath "org.jetbrains.dokka:dokka-gradle-plugin:$dokka_version"
Expand Down
1 change: 1 addition & 0 deletions gradle.properties
Expand Up @@ -11,6 +11,7 @@ html_version=0.6.8
lincheck_version=1.9
dokka_version=0.9.16-rdev-2-mpp-hacks
bintray_version=1.8.2-SNAPSHOT
artifactory_plugin_version=4.7.3

# JS
gradle_node_version=1.2.0
Expand Down
41 changes: 39 additions & 2 deletions gradle/publish-bintray.gradle
Expand Up @@ -7,6 +7,7 @@
apply plugin: 'maven'
apply plugin: 'maven-publish'
apply plugin: 'com.jfrog.bintray'
apply plugin: 'com.jfrog.artifactory'

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

Expand All @@ -16,6 +17,8 @@ def coroutines_core = platformLib("kotlinx-coroutines-core", platform)
// ------------- tasks

def isNative = project.name.endsWith("native")
def bUser = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER')
def bKey = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_API_KEY')

task sourcesJar(type: Jar) {
classifier = 'sources'
Expand Down Expand Up @@ -46,9 +49,43 @@ publishing {
}
}

artifactory {
contextUrl = 'https://oss.jfrog.org/artifactory'
publish {
repository {
repoKey = 'oss-snapshot-local'
username = bUser
password = bKey
}

publications {
maven(MavenPublication) {
if (!isNative) {
from components.java
artifact javadocJar
artifact sourcesJar
}
pom.withXml(configureMavenCentralMetadata)
}
}

defaults {
publications('maven')
}
}
}

task publishDevelopSnapshot() {
def branch = System.getenv('currentBranch')
println "Current branch: $branch"
if (branch == "develop") {
dependsOn(":artifactoryPublish")
}
}

bintray {
user = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER')
key = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_API_KEY')
user = bUser
key = bKey
override = true // for multi-platform Kotlin/Native publishing
publications = ['maven']
pkg {
Expand Down

0 comments on commit 3179683

Please sign in to comment.