Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moving plugin release process to Bintray #961

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
MBGL_ANDROID_PLUGINS += traffic;plugin-traffic
MBGL_ANDROID_PLUGINS += locationlayer;plugin-locationlayer
MBGL_ANDROID_PLUGINS += building;plugin-building
MBGL_ANDROID_PLUGINS += offline;plugin-offline
MBGL_ANDROID_PLUGINS += places;plugin-places
MBGL_ANDROID_PLUGINS += annotation;plugin-annotation
MBGL_ANDROID_PLUGINS += localization;plugin-localization
MBGL_ANDROID_PLUGINS += markerview;plugin-markerview
MBGL_ANDROID_PLUGINS += scalebar;plugin-scalebar

checkstyle:
Expand All @@ -24,11 +25,14 @@ javadoc:
./gradlew javadocrelease

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

publish-snapshot:
export IS_LOCAL_DEVELOPMENT=false; ./gradlew artifactoryPublish

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

generate-sanity-test:
npm install && node scripts/generate-activity-test.js
Expand All @@ -54,11 +58,14 @@ javadoc-$1:
./gradlew :$2:javadocrelease

publish-$1:
export IS_LOCAL_DEVELOPMENT=false; ./gradlew :$2:uploadArchives
export IS_LOCAL_DEVELOPMENT=false; ./gradlew :$2:bintrayUpload

publish-snapshot-$1:
export IS_LOCAL_DEVELOPMENT=false; ./gradlew :$2:artifactoryPublish

publish-local-$1:
# This publishes to ~/.m2/repository/com/mapbox/mapboxsdk
export IS_LOCAL_DEVELOPMENT=true; ./gradlew :$2:uploadArchives
export IS_LOCAL_DEVELOPMENT=true; ./gradlew :$2:bintrayUpload

endef

Expand Down
11 changes: 10 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,18 @@ buildscript {
jcenter()
maven { url "https://maven.google.com" }
maven { url "https://plugins.gradle.org/m2/" }
maven { url 'https://oss.jfrog.org/artifactory/oss-snapshot-local/' }
}

dependencies {
classpath pluginDependencies.gradle
classpath pluginDependencies.kotlin
classpath pluginDependencies.kotlinLint

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

Expand All @@ -22,6 +28,9 @@ allprojects {
// SNAPSHOT repository
// maven { url "http://oss.sonatype.org/content/repositories/snapshots/" }
// maven { url 'https://oss.jfrog.org/artifactory/oss-snapshot-local/' }

// For publishing to Bintray
maven { url 'https://mapbox.bintray.com/mapbox' }
}
}

Expand All @@ -32,4 +41,4 @@ subprojects {

task clean(type: Delete) {
delete rootProject.buildDir
}
}
72 changes: 58 additions & 14 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ jobs:
environment:
JVM_OPTS: -Xmx3200m
BUILDTYPE: Debug
IS_LOCAL_DEVELOPMENT: false
steps:
- checkout
- restore_cache:
Expand Down Expand Up @@ -85,33 +84,78 @@ jobs:
working_directory: ~/code
environment:
BUILDTYPE: Release
IS_LOCAL_DEVELOPMENT: false
steps:
- checkout
- run:
name: Init submodules
command: git submodule update --init --recursive
- run:
name: Generate Maven credentials
name: Generate Bintray credentials
shell: /bin/bash -euo pipefail
command: |
if [ -n "${PUBLISH_NEXUS_USERNAME}" ]; then
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: Add bash environment variable to set which plugin is being released
command: |
if [[ $CIRCLE_TAG == v*-annotation ]]; then
echo 'export PLUGIN_BEING_RELEASED="annotation"' >> $BASH_ENV
source $PLUGIN_BEING_RELEASED
fi
if [[ $CIRCLE_TAG == v*-localization ]]; then
echo 'export PLUGIN_BEING_RELEASED="localization"' >> $BASH_ENV
source $PLUGIN_BEING_RELEASED
fi
if [[ $CIRCLE_TAG == v*-building ]]; then
echo 'export PLUGIN_BEING_RELEASED="building"' >> $BASH_ENV
source $PLUGIN_BEING_RELEASED
fi
if [[ $CIRCLE_TAG == v*-markerview ]]; then
echo 'export PLUGIN_BEING_RELEASED="markerview"' >> $BASH_ENV
source $PLUGIN_BEING_RELEASED
fi
if [[ $CIRCLE_TAG == v*-offline ]]; then
echo 'export PLUGIN_BEING_RELEASED="offline"' >> $BASH_ENV
source $PLUGIN_BEING_RELEASED
fi
if [[ $CIRCLE_TAG == v*-places ]]; then
echo 'export PLUGIN_BEING_RELEASED="places"' >> $BASH_ENV
source $PLUGIN_BEING_RELEASED
fi
if [[ $CIRCLE_TAG == v*-scalebar ]]; then
echo 'export PLUGIN_BEING_RELEASED="scalebar"' >> $BASH_ENV
source $PLUGIN_BEING_RELEASED
fi
if [[ $CIRCLE_TAG == v*-traffic ]]; then
echo 'export PLUGIN_BEING_RELEASED="traffic"' >> $BASH_ENV
source $PLUGIN_BEING_RELEASED
fi
- run:
name: Print PLUGIN_BEING_RELEASED variable to confirm that right plugin is being released
command: |
echo $PLUGIN_BEING_RELEASED
- run:
name: Update the version name for the plugin being released
command: |
if [[ $CIRCLE_TAG == v* ]]; then
sed -i -e "s/^VERSION_NAME=.*/VERSION_NAME=${CIRCLE_TAG:9}/" plugin-$PLUGIN_BEING_RELEASED/gradle.properties
fi
- run:
name: Build Plugins SDK
command: make build-release
- deploy:
name: Publish Plugins SDK To Maven Central
name: Publish the correct plugin to Bintray
command: |
if [ -n "${PUBLISH_NEXUS_USERNAME}" ]; then
if [ "${CIRCLE_BRANCH}" == "master" ]; then
make publish
if [[ $CIRCLE_BRANCH == master ]] || [[ $CIRCLE_TAG == v*- ]]; then
version=$(cat $PLUGIN_BEING_RELEASED/gradle.properties | grep "VERSION_NAME")
if [[ $version != *"SNAPSHOT"* ]]; then
make publish-$PLUGIN_BEING_RELEASED
fi
else
make publish-snapshot-$PLUGIN_BEING_RELEASED
fi
fi
- store_artifacts:
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 = project.hasProperty('POM_ARTIFACT_ID') ? project.property('POM_ARTIFACT_ID') : System.getenv('POM_ARTIFACT_ID')
mapboxArtifactTitle = project.hasProperty('POM_NAME') ? project.property('POM_NAME') : System.getenv('POM_NAME')
mapboxArtifactDescription = project.hasProperty('POM_DESCRIPTION') ? project.property('POM_DESCRIPTION') : System.getenv('POM_DESCRIPTION')
mapboxDeveloperName = 'Mapbox'
mapboxDeveloperId = 'mapbox'
mapboxArtifactUrl = 'https://github.com/mapbox/mapbox-plugins-android'
mapboxArtifactVcsUrl = 'https://github.com/mapbox/mapbox-plugins-android.git'
mapboxArtifactScmUrl = 'scm:git@github.com:mapbox/mapbox-plugins-android.git'
mapboxArtifactLicenseName = 'BSD 2-Clause'
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')
}
27 changes: 17 additions & 10 deletions gradle/dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,15 @@
]

