[android] initial additions for bintray plugin setup

This commit is contained in:
Langston Smith
2019-02-14 17:24:41 -08:00
committed by Łukasz Paczos
parent fa4fa5d9fe
commit 13a6f4c3db
9 changed files with 172 additions and 5 deletions

View File

@@ -712,6 +712,11 @@ run-android-upload-archives: platform/android/gradle/configuration.gradle
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
android-gfxinfo:

View File

@@ -669,10 +669,10 @@ 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
make run-android-upload-to-bintray
fi
# ------------------------------------------------------------------------------
android-debug-arm-v7-buck:

View File

@@ -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

View File

@@ -1,6 +1,9 @@
apply plugin: 'com.android.library'
apply plugin: "com.jaredsburrows.license"
apply plugin: 'kotlin-android'
apply plugin: 'com.jfrog.bintray'
apply plugin: 'maven-publish'
apply plugin: 'com.github.dcendents.android-maven'
dependencies {
lintChecks project(":MapboxGLAndroidSDKLint")
@@ -169,4 +172,5 @@ 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"

View File

@@ -1,19 +1,22 @@
GROUP=com.mapbox.mapboxsdk
VERSION_NAME=7.3.0-SNAPSHOT
POM_DESCRIPTION=Mapbox GL Android SDK
POM_DESCRIPTION=Mapbox Maps SDK for Android
POM_URL=https://github.com/mapbox/mapbox-gl-native
POM_SCM_URL=https://github.com/mapbox/mapbox-gl-native
POM_SCM_CONNECTION=scm:git@github.com:mapbox/mapbox-gl-native.git
POM_SCM_DEV_CONNECTION=scm:git@github.com:mapbox/mapbox-gl-native.git
POM_VCS_URL=https://github.com/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_DEVELOPER_GROUP_ID=com.mapbox.mapboxsdk
POM_NAME=Mapbox Maps SDK for Android
POM_ARTIFACT_ID=mapbox-android-sdk
POM_PACKAGING=aar
TRACKER_URL=https://github.com/mapbox/mapbox-gl-native/issues
# Only build native dependencies for the current ABI
# See https://code.google.com/p/android/issues/detail?id=221098#c20

View File

@@ -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.mavenPlugin
}
}
@@ -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/" }
}

View File

@@ -0,0 +1,22 @@
ext {
mapboxArtifactDeveloperName = 'Mapbox'
mapboxArtifactGroupId = 'com.mapbox.mapboxsdk'
mapboxArtifactUrl = 'https://github.com/mapbox/mapbox-gl-native'
mapboxArtifactVcsUrl = 'https://github.com/mapbox/mapbox-gl-native.git'
mapboxArtifactTrackerUrl = 'https://github.com/mapbox/mapbox-gl-native/issues'
mapboxArtifactScmUrl = 'scm:git@github.com:mapbox/mapbox-gl-native.git'
mapboxArtifactGitUrl = 'https://github.com/mapbox/mapbox-gl-native'
mapboxLicenseName = 'BSD'
mapboxLicenseUrl = 'https://opensource.org/licenses/BSD-2-Clause'
mapboxArtifactInceptionYear = '2014'
versionName = project.hasProperty('versionName') ? project.property('versionName') : System.getenv('VERSION_NAME')
mapboxBintrayUserOrg = 'mapbox'
mapboxBintrayRepoName = 'mapbox'
// mapboxBintrayArtifactId is the same as mapboxArtifactGroup because of a weird bug
// https://github.com/bintray/gradle-bintray-plugin/issues/88
mapboxArtifactId = 'mapbox-android-sdk'
mapboxArtifactTitle = 'Mapbox Maps SDK for Android'
mapboxArtifactDescription = 'Mapbox Maps SDK for Android'
}

View File

@@ -24,6 +24,8 @@ ext {
okhttp : '3.12.0',
kotlin : '1.3.11',
licenses : '0.8.42',
bintray : '1.8.4',
maven : '2.1',
lint : '26.1.4',
gms : '16.0.0',
reLinker : '1.3.1'
@@ -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}",
mavenPlugin : "com.github.dcendents:android-maven-gradle-plugin:${versions.maven}",
lint : "com.android.tools.lint:lint:${versions.lint}",
lintApi : "com.android.tools.lint:lint-api:${versions.lint}",

View File

@@ -0,0 +1,125 @@
apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'maven-publish'
apply from: file('../gradle/artifact-settings.gradle')
group = project.ext.mapboxArtifactGroupId
project.archivesBaseName = project.ext.mapboxArtifactId
install {
repositories.mavenInstaller {
pom.project {
// Make sure that artifactId and name are the same String values!
// https://github.com/bintray/gradle-bintray-plugin/issues/81#issuecomment-149632738
name project.ext.mapboxArtifactId
println 'name = ' + name
description project.ext.mapboxArtifactDescription
println 'description = ' + description
url project.ext.mapboxArtifactGitUrl
inceptionYear project.ext.mapboxArtifactInceptionYear
packaging 'aar'
groupId project.ext.mapboxArtifactGroupId
artifactId project.ext.mapboxArtifactId
version project.ext.versionName
println 'version = ' + version
scm {
connection project.ext.mapboxArtifactVcsUrl
url project.ext.mapboxArtifactScmUrl
}
developers {
developer {
name project.ext.mapboxArtifactDeveloperName
}
}
licenses {
license {
name project.ext.mapboxLicenseName
url project.ext.mapboxLicenseUrl
distribution 'repo'
}
}
}
}
}
publishing {
publications {
MapboxMapsSdkPublication(MavenPublication) {
artifact("$buildDir/outputs/aar/mapbox-android-sdk-release.aar")
// TODO: Uncomment these and use exisiting Gradle tasks in `gradle-publish.gradle` ?
// TODO: https://github.com/search?q=%22artifact%28sourcesJar%29+++++++++++++artifact%28javadocJar%29%22&type=Code
/*artifact(sourcesJar)
artifact(javadocJar)
*/
// For some reason, uncommented the following 3 declarations throws an error:
/*
groupId 'com.mapbox.mapboxsdk'
artifactId = 'mapbox-android-sdk'
version project.ext.versionName
*/
pom.withXml {
def dependenciesNode = asNode().getAt('dependencies')[0] ?: asNode().appendNode('dependencies')
// Iterate over the implementation dependencies (we don't want the test ones), adding a <dependency> node for each
configurations.implementation.allDependencies.each {
// Ensure dependencies such as fileTree are not included.
if (it.name != 'unspecified') {
def dependencyNode = dependenciesNode.appendNode('dependency')
dependencyNode.appendNode('groupId', it.group)
dependencyNode.appendNode('artifactId', it.name)
dependencyNode.appendNode('version', it.version)
}
}
}
}
}
}
bintray {
user = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER')
key = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_KEY')
publications = ['MapboxMapsSdkPublication']
pkg {
repo = project.ext.mapboxBintrayRepoName
println 'pkg repo = ' + repo
name = project.ext.mapboxArtifactId
println 'pkg name = ' + name
userOrg = project.ext.mapboxBintrayUserOrg
println 'pkg userOrg = ' + userOrg
licenses = [project.ext.mapboxLicenseName]
vcsUrl = project.ext.mapboxArtifactVcsUrl
version {
name = project.ext.versionName
desc = 'Mapbox Maps SDK for Android'
released = new Date()
println 'version released = ' + released
gpg {
sign = true
passphrase = project.hasProperty('gpgPassphrase') ? project.property('gpgPassphrase') : System.getenv('GPG_PASSPHRASE')
}
mavenCentralSync {
sync = false
}
}
}
}