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

Commit

Permalink
[ci] Add sdk registry plugin integration. (#479)
Browse files Browse the repository at this point in the history
* [ci] Add sdk registry plugin integration.

* Update ci image.

* Test upload to staging bucket.

* Remove staging upload test.
  • Loading branch information
pengdev authored Jul 23, 2020
1 parent 40c7342 commit 8a0acf6
Show file tree
Hide file tree
Showing 12 changed files with 216 additions and 78 deletions.
13 changes: 4 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -246,15 +246,10 @@ android-ui-test: gradle/configuration.gradle
run-android-test-app-center:
appcenter test run espresso --app "Mapbox-mobile/Maps-sdk" --devices "Mapbox-mobile/${devices}" --app-path MapboxGLAndroidSDKTestApp/build/outputs/apk/debug/MapboxGLAndroidSDKTestApp-debug.apk --test-series "master" --locale "en_US" --build-dir MapboxGLAndroidSDKTestApp/build/outputs/apk/androidTest/debug --token ${APPCENTER_ACCESS_TOKEN}

# Uploads the compiled Android SDK to Bintray
.PHONY: run-android-upload-to-bintray
run-android-upload-to-bintray: gradle/configuration.gradle
$(MBGL_ANDROID_GRADLE) -Pmapbox.abis=all :MapboxGLAndroidSDK:bintrayUpload

# Uploads the compiled Android SDK SNAPSHOT to oss.jfrog.org
.PHONY: run-android-upload-to-artifactory
run-android-upload-to-artifactory: gradle/configuration.gradle
$(MBGL_ANDROID_GRADLE) -Pmapbox.abis=all :MapboxGLAndroidSDK:artifactoryPublish
# Uploads the compiled Android SDK to Mapbox SDK Registry
.PHONY: run-android-upload-to-sdk-registry
run-android-upload-to-sdk-registry: gradle/configuration.gradle
$(MBGL_ANDROID_GRADLE) -Pmapbox.abis=all :MapboxGLAndroidSDK:mapboxSDKRegistryUpload

# Dump system graphics information for the test app
.PHONY: android-gfxinfo
Expand Down
2 changes: 1 addition & 1 deletion MapboxGLAndroidSDK/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -96,5 +96,5 @@ apply from: "${projectDir}/../gradle/gradle-checkstyle.gradle"
apply from: "${projectDir}/../gradle/gradle-dependencies-graph.gradle"
apply from: "${projectDir}/../gradle/gradle-update-vendor-modules.gradle"
apply from: "${projectDir}/../gradle/android-nitpick.gradle"
apply from: "${projectDir}/../gradle/gradle-bintray.gradle"
apply from: "${projectDir}/../gradle/gradle-sdk-registry.gradle"
apply from: "${projectDir}/../gradle/jacoco-report.gradle"
4 changes: 0 additions & 4 deletions MapboxGLAndroidSDK/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,3 @@ VERSION_NAME=9.3.0-SNAPSHOT
# Only build native dependencies for the current ABI
# See https://code.google.com/p/android/issues/detail?id=221098#c20
android.buildOnlyTargetAbi=true

# Roboelectric 4.0 required config for < Android Studio v3.3.0
# http://robolectric.org/migrating/#migrating-to-40
android.enableUnitTestBinaryResources=true
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
MapboxGLAndroidSDK/9.1.0-SNAPSHOT
MapboxGLAndroidSDK/9.3.0-SNAPSHOT
v-1
16 changes: 12 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,25 @@ buildscript {
repositories {
google()
jcenter()
maven {
url 'https://api.mapbox.com/downloads/v2/releases/maven'
authentication {
basic(BasicAuthentication)
}
credentials {
username "mapbox"
password = project.hasProperty('SDK_REGISTRY_TOKEN') ? project.property('SDK_REGISTRY_TOKEN') : System.getenv('SDK_REGISTRY_TOKEN')
}
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.6.3'
classpath 'com.android.tools.build:gradle:4.0.1'
classpath dependenciesList.licensesPlugin
classpath dependenciesList.kotlinPlugin
classpath dependenciesList.bintrayPlugin
classpath dependenciesList.artifactoryPlugin
classpath dependenciesList.androidPublishPlugin
classpath dependenciesList.jacocoPlugin
classpath dependenciesList.mapboxSdkVersions
classpath dependenciesList.mapboxSdkRegistryPlugin
}
}

Expand All @@ -22,7 +31,6 @@ allprojects {
mavenCentral()
google()
jcenter()

maven {
url 'https://api.mapbox.com/downloads/v2/releases/maven'
authentication {
Expand Down
11 changes: 5 additions & 6 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ jobs:
default: "c++_static"
image:
type: string
default: android-ndk-r21b:a111a5b966
default: android-ndk-r21:769c31f1d8
firebase_device_id:
type: string
default: sailfish
Expand Down Expand Up @@ -267,7 +267,7 @@ jobs:
# ------------------------------------------------------------------------------
android-release:
docker:
- image: mbgl/android-ndk-r21b:a111a5b966
- image: mbgl/android-ndk-r21:769c31f1d8
resource_class: xlarge
working_directory: /src
environment:
Expand Down Expand Up @@ -318,11 +318,10 @@ jobs:
- store_artifacts:
path: MapboxGLAndroidSDKTestApp/build/outputs/apk/release
destination: .
- run:
name: upload debuggable objects to release tag
- deploy:
name: Publish to SDK Registry
command: |
if [[ $CIRCLE_TAG == android-v* ]]; then
export GITHUB_TOKEN=${DANGER_GITHUB_API_TOKEN}
python3 scripts/upload-to-github-release.py --file MapboxGLAndroidSDK/build/intermediates/cmake/release/debuggable-objects.tar.gz --release $CIRCLE_TAG --project mapbox-gl-native-android
make run-android-upload-to-sdk-registry
fi
- generate-api-javadoc
47 changes: 47 additions & 0 deletions cloudformation/ci.template.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
var cf = require('@mapbox/cloudfriend');

module.exports = {
AWSTemplateFormatVersion: '2010-09-09',
Resources: {
User: {
Type: 'AWS::IAM::User',
Properties: {
Policies: [
{
PolicyName: 'upload-sdk-registry',
PolicyDocument: {
Statement: [
{
Action: ['s3:ListBucket'],
Effect: 'Allow',
Resource: [
'arn:aws:s3:::mapbox-api-downloads-production',
'arn:aws:s3:::mapbox-api-downloads-staging'
]
},
{
Action: ['s3:PutObject'],
Effect: 'Allow',
Resource: [
'arn:aws:s3:::mapbox-api-downloads-production/v2/*',
'arn:aws:s3:::mapbox-api-downloads-staging/v2/*'
]
}
]
}
}
]
}
},
AccessKey: {
Type: 'AWS::IAM::AccessKey',
Properties: {
UserName: cf.ref('User')
}
}
},
Outputs: {
AccessKeyId: { Value: cf.ref('AccessKey') },
SecretAccessKey: { Value: cf.getAtt('AccessKey', 'SecretAccessKey') }
}
};
7 changes: 0 additions & 7 deletions gradle/artifact-settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,4 @@ ext {
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'
mapboxBintrayPackageName = 'com.mapbox.mapboxsdk:mapbox-android-sdk'
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')
}
10 changes: 6 additions & 4 deletions gradle/dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@ ext {
appcenter : '1.4',
ktlint : '0.34.0',
commonsIO : '2.6',
mapboxSdkVersions: '1.0.1',
mapboxSdkCore : '1.8.3'
mapboxSdkVersions: '1.1.0',
mapboxSdkCore : '1.8.3',
mapboxSdkRegistryPlugin: '0.2.1'
]

dependenciesList = [
Expand All @@ -50,6 +51,8 @@ ext {
mapboxAndroidGestures : "com.mapbox.mapboxsdk:mapbox-android-gestures:${versions.mapboxGestures}",
mapboxAndroidAccounts : "com.mapbox.mapboxsdk:mapbox-android-accounts:${versions.mapboxAccounts}",
mapboxJavaTurf : "com.mapbox.mapboxsdk:mapbox-sdk-turf:${versions.mapboxServices}",
mapboxSdkVersions : "com.mapbox.mapboxsdk:mapbox-android-sdk-versions:${versions.mapboxSdkVersions}",
mapboxSdkRegistryPlugin: "com.mapbox.gradle.plugins:sdk-registry:${versions.mapboxSdkRegistryPlugin}",

junit : "junit:junit:${versions.junit}",
mockito : "org.mockito:mockito-core:${versions.mockito}",
Expand Down Expand Up @@ -89,7 +92,6 @@ ext {
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}",
ktlint : "com.pinterest:ktlint:${versions.ktlint}",
mapboxSdkVersions : "com.mapbox.mapboxsdk:mapbox-android-sdk-versions:${versions.mapboxSdkVersions}"
ktlint : "com.pinterest:ktlint:${versions.ktlint}"
]
}
50 changes: 9 additions & 41 deletions gradle/gradle-bintray.gradle → gradle/gradle-sdk-registry.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
apply plugin: 'digital.wup.android-maven-publish'
apply plugin: 'maven-publish'
apply plugin: 'com.jfrog.bintray'
apply plugin: 'com.jfrog.artifactory'
apply plugin: 'com.mapbox.sdkRegistry'
apply from: file('../gradle/artifact-settings.gradle')

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

publishing {
publications {
MapboxMapsSdkPublication(MavenPublication) {
MapboxAndroidMapsSdk(MavenPublication) {
from components.android
groupId this.group
artifactId project.ext.mapboxArtifactId
Expand Down Expand Up @@ -44,44 +43,13 @@ publishing {
}
}

bintray {
user = mapboxBintrayUser
key = mapboxBintrayApiKey
publications('MapboxMapsSdkPublication')
pkg {
repo = project.ext.mapboxBintrayRepoName
name = project.ext.mapboxBintrayPackageName
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('MapboxMapsSdkPublication')
}
}
registry {
sdkName = "mobile-maps"
production = true
snapshot = false
override = false
dryRun = false
publications = ["MapboxAndroidMapsSdk"]
}

task androidJavadocs(type: Javadoc) {
Expand Down
Loading

0 comments on commit 8a0acf6

Please sign in to comment.