Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

[android] Adding Bintray Gradle plugin for artifact publishing #13999

Merged
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
13 changes: 4 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -702,15 +702,10 @@ apackage: platform/android/gradle/configuration.gradle
android-ui-test: platform/android/gradle/configuration.gradle
cd platform/android && $(MBGL_ANDROID_GRADLE) -Pmapbox.abis=all :MapboxGLAndroidSDKTestApp:assembleDebug :MapboxGLAndroidSDKTestApp:assembleAndroidTest

# Uploads the compiled Android SDK to Maven
.PHONY: run-android-upload-archives
run-android-upload-archives: platform/android/gradle/configuration.gradle
cd platform/android && export IS_LOCAL_DEVELOPMENT=false && $(MBGL_ANDROID_GRADLE) -Pmapbox.abis=all :MapboxGLAndroidSDK:uploadArchives

# Uploads the compiled Android SDK to ~/.m2/repository/com/mapbox/mapboxsdk
.PHONY: run-android-upload-archives-local
run-android-upload-archives-local: platform/android/gradle/configuration.gradle
cd platform/android && export IS_LOCAL_DEVELOPMENT=true && $(MBGL_ANDROID_GRADLE) -Pmapbox.abis=all :MapboxGLAndroidSDK:uploadArchives
# Uploads the compiled Android SDK to Bintray
.PHONY: run-android-upload-to-bintray
run-android-upload-to-bintray: platform/android/gradle/configuration.gradle
cd platform/android && $(MBGL_ANDROID_GRADLE) -Pmapbox.abis=all :MapboxGLAndroidSDK:bintrayUpload

# Dump system graphics information for the test app
.PHONY: android-gfxinfo
Expand Down
18 changes: 9 additions & 9 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -626,13 +626,10 @@ jobs:
- run:
name: Generate Maven credentials
command: |
if [ -n "${PUBLISH_NEXUS_USERNAME}" ]; then
aws s3 cp s3://mapbox/android/signing-credentials/secring.gpg platform/android/MapboxGLAndroidSDK/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" >> platform/android/MapboxGLAndroidSDK/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
Expand Down Expand Up @@ -669,10 +666,13 @@ jobs:
name: Record size
command: platform/android/scripts/metrics.sh
- deploy:
name: Publish to Maven
name: Publish to Bintray
command: |
if [[ $CIRCLE_BRANCH == master ]] || [[ $CIRCLE_BRANCH == release-* ]] || [[ $CIRCLE_TAG == android-v* ]]; then
make run-android-upload-archives
version=$(cat platform/android/MapboxGLAndroidSDK/gradle.properties | grep "VERSION_NAME")
if [[ $version != *"SNAPSHOT"* ]]; then
make run-android-upload-to-bintray
fi
fi
# ------------------------------------------------------------------------------
android-debug-arm-v7-buck:
Expand Down
2 changes: 1 addition & 1 deletion platform/android/DISTRIBUTE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Distributing Mapbox GL Native for Android

