diff options
author | Langston Smith <langston.smith@mapbox.com> | 2019-02-14 17:24:41 -0800 |
---|---|---|
committer | Łukasz Paczos <lukasz.paczos@mapbox.com> | 2019-03-07 18:46:51 +0100 |
commit | 13a6f4c3dbd9f734dae0f0e3941748d912add449 (patch) | |
tree | 3d4e4fcb6bc4a5dcbd53deabed48b4f0aaf341a1 /platform | |
parent | fa4fa5d9fe41874d463ba8df29db61ba4bc1b89e (diff) | |
download | qtlocation-mapboxgl-13a6f4c3dbd9f734dae0f0e3941748d912add449.tar.gz |
[android] initial additions for bintray plugin setup
Diffstat (limited to 'platform')
-rw-r--r-- | platform/android/DISTRIBUTE.md | 2 | ||||
-rw-r--r-- | platform/android/MapboxGLAndroidSDK/build.gradle | 6 | ||||
-rw-r--r-- | platform/android/MapboxGLAndroidSDK/gradle.properties | 5 | ||||
-rw-r--r-- | platform/android/build.gradle | 4 | ||||
-rw-r--r-- | platform/android/gradle/artifact-settings.gradle | 22 | ||||
-rw-r--r-- | platform/android/gradle/dependencies.gradle | 4 | ||||
-rw-r--r-- | platform/android/gradle/gradle-bintray.gradle | 125 |
7 files changed, 165 insertions, 3 deletions
diff --git a/platform/android/DISTRIBUTE.md b/platform/android/DISTRIBUTE.md index 1c61748322..8f2bec19d8 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 71a9a061ad..110028b67f 100644 --- a/platform/android/MapboxGLAndroidSDK/build.gradle +++ b/platform/android/MapboxGLAndroidSDK/build.gradle @@ -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"
\ 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 fecaa2be8b..a2c56b40bf 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 e75909c83a..759b7883f9 100644 --- a/platform/android/build.gradle +++ b/platform/android/build.gradle @@ -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/" } } diff --git a/platform/android/gradle/artifact-settings.gradle b/platform/android/gradle/artifact-settings.gradle new file mode 100644 index 0000000000..c9f3753cec --- /dev/null +++ b/platform/android/gradle/artifact-settings.gradle @@ -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' +} diff --git a/platform/android/gradle/dependencies.gradle b/platform/android/gradle/dependencies.gradle index 8a4215369a..5def4470ca 100644 --- a/platform/android/gradle/dependencies.gradle +++ b/platform/android/gradle/dependencies.gradle @@ -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}", diff --git a/platform/android/gradle/gradle-bintray.gradle b/platform/android/gradle/gradle-bintray.gradle new file mode 100644 index 0000000000..7e14a4c1ef --- /dev/null +++ b/platform/android/gradle/gradle-bintray.gradle @@ -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 + } + } + } +} + + |