Skip to content

Commit

Permalink
added setup for bintray release process (#1037)
Browse files Browse the repository at this point in the history
  • Loading branch information
Langston Smith authored and tobrun committed Jul 4, 2019
1 parent 22f3909 commit 131df81
Show file tree
Hide file tree
Showing 14 changed files with 172 additions and 193 deletions.
23 changes: 11 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,17 @@ javadoc:
./gradlew :services-turf:javadoc; mv services-turf/build/docs/javadoc/ ./documentation/turf/javadoc/ ; \
./gradlew :services:javadoc; mv services/build/docs/javadoc/ ./documentation/services/javadoc/ ; \

publish:
export IS_LOCAL_DEVELOPMENT=false; ./gradlew :services-core:uploadArchives ; \
export IS_LOCAL_DEVELOPMENT=false; ./gradlew :services-geojson:uploadArchives ; \
export IS_LOCAL_DEVELOPMENT=false; ./gradlew :services:uploadArchives ; \
export IS_LOCAL_DEVELOPMENT=false; ./gradlew :services-turf:uploadArchives ; \

publish-local:
# This publishes to ~/.m2/repository/com/mapbox/mapboxsdk
export IS_LOCAL_DEVELOPMENT=true; ./gradlew :services-core:uploadArchives ; \
export IS_LOCAL_DEVELOPMENT=true; ./gradlew :services-geojson:uploadArchives ; \
export IS_LOCAL_DEVELOPMENT=true; ./gradlew :services:uploadArchives ; \
export IS_LOCAL_DEVELOPMENT=true; ./gradlew :services-turf:uploadArchives ; \
publish-to-bintray:
./gradlew :services-core:bintrayUpload ; \
./gradlew :services-geojson:bintrayUpload ; \
./gradlew :services:bintrayUpload ; \
./gradlew :services-turf:bintrayUpload ; \

publish-snapshot:
./gradlew :services-core:artifactoryPublish ; \
./gradlew :services-geojson:artifactoryPublish ; \
./gradlew :services:artifactoryPublish ; \
./gradlew :services-turf:artifactoryPublish ; \

graphs:
./gradlew :services-core:generateDependencyGraphMapboxLibraries
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ If you want to test recent bugfixes or features that have not been packaged in a

```gradle
repositories {
mavenCentral()
maven { url "http://oss.sonatype.org/content/repositories/snapshots/" }
jcenter()
maven { url 'https://oss.jfrog.org/artifactory/oss-snapshot-local/' }
}
dependencies {
Expand Down
14 changes: 9 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ buildscript {
classpath pluginDependencies.errorprone
classpath pluginDependencies.buildConfig
classpath pluginDependencies.jacoco

// These plugins are for publishing to Bintray
classpath pluginDependencies.bintray
classpath pluginDependencies.maven
classpath pluginDependencies.artifactory
}
}

Expand All @@ -31,9 +36,9 @@ allprojects {
google()
mavenCentral()
jcenter()
// For publishing to Bintray
maven { url 'https://mapbox.bintray.com/mapbox' }
}
group = GROUP
version = VERSION_NAME
}

subprojects {
Expand Down Expand Up @@ -97,12 +102,11 @@ subprojects { subproject ->
}

if (RELEASE_MODULES.contains(subproject.name)) {
subproject.apply from: "${rootDir}/gradle/mvn-push.gradle"
subproject.apply from: "${rootDir}/gradle/gradle-bintray.gradle"
subproject.apply from: "${rootDir}/gradle/dependencies-graph.gradle"
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}

}
29 changes: 19 additions & 10 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,20 +58,29 @@ jobs:
- checkout
- run:
name: Generate Maven credentials
shell: /bin/bash -euo pipefail
command: |
aws s3 cp s3://mapbox/android/signing-credentials/secring.gpg secring.gpg
echo "NEXUS_USERNAME=$PUBLISH_NEXUS_USERNAME
NEXUS_PASSWORD=$PUBLISH_NEXUS_PASSWORD
signing.keyId=$SIGNING_KEYID
signing.password=$SIGNING_PASSWORD
signing.secretKeyRingFile=../secring.gpg" >> gradle.properties
if [ -n "${BINTRAY_USER}" ]; then
echo "BINTRAY_USER=$BINTRAY_USER
BINTRAY_API_KEY=$BINTRAY_API_KEY
GPG_PASSPHRASE=$GPG_PASSPHRASE"
fi
- run:
name: Update version name
command: |
if [[ $CIRCLE_TAG == v* ]]; then
sed -i -e "s/^VERSION_NAME=.*/VERSION_NAME=${CIRCLE_TAG:9}/" gradle.properties
fi
- run:
name: Build Java libraries
command: make build-release
- deploy:
name: Publish Java Services To Maven Central
name: Publish Java libraries to Bintray
command: |
if [ "${CIRCLE_BRANCH}" == "master" ]; then
make publish ;
if [[ $CIRCLE_BRANCH == master ]] || [[ $CIRCLE_TAG == v* ]]; then
version=$(cat gradle.properties | grep "VERSION_NAME")
if [[ $version != *"SNAPSHOT"* ]]; then
make publish-to-bintray
else
make publish-snapshot
fi
fi
28 changes: 1 addition & 27 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,32 +1,6 @@
# Project-wide Gradle settings.
VERSION_NAME=4.9.0-SNAPSHOT
GROUP=com.mapbox.mapboxsdk

POM_URL=https://github.com/mapbox/mapbox-java
POM_SCM_URL=https://github.com/mapbox/mapbox-java
POM_SCM_CONNECTION=scm:[email protected]:mapbox/mapbox-java.git
POM_SCM_DEV_CONNECTION=scm:[email protected]:mapbox/mapbox-java.git

POM_LICENCE_NAME=The Apache Software License, Version 2.0
POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt
POM_LICENCE_DIST=repo

POM_DEVELOPER_ID=mapbox
POM_DEVELOPER_NAME=Mapbox

# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx2048M

# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true

# Publishing
#NEXUS_USERNAME=
#NEXUS_PASSWORD=
#signing.keyId=
#signing.password=
#signing.secretKeyRingFile=

org.gradle.jvmargs=-Xmx2048M
24 changes: 24 additions & 0 deletions gradle/artifact-settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
ext {

mapboxArtifactGroupId = 'com.mapbox.mapboxsdk'
mapboxArtifactId = project.hasProperty('POM_ARTIFACT_ID') ? project.property('POM_ARTIFACT_ID') : System.getenv('POM_ARTIFACT_ID')
mapboxArtifactTitle = 'Mapbox Java SDK'
mapboxArtifactDescription = project.hasProperty('POM_DESCRIPTION') ? project.property('POM_DESCRIPTION') : System.getenv('POM_DESCRIPTION')
mapboxDeveloperName = 'Mapbox'
mapboxDeveloperEmail = '[email protected]'
mapboxDeveloperOrganization = 'Mapbox'
mapboxDeveloperOrganizationUrl = 'http://www.mapbox.com'
mapboxDeveloperId = 'mapbox'
mapboxArtifactUrl = 'https://github.com/mapbox/mapbox-java'
mapboxArtifactVcsUrl = 'https://github.com/mapbox/mapbox-java.git'
mapboxArtifactScmUrl = 'scm:[email protected]:mapbox/mapbox-java.git'
mapboxArtifactLicenseName = 'The Apache Software License, Version 2.0'
mapboxArtifactLicenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
versionName = project.hasProperty('VERSION_NAME') ? project.property('VERSION_NAME') : System.getenv('VERSION_NAME')

mapboxBintrayUserOrg = 'mapbox'
mapboxBintrayRepoName = 'mapbox'
mapboxBintrayUser = project.hasProperty('BINTRAY_USER') ? project.property('BINTRAY_USER') : System.getenv('BINTRAY_USER')
mapboxBintrayApiKey = project.hasProperty('BINTRAY_API_KEY') ? project.property('BINTRAY_API_KEY') : System.getenv('BINTRAY_API_KEY')
mapboxGpgPassphrase = project.hasProperty('GPG_PASSPHRASE') ? project.property('GPG_PASSPHRASE') : System.getenv('GPG_PASSPHRASE')
}
12 changes: 9 additions & 3 deletions gradle/dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,12 @@ ext {
errorprone : '0.0.14',
spotbugs : '1.3',
buildConfig: '1.1.8',
dependencyGraph: '0.4.0'

dependencyGraph: '0.4.0',
bintray : '1.8.4',
maven : '3.6.2',
artifactory: '4.9.3',
]

dependenciesList = [
autoValue : "com.google.auto.value:auto-value:${version.autoValue}",
autoValueGson : "com.ryanharter.auto.value:auto-value-gson:${version.autoValueGson}",
Expand All @@ -45,6 +48,9 @@ ext {
errorprone : "net.ltgt.gradle:gradle-errorprone-plugin:${pluginVersion.errorprone}",
buildConfig: "gradle.plugin.de.fuerstenau:BuildConfigPlugin:${pluginVersion.buildConfig}",
dependencyGraph: "com.vanniktech:gradle-dependency-graph-generator-plugin:${pluginVersion.dependencyGraph}",
jacoco : "com.vanniktech:gradle-android-junit-jacoco-plugin:${pluginVersion.jacoco}"
jacoco : "com.vanniktech:gradle-android-junit-jacoco-plugin:${pluginVersion.jacoco}",
bintray : "com.jfrog.bintray.gradle:gradle-bintray-plugin:${pluginVersion.bintray}",
maven : "digital.wup:android-maven-publish:${pluginVersion.maven}",
artifactory: "org.jfrog.buildinfo:build-info-extractor-gradle:${pluginVersion.artifactory}",
]
}
95 changes: 95 additions & 0 deletions gradle/gradle-bintray.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
apply plugin: 'digital.wup.android-maven-publish'
apply plugin: 'java'
apply plugin: 'maven-publish'
apply plugin: 'com.jfrog.bintray'
apply plugin: 'com.jfrog.artifactory'
apply from: file('../gradle/artifact-settings.gradle')

publishing {
publications {
MapboxJavaSDKPublication(MavenPublication) {
from components.java
groupId project.ext.mapboxArtifactGroupId
artifactId project.ext.mapboxArtifactId
version project.ext.versionName

afterEvaluate {
artifact("$buildDir/outputs/aar/${project.ext.mapboxArtifactId}-release.aar")
artifact sourcesJar
artifact javadocJar
}

pom.withXml {
final mainNode = asNode()
mainNode.appendNode('name', project.ext.mapboxArtifactTitle)
mainNode.appendNode('description', project.ext.mapboxArtifactTitle)
mainNode.appendNode('url', project.ext.mapboxArtifactUrl)

final licenseNode = mainNode.appendNode('licenses').appendNode('license')
licenseNode.appendNode('name', project.ext.mapboxArtifactLicenseName)
licenseNode.appendNode('url', project.ext.mapboxArtifactLicenseUrl)
licenseNode.appendNode('distribution', "repo")

final developerNode = mainNode.appendNode('developers').appendNode('developer')
developerNode.appendNode('id', project.ext.mapboxDeveloperId)
developerNode.appendNode('name', project.ext.mapboxDeveloperName)
developerNode.appendNode('email', project.ext.mapboxDeveloperEmail)
developerNode.appendNode('organization', project.ext.mapboxDeveloperOrganization)
developerNode.appendNode('organizationUrl', project.ext.mapboxDeveloperOrganizationUrl)

final scmNode = mainNode.appendNode("scm")
scmNode.appendNode("connection", project.ext.mapboxArtifactScmUrl)
scmNode.appendNode("developerConnection", project.ext.mapboxArtifactScmUrl)
scmNode.appendNode("url", project.ext.mapboxArtifactUrl)
}

}
}
}

bintray {
user = mapboxBintrayUser
key = mapboxBintrayApiKey
publications = ['MapboxJavaSDKPublication']
pkg {
repo = project.ext.mapboxBintrayRepoName
name = project.ext.mapboxArtifactId
userOrg = project.ext.mapboxBintrayUserOrg
licenses = [project.ext.mapboxArtifactLicenseName]
vcsUrl = project.ext.mapboxArtifactVcsUrl
publish = false
version {
name = project.ext.versionName
desc = project.ext.mapboxArtifactDescription
released = new Date()
gpg {
sign = true
passphrase = mapboxGpgPassphrase
}
mavenCentralSync {
sync = false
}
}
}
}

artifactory {
contextUrl = 'http://oss.jfrog.org'
publish {
repository {
repoKey = 'oss-snapshot-local'
username = mapboxBintrayUser
password = mapboxBintrayApiKey
}
defaults {
publications('MapboxJavaSDKPublication')
}
}
}


tasks.withType(Javadoc) {
options.addStringOption('encoding', 'UTF-8')
options.addStringOption('docencoding', 'UTF-8')
options.addStringOption('charset', 'UTF-8')
}
Loading

0 comments on commit 131df81

Please sign in to comment.