Skip to content
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
66 changes: 31 additions & 35 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
version: 2.1

executors:
ndk-r21e-latest-executor:
docker:
- image: mbgl/android-ndk-r21e:latest
working_directory: ~/code
environment:
MBX_CI_DOMAIN: o619qyc20d.execute-api.us-east-1.amazonaws.com

commands:
restore-gradle-cache:
steps:
Expand All @@ -14,6 +23,15 @@ commands:
- ~/.gradle
key: v1-dependencies-{{ checksum "build.gradle.kts" }}-{{ checksum "annotations/build.gradle.kts" }}-{{ checksum "annotations-processor/build.gradle.kts" }}-{{ checksum "common/build.gradle.kts" }}-{{ checksum "liblogger/build.gradle.kts" }}

install-mbx-ci:
steps:
- run:
name: Install mbx-ci
command: |
curl -Ls https://mapbox-release-engineering.s3.amazonaws.com/mbx-ci/latest/mbx-ci-linux-amd64 > mbx-ci
chmod 755 ./mbx-ci
./mbx-ci aws setup

run-unit-tests:
steps:
- run:
Expand Down Expand Up @@ -50,41 +68,22 @@ commands:
name: Build libraries for debug
command: make buildDebug

update-version-name:
steps:
- run:
name: Update version name
command: |
if [[ $CIRCLE_TAG == v* ]]; then
sed -i -e "s/^VERSION_NAME=.*/VERSION_NAME=${CIRCLE_TAG:1}/" gradle.properties
fi

publish:
steps:
- run:
name: Generate Bintray credentials
command: |
if [ -n "${BINTRAY_USER}" ]; then
echo "BINTRAY_USER=$BINTRAY_USER
BINTRAY_API_KEY=$BINTRAY_API_KEY
GPG_PASSPHRASE=$GPG_PASSPHRASE"
fi
- deploy:
name: Publish Base SDK artifacts to Bintray
name: Publish Base SDK artifacts to SDK Registry
command: |
if [[ $CIRCLE_BRANCH == master ]] || [[ $CIRCLE_TAG == v* ]]; then
version=$(cat gradle.properties | grep "VERSION_NAME")
if [[ $version != *"SNAPSHOT"* ]]; then
make bintrayPublish
else
make artifactoryPublish
fi
version=$(cat gradle.properties | grep "VERSION_NAME")
if [[ $CIRCLE_BRANCH == master && $version == *"SNAPSHOT"* ]]; then
make sdkRegistryPublish
elif [[ $CIRCLE_TAG == v* ]]; then
sed -i -e "s/^VERSION_NAME=.*/VERSION_NAME=${CIRCLE_TAG:1}/" gradle.properties
make sdkRegistryPublish
fi

jobs:
verify-code:
docker:
- image: mbgl/android-ndk-r21b:latest
executor: ndk-r21e-latest-executor
steps:
- checkout
- restore-gradle-cache
Expand All @@ -94,28 +93,25 @@ jobs:
- validate-dokka-docs

build-release:
docker:
- image: mbgl/android-ndk-r21b:latest
executor: ndk-r21e-latest-executor
steps:
- checkout
- restore-gradle-cache
- build-release-libraries

build-debug:
docker:
- image: mbgl/android-ndk-r21b:latest
executor: ndk-r21e-latest-executor
steps:
- checkout
- restore-gradle-cache
- build-debug-libraries

release:
docker:
- image: mbgl/android-ndk-r21b:latest
executor: ndk-r21e-latest-executor
steps:
- checkout
- restore-gradle-cache
- update-version-name
- install-mbx-ci
- build-release-libraries
- publish

Expand All @@ -135,4 +131,4 @@ workflows:
- verify-code
filters:
tags:
only: /v.*/
only: /v.*/
24 changes: 8 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,14 @@ buildRelease:
./gradlew liblogger:assembleRelease && \
./gradlew libloader:assembleRelease

.PHONY: bintrayPublish
bintrayPublish:
./gradlew :annotations:bintrayUpload ; \
./gradlew :annotations-processor:bintrayUpload ; \
./gradlew :common:bintrayUpload ; \
./gradlew :liblogger:bintrayUpload ; \
./gradlew :libloader:bintrayUpload ; \

