Skip to content

Commit

Permalink
Update gradle config for MavenCentral (crossbario#297)
Browse files Browse the repository at this point in the history
  • Loading branch information
om26er authored Oct 2, 2017
1 parent adf5ced commit c9b34f1
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 20 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
BUILD_DATE=$(shell date -u +"%Y-%m-%d")
AUTOBAHN_JAVA_VERSION='17.10.1'
AUTOBAHN_JAVA_VERSION='17.10.2'
AUTOBAHN_JAVA_VCS_REF='unknown'

#export AUTOBAHN_TESTSUITE_VCS_REF=`git --git-dir="../autobahn-testsuite/.git" rev-list -n 1 v${AUTOBAHN_TESTSUITE_VERSION} --abbrev-commit`
Expand Down
68 changes: 49 additions & 19 deletions autobahn/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apply plugin: project.PLATFORM == project.PLATFORM_NETTY ? project.PLUGIN_JAVA_LIB: project.PLUGIN_ANDROID_LIB
apply plugin: project.PLATFORM == project.PLATFORM_NETTY ? 'maven-publish': 'com.github.dcendents.android-maven'
apply plugin: project.IS_ANDROID ? project.PLUGIN_ANDROID_LIB: project.PLUGIN_JAVA_LIB
apply plugin: project.IS_ANDROID ? 'com.github.dcendents.android-maven': 'maven-publish'
apply plugin: 'com.jfrog.bintray'

def ARTIFACT_ANDROID = 'autobahn-android'
Expand All @@ -9,7 +9,8 @@ def groupID = 'io.crossbar.autobahn'
def gitUrl = 'https://github.com/crossbario/autobahn-java.git'
def licenseName = 'MIT'
def licenseUrl = 'https://opensource.org/licenses/MIT'
def relVersion = System.getenv().containsKey('AUTOBAHN_BUILD_VERSION') ? System.getenv('AUTOBAHN_BUILD_VERSION'): '17.10.1'
def relVersion = System.getenv().containsKey('AUTOBAHN_BUILD_VERSION') ? System.getenv(
'AUTOBAHN_BUILD_VERSION'): '17.10.1'
def siteUrl = 'https://github.com/crossbario/autobahn-java'

dependencies {
Expand All @@ -18,7 +19,7 @@ dependencies {
implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-cbor:2.8.8'
implementation 'org.msgpack:jackson-dataformat-msgpack:0.8.13'
// implementation 'net.sourceforge.streamsupport:streamsupport-cfuture:1.5.6'
if (plugins.hasPlugin(project.PLUGIN_JAVA_LIB)) {
if (!project.IS_ANDROID) {
implementation 'io.netty:netty-codec-http:4.1.2.Final'
implementation 'io.netty:netty-handler:4.1.2.Final'
api 'com.fasterxml.jackson.core:jackson-core:2.8.8'
Expand All @@ -28,36 +29,32 @@ dependencies {
bintray {
user = System.getenv('BINTRAY_USER')
key = System.getenv('BINTRAY_KEY')
if (plugins.hasPlugin(project.PLUGIN_ANDROID_LIB)) {
if (project.IS_ANDROID) {
configurations = ['archives']
} else {
publications = ['mavenJava']
}
publish = true
pkg {
repo = 'autobahn'
name = project.PLATFORM == project.PLATFORM_NETTY ? ARTIFACT_JAVA: ARTIFACT_ANDROID
name = project.IS_ANDROID ? ARTIFACT_ANDROID: ARTIFACT_JAVA
userOrg = 'crossbario'
licenses = [licenseName]
vcsUrl = 'https://github.com/crossbario/autobahn-java.git'
vcsUrl = gitUrl
version {
name = relVersion
released = new Date()
mavenCentralSync {
sync = false
sync = true
user = System.getenv('SONATYPE_USERNAME')
password = System.getenv('SONATYPE_PASSWORD')
close = '1'
}
gpg {
sign = false
passphrase = System.getenv('BINTRAY_GPG_KEY')
}
}
}
}

if (plugins.hasPlugin(project.PLUGIN_ANDROID_LIB)) {
if (project.IS_ANDROID) {
android {
compileSdkVersion 26
buildToolsVersion '26.0.1'
Expand Down Expand Up @@ -106,6 +103,7 @@ if (plugins.hasPlugin(project.PLUGIN_ANDROID_LIB)) {

// Add your description here
name ARTIFACT_ANDROID
description 'WebSocket & WAMP for Android'
url siteUrl

// Set your license
Expand All @@ -115,26 +113,58 @@ if (plugins.hasPlugin(project.PLUGIN_ANDROID_LIB)) {
url licenseUrl
}
}
developers {
developer {
id "crossbario"
name "Crossbar.io"
email "[email protected]"
}
}
scm {
connection gitUrl
developerConnection siteUrl
url siteUrl
}
}
}
}
}
} else {
// Create the pom configuration:
def pomConfig = {
// Set your license
licenses {
license {
name licenseName
url licenseUrl
}
}
developers {
developer {
id "crossbario"
name "Crossbar.io"
email "[email protected]"
}
}
scm {
url siteUrl
}
}
publishing {
publications {
mavenJava(MavenPublication) {
groupId groupID
artifactId ARTIFACT_JAVA
version relVersion

from components.java
artifact sourcesJar
artifact javadocJar

groupId groupID
artifactId ARTIFACT_JAVA
version relVersion
pom.withXml {
def root = asNode()
root.appendNode('description', 'WebSocket & WAMP for Java8+')
root.appendNode('name', 'Autobahn Java')
root.appendNode('url', siteUrl)
root.children().last() + pomConfig
}
}
}
}
Expand Down
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ project.ext {
PLUGIN_ANDROID_LIB = 'com.android.library'
PLUGIN_JAVA_APP = 'application'
PLUGIN_JAVA_LIB = 'java-library'
IS_ANDROID = PLATFORM == PLATFORM_ANDROID
}

buildscript {
Expand Down

0 comments on commit c9b34f1

Please sign in to comment.