Skip to content

Commit

Permalink
Moving release process to Bintray (#72)
Browse files Browse the repository at this point in the history
  • Loading branch information
Langston Smith authored Jul 4, 2019
1 parent 9d6f2dd commit 13212fd
Show file tree
Hide file tree
Showing 11 changed files with 172 additions and 180 deletions.
9 changes: 4 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@ test:
release:
./gradlew :library:assembleRelease

publish:
export IS_LOCAL_DEVELOPMENT=false; ./gradlew :library:uploadArchives
publish-stable:
./gradlew :library:bintrayUpload

publish-local:
# This publishes to ~/.m2/repository/com/mapbox/mapboxsdk
export IS_LOCAL_DEVELOPMENT=true; ./gradlew :library:uploadArchives
publish-snapshot-to-artifactory:
./gradlew :library:artifactoryPublish
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ The library is published to Maven Central and SNAPSHOTS are available whenever n
```java
// In the root build.gradle file
repositories {
mavenCentral()
maven { url "http://oss.sonatype.org/content/repositories/snapshots/" }
jcenter()
maven { url 'https://oss.jfrog.org/artifactory/oss-snapshot-local/' }
}
```
```java
Expand Down
8 changes: 5 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ buildscript {
}
dependencies {
classpath pluginDependencies.gradle

classpath pluginDependencies.bintrayPlugin
classpath pluginDependencies.androidPublishPlugin
classpath pluginDependencies.artifactory
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
Expand All @@ -18,18 +20,18 @@ allprojects {
repositories {
google()
jcenter()
maven { url 'https://mapbox.bintray.com/mapbox' }
}
}

subprojects { subproject ->
apply plugin: 'idea'

if (subproject.name == "library") {
apply from: "../gradle/mvn-push-android.gradle"
apply from: "../gradle/checkstyle.gradle"
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}
}
30 changes: 20 additions & 10 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,23 +62,33 @@ jobs:
steps:
- checkout
- run:
name: Generate Maven credentials
name: Generate Bintray 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}/" library/gradle.properties
fi
- run:
name: Build libraries
command: make release
- deploy:
name: Publish to Maven Central
name: Publish to Bintray
command: |
if [ "${CIRCLE_BRANCH}" == "master" ]; then
make publish ;
if [[ $CIRCLE_BRANCH == master ]] || [[ $CIRCLE_TAG == v* ]]; then
version=$(cat library/gradle.properties | grep "VERSION_NAME")
if [[ $version != *"SNAPSHOT"* ]]; then
make publish-stable
else
make publish-snapshot-to-artifactory
fi
fi
- store_artifacts:
path: app/build/reports
Expand Down
20 changes: 20 additions & 0 deletions gradle/artifact-settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
ext {
mapboxArtifactGroupId = 'com.mapbox.mapboxsdk'
mapboxArtifactId = 'mapbox-android-gestures'
mapboxArtifactTitle = 'Mapbox Android Gestures Library'
mapboxArtifactDescription = 'Mapbox Android Gestures Library'
mapboxDeveloperName = 'Mapbox'
mapboxDeveloperId = 'mapbox'
mapboxArtifactUrl = 'https://github.com/mapbox/mapbox-gestures-android'
mapboxArtifactVcsUrl = 'https://github.com/mapbox/mapbox-gestures-android.git'
mapboxArtifactScmUrl = 'scm:git@github.com/mapbox/mapbox-gestures-android.git'
mapboxArtifactLicenseName = 'BSD'
mapboxArtifactLicenseUrl = 'https://opensource.org/licenses/BSD-2-Clause'
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')
}
14 changes: 10 additions & 4 deletions gradle/dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,11 @@ ext {
]

pluginVersion = [
checkstyle: '8.4',
gradle : '3.3.0'
checkstyle : '8.4',
gradle : '3.3.0',
bintray : '1.8.4',
androidPublish : '3.6.2',
artifactory : '4.9.3',
]

dependenciesList = [
Expand Down Expand Up @@ -47,7 +50,10 @@ ext {
]

pluginDependencies = [
gradle : "com.android.tools.build:gradle:${pluginVersion.gradle}",
checkstyle: "com.puppycrawl.tools:checkstyle:${pluginVersion.checkstyle}"
gradle : "com.android.tools.build:gradle:${pluginVersion.gradle}",
checkstyle : "com.puppycrawl.tools:checkstyle:${pluginVersion.checkstyle}",
bintrayPlugin : "com.jfrog.bintray.gradle:gradle-bintray-plugin:${pluginVersion.bintray}",
androidPublishPlugin : "digital.wup:android-maven-publish:${pluginVersion.androidPublish}",
artifactory : "org.jfrog.buildinfo:build-info-extractor-gradle:${pluginVersion.artifactory}"
]
}
91 changes: 91 additions & 0 deletions gradle/gradle-bintray.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
apply plugin: 'digital.wup.android-maven-publish'
apply plugin: 'maven-publish'
apply plugin: 'com.jfrog.bintray'
apply plugin: 'com.jfrog.artifactory'
apply from: file('../gradle/artifact-settings.gradle')

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

afterEvaluate {
artifact("$buildDir/outputs/aar/${project.name}-release.aar")
artifact(androidSourcesJar)
artifact(androidJavadocsJar)
}

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)

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 = ['MapboxGesturesPublication']
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('MapboxGesturesPublication')
}
}
}


tasks.withType(Javadoc) {
options.addStringOption('encoding', 'UTF-8')
options.addStringOption('docencoding', 'UTF-8')
options.addStringOption('charset', 'UTF-8')
}
19 changes: 19 additions & 0 deletions gradle/javadoc.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apply from: "${rootDir}/gradle/dependencies.gradle"

android.libraryVariants.all { variant ->
def name = variant.name
task "javadoc$name"(type: Javadoc) {
description = "Generates javadoc for build $name"
failOnError = false
destinationDir = new File(destinationDir, variant.baseName)
source = variant.sourceSets.collect { it.java.sourceFiles }.inject { m, i -> m + i }
classpath = files(android.bootClasspath)
options.windowTitle("$POM_NAME $VERSION_NAME Reference")
options.docTitle("$POM_NAME $VERSION_NAME")
options.header("$POM_NAME $VERSION_NAME Reference")
options.bottom("© 2015–2019 Mapbox. All rights reserved.")
options.links("http://docs.oracle.com/javase/7/docs/api/")
options.linksOffline("http://d.android.com/reference/", "$System.env.ANDROID_HOME/docs/reference")
exclude '**/R.java', '**/BuildConfig.java', '**/*.kt'
}
}
Loading

0 comments on commit 13212fd

Please sign in to comment.