.PHONY: artifactoryPublish
artifactoryPublish:
./gradlew :annotations:artifactoryPublish ; \
./gradlew :annotations-processor:artifactoryPublish ; \
./gradlew :common:artifactoryPublish ; \
./gradlew :liblogger:artifactoryPublish ; \
./gradlew :libloader:artifactoryPublish ; \
.PHONY: sdkRegistryPublish
sdkRegistryPublish:
./gradlew :annotations:mapboxSDKRegistryUpload ; \
./gradlew :annotations-processor:mapboxSDKRegistryUpload ; \
./gradlew :common:mapboxSDKRegistryUpload ; \
./gradlew :liblogger:mapboxSDKRegistryUpload ; \
./gradlew :libloader:mapboxSDKRegistryUpload ; \

.PHONY: runUnitTests
runUnitTests:
./gradlew test
./gradlew test
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
## Mapbox Base Android
This repository hosts annotation processors and module providers for Mapbox modular SDKs.

For documentation see [MODULARIZATION.md](https://github.com/mapbox/mapbox-base-android/blob/master/MODULARIZATION.md).
For documentation see [MODULARIZATION.md](https://github.com/mapbox/mapbox-base-android/blob/master/MODULARIZATION.md).

## Configure credentials
Before installing the SDK, you will need to gather sensitive information from your Mapbox account.
If you don't have a Mapbox account: [sign up](https://account.mapbox.com/auth/signup/) and navigate to your [Account page](https://account.mapbox.com/).
You'll need a secret access token with the `Downloads:Read` scope:
1. From your account's [tokens page](https://account.mapbox.com/access-tokens/), click the **Create a token** button.
2. From the token creation page, give your token a name and make sure the box next to the `Downloads:Read` scope is checked.
3. Click the **Create token** button at the bottom of the page to create your token.
4. The token you've created is a *secret token*, which means you will only have one opportunity to copy it somewhere secure.

You should not expose these access tokens in publicly-accessible source code where unauthorized users might find them. Instead, you should store them somewhere safe on your computer and take advantage of [Gradle properties](https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties) to make sure they're only added when your app is compiled. Once this configuration step has been completed, you will be able to reference your credentials in other parts of your app.

2 changes: 1 addition & 1 deletion annotations-processor/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ dependencies {
project.apply {
from("$rootDir/gradle/ktlint.gradle")
from("$rootDir/gradle/java-artifacts.gradle")
from("$rootDir/gradle/bintray-publish.gradle")
from("$rootDir/gradle/sdk-registry-publish.gradle")
}
3 changes: 2 additions & 1 deletion annotations-processor/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ POM_ARTIFACT_ID=annotations-processor
POM_ARTIFACT_GROUP_ID=com.mapbox.base
POM_ARTIFACT_TITLE=Mapbox Annotations Processor
POM_DESCRIPTION=Artifact that provides Mapbox module and plugin generators
BINTRAY_PROJECT_NAME=annotations-processor

REGISTRY_SDK_NAME=com-mapbox-base-annotations-processor
2 changes: 1 addition & 1 deletion annotations/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ dependencies {
project.apply {
from("$rootDir/gradle/ktlint.gradle")
from("$rootDir/gradle/java-artifacts.gradle")
from("$rootDir/gradle/bintray-publish.gradle")
from("$rootDir/gradle/sdk-registry-publish.gradle")
}
3 changes: 2 additions & 1 deletion annotations/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ POM_ARTIFACT_ID=annotations
POM_ARTIFACT_GROUP_ID=com.mapbox.base
POM_ARTIFACT_TITLE=Mapbox Annotations
POM_DESCRIPTION=Artifact that provides Mapbox module and plugin annotations
BINTRAY_PROJECT_NAME=annotations

REGISTRY_SDK_NAME=com-mapbox-base-annotations
21 changes: 18 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,37 @@ buildscript {
repositories {
google()
jcenter()

maven {
authentication {
create<BasicAuthentication>("basic")
}
url = uri("https://api.mapbox.com/downloads/v2/releases/maven")
credentials {
username = "mapbox"
password = if (project.hasProperty("SDK_REGISTRY_TOKEN")) {
project.property("SDK_REGISTRY_TOKEN") as String
} else {
System.getenv("SDK_REGISTRY_TOKEN")
} ?: throw IllegalArgumentException("SDK Registry key is not specified")
}
}
}

dependencies {
classpath(Plugins.android)
classpath(Plugins.kotlin)
classpath(Plugins.license)
classpath(Plugins.dokka)
classpath(Plugins.androidPublish)
classpath(Plugins.bintray)
classpath(Plugins.artifactory)
classpath(Plugins.sdkRegistry)
}
}

allprojects {
repositories {
google()
jcenter()

maven {
authentication {
create<BasicAuthentication>("basic")
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ plugins {
}

dependencies {
implementation("com.android.tools.build:gradle:4.0.1")
implementation("com.android.tools.build:gradle:4.1.3")
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.10")
implementation(gradleApi())
implementation(localGroovy())
Expand Down
13 changes: 3 additions & 10 deletions buildSrc/src/main/kotlin/Project.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ object Plugins {
const val kotlin = "org.jetbrains.kotlin:kotlin-gradle-plugin:${Versions.kotlin}"
const val license = "com.jaredsburrows:gradle-license-plugin:${Versions.license}"
const val dokka = "org.jetbrains.dokka:dokka-android-gradle-plugin:${Versions.dokka}"
const val bintray = "com.jfrog.bintray.gradle:gradle-bintray-plugin:${Versions.bintray}"
const val androidPublish = "digital.wup:android-maven-publish:${Versions.androidPublish}"
const val artifactory = "org.jfrog.buildinfo:build-info-extractor-gradle:${Versions.artifactory}"
const val sdkRegistry = "com.mapbox.gradle.plugins:sdk-registry:${Versions.sdkRegistry}"
}

object Dependencies {
Expand All @@ -25,16 +23,14 @@ object Dependencies {
}

private object Versions {
const val tools = "4.0.1"
const val tools = "4.1.3"
const val kotlin = "1.4.10"
const val androidX = "1.1.0"
const val license = "0.8.5"
const val kotlinPoet = "1.6.0"
const val serviceProvider = "1.0-rc7"
const val dokka = "0.9.18"
const val bintray = "1.8.4"
const val androidPublish = "3.6.2"
const val artifactory = "4.17.2"
const val sdkRegistry = "0.7.0"
const val mockk = "1.10.0"
const val junit = "1.1.2"
const val navigationBase = "1.0.0-rc.6"
Expand All @@ -49,7 +45,4 @@ object ArtifactSettings {
const val artifactScmUrl = "scm:git@github.com:mapbox/mapbox-base-android.git"
const val artifactLicenseName = "BSD"
const val artifactLicenseUrl = "https://opensource.org/licenses/BSD-2-Clause"

const val bintrayUserOrg = "mapbox"
const val bintrayRepoName = "mapbox"
}
2 changes: 1 addition & 1 deletion common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@ project.apply {
from("$rootDir/gradle/ktlint.gradle")
from("$rootDir/gradle/lint.gradle")
from("$rootDir/gradle/android-artifacts.gradle")
from("$rootDir/gradle/bintray-publish.gradle")
from("$rootDir/gradle/sdk-registry-publish.gradle")
}
5 changes: 3 additions & 2 deletions common/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ POM_ARTIFACT_ID=common
POM_ARTIFACT_GROUP_ID=com.mapbox.base
POM_ARTIFACT_TITLE=Mapbox Common
POM_DESCRIPTION=Artifact that provides Mapbox module and plugin contracts
BINTRAY_PROJECT_NAME=common

android.useAndroidX = true
REGISTRY_SDK_NAME=com-mapbox-base-common

android.useAndroidX = true
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VERSION_NAME=0.5.0-SNAPSHOT
VERSION_NAME=0.6.0-SNAPSHOT
11 changes: 4 additions & 7 deletions gradle/artifact-settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,16 @@ ext {
mapboxArtifactDescription = project.property('POM_DESCRIPTION')
mapboxDeveloperName = 'Mapbox'
mapboxDeveloperId = 'mapbox'

mapboxArtifactUrl = 'https://github.com/mapbox/mapbox-base-android'
mapboxArtifactVcsUrl = 'https://github.com/mapbox/mapbox-base-android.git'
mapboxArtifactScmUrl = 'scm:git@github.com:mapbox/mapbox-base-android.git'
mapboxArtifactLicenseName = 'BSD'
mapboxArtifactLicenseUrl = 'https://opensource.org/licenses/BSD-2-Clause'

versionName = project.property('VERSION_NAME')

mapboxBintrayUserOrg = 'mapbox'
mapboxBintrayRepoName = 'mapbox'
mapboxBintrayProjectName = project.property('BINTRAY_PROJECT_NAME')
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')
registrySdkName = project.property('REGISTRY_SDK_NAME')

isAndroidProject = project.property('IS_ANDROID_PROJECT')
}
}
Loading