pluginVersion = [
checkstyle: '8.10.1',
gradle : '3.4.0',
kotlin : '1.3.20',
dokka : '0.9.17',
kotlinLint: '8.1.0'
checkstyle : '8.10.1',
gradle : '3.4.0',
kotlin : '1.3.20',
dokka : '0.9.17',
kotlinLint : '8.1.0',
dependencyGraph : '0.4.0',
bintray : '1.8.4',
androidPublish : '3.6.2',
artifactory : '4.9.3'
]

dependenciesList = [
Expand Down Expand Up @@ -92,10 +96,13 @@
]

pluginDependencies = [
gradle : "com.android.tools.build:gradle:${pluginVersion.gradle}",
checkstyle: "com.puppycrawl.tools:checkstyle:${pluginVersion.checkstyle}",
kotlin : "org.jetbrains.kotlin:kotlin-gradle-plugin:${pluginVersion.kotlin}",
dokka : "org.jetbrains.dokka:dokka-android-gradle-plugin:${pluginVersion.dokka}",
kotlinLint: "org.jlleitschuh.gradle:ktlint-gradle:${pluginVersion.kotlinLint}"
gradle : "com.android.tools.build:gradle:${pluginVersion.gradle}",
checkstyle : "com.puppycrawl.tools:checkstyle:${pluginVersion.checkstyle}",
kotlin : "org.jetbrains.kotlin:kotlin-gradle-plugin:${pluginVersion.kotlin}",
dokka : "org.jetbrains.dokka:dokka-android-gradle-plugin:${pluginVersion.dokka}",
kotlinLint : "org.jlleitschuh.gradle:ktlint-gradle:${pluginVersion.kotlinLint}",
bintray : "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}"
]
}
124 changes: 124 additions & 0 deletions gradle/gradle-bintray.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
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 {
MapboxPluginPublication(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 = ['MapboxPluginPublication']
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('MapboxPluginPublication')
}
}
}

task androidSourcesJar(type: Jar) {
classifier "sources"
from android.sourceSets.main.java.srcDirs
}

task androidJavadocs(type: Javadoc) {
source = android.sourceSets.main.java.srcDirs
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
android.libraryVariants.all { variant ->
if (variant.name == 'release') {
owner.classpath += variant.javaCompile.classpath
}
}

}

task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) {
classifier = 'javadoc'
from androidJavadocs.destinationDir
}

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

artifacts {
archives androidSourcesJar
archives androidJavadocsJar
}

afterEvaluate { project ->
android.libraryVariants.all { variant ->
tasks.androidJavadocs.doFirst {
classpath += files(variant.javaCompile.classpath.files)
}
}
}
Loading