Depending on your use case, you may want to support all or just a subset of [Android ABIs](http://developer.android.com/ndk/guides/abis.html). This document covers building an `.aar` file from the Mapbox Android SDK and building `.so` files for specific ABIs. In normal circumstances an application developer will use [APK splits](https://developer.android.com/studio/build/configure-apk-splits.html) to optimize this at application level.
Depending on your use case, you may want to support all or just a subset of [Android ABIs](http://developer.android.com/ndk/guides/abis.html). This document covers building an `.aar` file from the Mapbox Maps SDK for Android and building `.so` files for specific ABIs. In normal circumstances an application developer will use [APK splits](https://developer.android.com/studio/build/configure-apk-splits.html) to optimize this at application level.

##### Build types

Expand Down
4 changes: 2 additions & 2 deletions platform/android/MapboxGLAndroidSDK/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,8 @@ configurations {
}

apply from: "${rootDir}/gradle/gradle-javadoc.gradle"
apply from: "${rootDir}/gradle/gradle-publish.gradle"
apply from: "${rootDir}/gradle/gradle-checkstyle.gradle"
apply from: "${rootDir}/gradle/gradle-dependencies-graph.gradle"
apply from: "${rootDir}/gradle/gradle-update-vendor-modules.gradle"
apply from: "${rootDir}/gradle/android-nitpick.gradle"
apply from: "${rootDir}/gradle/android-nitpick.gradle"
apply from: "${rootDir}/gradle/gradle-bintray.gradle"
15 changes: 0 additions & 15 deletions platform/android/MapboxGLAndroidSDK/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,20 +1,5 @@
GROUP=com.mapbox.mapboxsdk
VERSION_NAME=7.3.0-SNAPSHOT

POM_DESCRIPTION=Mapbox GL Android SDK
POM_URL=https://github.com/mapbox/mapbox-gl-native
POM_SCM_URL=https://github.com/mapbox/mapbox-gl-native
POM_SCM_CONNECTION=scm:[email protected]:mapbox/mapbox-gl-native.git
POM_SCM_DEV_CONNECTION=scm:[email protected]:mapbox/mapbox-gl-native.git
POM_LICENCE_NAME=The 2-Clause BSD License
POM_LICENCE_URL=https://opensource.org/licenses/BSD-2-Clause
POM_LICENCE_DIST=repo
POM_DEVELOPER_ID=mapbox
POM_DEVELOPER_NAME=Mapbox
POM_NAME=Mapbox Maps SDK for Android
POM_ARTIFACT_ID=mapbox-android-sdk
POM_PACKAGING=aar

# Only build native dependencies for the current ABI
# See https://code.google.com/p/android/issues/detail?id=221098#c20
android.buildOnlyTargetAbi=true
Expand Down
4 changes: 4 additions & 0 deletions platform/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ buildscript {
classpath 'com.android.tools.build:gradle:3.3.0'
classpath dependenciesList.licensesPlugin
classpath dependenciesList.kotlinPlugin
classpath dependenciesList.bintrayPlugin
classpath dependenciesList.androidPublishPlugin
}
}

Expand All @@ -17,6 +19,8 @@ allprojects {
mavenCentral()
google()
jcenter()
// For publishing Maps SDK files to Bintray
maven { url 'https://mapbox.bintray.com/mapbox' }
// Snapshot repository
//maven { url "http://oss.sonatype.org/content/repositories/snapshots/" }
}
Expand Down
20 changes: 20 additions & 0 deletions platform/android/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-sdk'
mapboxArtifactTitle = 'Mapbox Maps SDK for Android'
mapboxArtifactDescription = 'Mapbox Maps SDK for Android'
mapboxDeveloperName = 'Mapbox'
mapboxDeveloperId = 'mapbox'
mapboxArtifactUrl = 'https://github.com/mapbox/mapbox-gl-native'
mapboxArtifactVcsUrl = 'https://github.com/mapbox/mapbox-gl-native.git'
mapboxArtifactScmUrl = 'scm:[email protected]:mapbox/mapbox-gl-native.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')
}
4 changes: 4 additions & 0 deletions platform/android/gradle/dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ ext {
okhttp : '3.12.0',
kotlin : '1.3.11',
licenses : '0.8.42',
bintray : '1.8.4',
androidPublish : '3.6.2',
lint : '26.1.4',
gms : '16.0.0',
reLinker : '1.3.1'
Expand Down Expand Up @@ -66,6 +68,8 @@ ext {
kotlinLib : "org.jetbrains.kotlin:kotlin-stdlib-jdk8:${versions.kotlin}",
kotlinPlugin : "org.jetbrains.kotlin:kotlin-gradle-plugin:${versions.kotlin}",
licensesPlugin : "com.jaredsburrows:gradle-license-plugin:${versions.licenses}",
bintrayPlugin : "com.jfrog.bintray.gradle:gradle-bintray-plugin:${versions.bintray}",
androidPublishPlugin : "digital.wup:android-maven-publish:${versions.androidPublish}",

lint : "com.android.tools.lint:lint:${versions.lint}",
lintApi : "com.android.tools.lint:lint-api:${versions.lint}",
Expand Down
108 changes: 108 additions & 0 deletions platform/android/gradle/gradle-bintray.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
apply plugin: 'digital.wup.android-maven-publish'
apply plugin: 'maven-publish'
apply plugin: 'com.jfrog.bintray'
apply from: file('../gradle/artifact-settings.gradle')

version = project.ext.versionName
group = project.ext.mapboxArtifactGroupId

publishing {
publications {
MapboxMapsSdkPublication(MavenPublication) {
from components.android
groupId this.group
artifactId project.ext.mapboxArtifactId
version this.version

afterEvaluate {
artifact("$buildDir/outputs/aar/mapbox-android-sdk-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 = ['MapboxMapsSdkPublication']
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
}
}
}
}

task androidJavadocs(type: Javadoc) {
source = android.sourceSets.main.java.sourceFiles
classpath = files(android.bootClasspath)
failOnError = false
}

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

task androidSourcesJar(type: Jar) {
classifier = 'sources'
from android.sourceSets.main.java.sourceFiles
}

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