From bd9d50130f770a5ac58a685645fbe24cc39afa76 Mon Sep 17 00:00:00 2001 From: Langston Smith Date: Thu, 14 Feb 2019 17:24:41 -0800 Subject: [PATCH] [android] initial additions for bintray plugin setup --- Makefile | 5 ++ circle.yml | 4 +- platform/android/DISTRIBUTE.md | 2 +- .../android/MapboxGLAndroidSDK/build.gradle | 5 +- .../MapboxGLAndroidSDK/gradle.properties | 5 +- platform/android/build.gradle | 3 ++ platform/android/gradle/dependencies.gradle | 22 ++++++++ platform/android/gradle/gradle-bintray.gradle | 51 +++++++++++++++++++ 8 files changed, 92 insertions(+), 5 deletions(-) create mode 100644 platform/android/gradle/gradle-bintray.gradle diff --git a/Makefile b/Makefile index 4dd599bb96a..51c9e39744d 100644 --- a/Makefile +++ b/Makefile @@ -702,6 +702,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: diff --git a/circle.yml b/circle.yml index 2356c049cfe..e50b0825a55 100644 --- a/circle.yml +++ b/circle.yml @@ -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: diff --git a/platform/android/DISTRIBUTE.md b/platform/android/DISTRIBUTE.md index 1c61748322c..8f2bec19d87 100644 --- a/platform/android/DISTRIBUTE.md +++ b/platform/android/DISTRIBUTE.md @@ -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 diff --git a/platform/android/MapboxGLAndroidSDK/build.gradle b/platform/android/MapboxGLAndroidSDK/build.gradle index 71a9a061adf..ccfde12303a 100644 --- a/platform/android/MapboxGLAndroidSDK/build.gradle +++ b/platform/android/MapboxGLAndroidSDK/build.gradle @@ -1,6 +1,8 @@ apply plugin: 'com.android.library' apply plugin: "com.jaredsburrows.license" apply plugin: 'kotlin-android' +apply plugin: 'com.jfrog.bintray' +apply plugin: 'maven-publish' dependencies { lintChecks project(":MapboxGLAndroidSDKLint") @@ -169,4 +171,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" \ No newline at end of file +apply from: "${rootDir}/gradle/android-nitpick.gradle" +apply from: "${rootDir}/gradle/gradle-bintray.gradle" \ No newline at end of file diff --git a/platform/android/MapboxGLAndroidSDK/gradle.properties b/platform/android/MapboxGLAndroidSDK/gradle.properties index fecaa2be8b0..a2c56b40bf9 100644 --- a/platform/android/MapboxGLAndroidSDK/gradle.properties +++ b/platform/android/MapboxGLAndroidSDK/gradle.properties @@ -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 diff --git a/platform/android/build.gradle b/platform/android/build.gradle index e75909c83a2..57243072dc2 100644 --- a/platform/android/build.gradle +++ b/platform/android/build.gradle @@ -9,6 +9,7 @@ buildscript { classpath 'com.android.tools.build:gradle:3.3.0' classpath dependenciesList.licensesPlugin classpath dependenciesList.kotlinPlugin + classpath dependenciesList.bintrayPlugin } } @@ -17,6 +18,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/" } } diff --git a/platform/android/gradle/dependencies.gradle b/platform/android/gradle/dependencies.gradle index 8a4215369a9..a0bc5dfc520 100644 --- a/platform/android/gradle/dependencies.gradle +++ b/platform/android/gradle/dependencies.gradle @@ -24,6 +24,7 @@ ext { okhttp : '3.12.0', kotlin : '1.3.11', licenses : '0.8.42', + bintray : '1.7.3', lint : '26.1.4', gms : '16.0.0', reLinker : '1.3.1' @@ -66,10 +67,31 @@ 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}", lint : "com.android.tools.lint:lint:${versions.lint}", lintApi : "com.android.tools.lint:lint-api:${versions.lint}", lintChecks : "com.android.tools.lint:lint-checks:${versions.lint}", lintTests : "com.android.tools.lint:lint-tests:${versions.lint}" ] + + mapboxArtifactDeveloperName = 'Mapbox' + mapboxArtifactGroup = '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' + mapboxArtifactGitUrl = 'https://github.com/mapbox/mapbox-gl-native' + mapboxLicenseName = 'The 2-Clause BSD License' + mapboxLicenseUrl = 'https://opensource.org/licenses/BSD-2-Clause' + + // Set by individual Gradle files + + versionCode = project.hasProperty('versionCode') ? project.property('versionCode') : 0 + versionName = project.hasProperty('versionName') ? project.property('versionName') : '0.0.0' + + mapboxBintrayUserOrg = 'mapbox' + mapboxBintrayRepoName = 'mapbox' + mapboxBintrayPackageName = 'mapbox-android-sdk' + mapboxArtifactTitle = 'Mapbox Maps SDK for Android' + mapboxBintrayDescription = 'Mapbox Maps SDK for Android' } diff --git a/platform/android/gradle/gradle-bintray.gradle b/platform/android/gradle/gradle-bintray.gradle new file mode 100644 index 00000000000..f834d54482e --- /dev/null +++ b/platform/android/gradle/gradle-bintray.gradle @@ -0,0 +1,51 @@ +apply plugin: 'com.jfrog.bintray' + +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'] + dryRun = false // Whether to run this as dry-run, without deploying + publish = false // Whether version should be auto published after an upload + override = false // Whether to override version artifacts already published + pkg { + userOrg = rootProject.ext.mapboxBintrayUserOrg + repo = rootProject.ext.mapboxBintrayRepoName + name = rootProject.ext.mapboxBintrayPackageName + desc = rootProject.ext.mapboxBintrayDescription + + websiteUrl = rootProject.ext.mapboxArtifactUrl + issueTrackerUrl = rootProject.ext.mapboxArtifactTrackerUrl + vcsUrl = rootProject.ext.mapboxArtifactVcsUrl + + licenses = [rootProject.ext.mapboxLicenseName] + + version { + name = rootProject.ext.versionName + desc = rootProject.ext.mapboxBintrayDescription + released = new Date() + mavenCentralSync { + sync = false + } + } + } +} + +publishing { + publications { + MapboxMapsSdkPublication(MavenPublication) { + pom.withXml { + def dependenciesNode = asNode().getAt('dependencies')[0] ?: asNode().appendNode('dependencies') + // Iterate over the compile dependencies (we don't want the test ones), adding a 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) + } + } + } + } + } +}