Skip to content

Commit

Permalink
Publish to the sdk registry instead of bintray (#103)
Browse files Browse the repository at this point in the history
* Add configs to publish to SDK registry.

* Test
  • Loading branch information
yunikkk authored Aug 23, 2022
1 parent 7fbc4f9 commit 18846f3
Show file tree
Hide file tree
Showing 11 changed files with 126 additions and 201 deletions.
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ test:
release:
./gradlew :library:assembleRelease

publish-stable:
./gradlew :library:bintrayUpload
sdkRegistryUpload:
./gradlew :library:mapboxSDKRegistryUpload

publish-snapshot-to-artifactory:
./gradlew :library:artifactoryPublish
sdkRegistryPublish:
./gradlew :library:mapboxSDKRegistryPublish
26 changes: 3 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,10 @@ You'll find all of this library's documentation on [our Maps Guides user interac

If you are looking to include Mapbox Gestures for Android inside of your project, please take a look at [the detailed instructions](https://docs.mapbox.com/android/maps/guides/user-interaction/) found in our docs. If you are interested in building from source, read the contributing guide inside of this project.

To use the Gestures library, include it in your app-level `build.gradle` file.
To use the Gestures library, you need to set the SDK registry (own Mapbox Maven repo) first.
Please follow the instructions provided at the general [Maps install page](https://docs.mapbox.com/android/maps/guides/install/#add-the-dependency).

```java
// In the root build.gradle file
repositories {
mavenCentral()
}
```
Then add the Mapbox Android Gestures library :

```java
// In the app build.gradle file
Expand All @@ -37,22 +33,6 @@ dependencies {
}
```

The library is published to Maven Central and SNAPSHOTS are available whenever new code is pushed to this repo's `master` branch for testing the latest build:

```java
// In the root build.gradle file
repositories {
jcenter()
maven { url 'https://oss.jfrog.org/artifactory/oss-snapshot-local/' }
}
```
```java
// In the app build.gradle file
dependencies {
implementation 'com.mapbox.mapboxsdk:mapbox-android-gestures:0.9.0-SNAPSHOT'
}
```

#### Mapbox access tokens

To build test application you need to configure Mapbox access tokens as described at https://docs.mapbox.com/android/maps/guides/install/#configure-credentials.
Expand Down
5 changes: 1 addition & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ buildscript {
apply from: "gradle/dependencies.gradle"
repositories {
google()
jcenter()
mavenCentral()
maven {
url 'https://api.mapbox.com/downloads/v2/releases/maven'
Expand All @@ -17,10 +16,9 @@ buildscript {
}
dependencies {
classpath pluginDependencies.gradle
classpath pluginDependencies.bintrayPlugin
classpath pluginDependencies.androidPublishPlugin
classpath pluginDependencies.artifactory
classpath pluginDependencies.kotlinPlugin
classpath pluginDependencies.mapboxSdkRegistry
}
}

Expand All @@ -38,7 +36,6 @@ allprojects {
password = password = System.getenv("SDK_REGISTRY_TOKEN") ?: project.property("SDK_REGISTRY_TOKEN") as String
}
}
maven { url 'https://mapbox.bintray.com/mapbox' }
}
}

Expand Down
50 changes: 25 additions & 25 deletions circle.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: 2
version: 2.1

workflows:
version: 2
Expand All @@ -7,8 +7,11 @@ workflows:
- build
- release:
filters:
branches:
only: master
tags:
only: /v.*/
only: /^v.*/

jobs:
build:
working_directory: ~/code
Expand Down Expand Up @@ -44,43 +47,40 @@ jobs:

# ------------------------------------------------------------------------------
release:
branch:
only:
- master
docker:
- image: mbgl/android-ndk-r21e:latest
working_directory: ~/code
steps:
- checkout
- run:
name: Generate Bintray credentials
shell: /bin/bash -euo pipefail
command: |
if [ -n "${BINTRAY_USER}" ]; then
echo "BINTRAY_USER=$BINTRAY_USER
BINTRAY_API_KEY=$BINTRAY_API_KEY
GPG_PASSPHRASE=$GPG_PASSPHRASE"
fi
- init-aws
- run:
name: Update version name
command: |
if [[ $CIRCLE_TAG == v* ]]; then
sed -i -e "s/^VERSION_NAME=.*/VERSION_NAME=${CIRCLE_TAG:1}/" library/gradle.properties
fi
elif [[ $CIRCLE_BRANCH == master ]]; then
COMMIT_SHA=$(git rev-parse --short HEAD)
sed -i -e "s/-SNAPSHOT.*/-${COMMIT_SHA}-SNAPSHOT/" library/gradle.properties
fi
- run:
name: Build libraries
command: make release
- deploy:
name: Publish to Bintray
name: Publish to the SDK registry
command: |
if [[ $CIRCLE_BRANCH == master ]] || [[ $CIRCLE_TAG == v* ]]; then
version=$(cat library/gradle.properties | grep "VERSION_NAME")
if [[ $version != *"SNAPSHOT"* ]]; then
make publish-stable
else
make publish-snapshot-to-artifactory
fi
make sdkRegistryUpload
fi
- store_artifacts:
path: app/build/reports
destination: reports
if [[ $CIRCLE_TAG == v* ]]; then
make sdkRegistryPublish
fi
commands:

init-aws:
steps:
- run:
name: Init aws with 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
28 changes: 1 addition & 27 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,32 +1,6 @@
GROUP=com.mapbox.mapboxsdk

POM_URL=https://github.com/mapbox/mapbox-gestures-android
POM_SCM_URL=https://github.com/mapbox/mapbox-gestures-android
POM_SCM_CONNECTION=scm:[email protected]:mapbox/mapbox-gestures-android.git
POM_SCM_DEV_CONNECTION=scm:[email protected]:mapbox/mapbox-gestures-android.git

POM_LICENCE_NAME=BSD 2-Clause "Simplified" License
POM_LICENCE_URL=https://raw.githubusercontent.com/mapbox/mapbox-gestures-android/master/LICENSE.md
POM_LICENCE_DIST=repo

POM_DEVELOPER_ID=mapbox
POM_DEVELOPER_NAME=Mapbox

# Project-wide Gradle settings.
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx2048M
android.useAndroidX=true
android.enableJetifier=true

# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true

# Publishing
#NEXUS_USERNAME=
#NEXUS_PASSWORD=
#signing.keyId=
#signing.password=
#signing.secretKeyRingFile=
android.enableJetifier=true
9 changes: 2 additions & 7 deletions gradle/artifact-settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,5 @@ 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'
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')
}
mapboxRegistrySdkName = 'com-mapbox-mapboxsdk-mapbox-android-gestures'
}
10 changes: 4 additions & 6 deletions gradle/dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,14 @@ ext {
kotlin : '1.5.31',
appCompat : '1.3.0',
core : '1.7.0', // last version compatible with kotlin 1.5.31
annotation : '1.1.0'
annotation : '1.1.0',
]

pluginVersion = [
checkstyle : '8.4',
gradle : '7.0.4',
bintray : '1.8.5',
androidPublish: '3.6.3',
artifactory : '4.29.0'
sdkRegistry : '0.8.0',
]

dependenciesList = [
Expand Down Expand Up @@ -59,9 +58,8 @@ ext {
pluginDependencies = [
gradle : "com.android.tools.build:gradle:${pluginVersion.gradle}",
checkstyle : "com.puppycrawl.tools:checkstyle:${pluginVersion.checkstyle}",
bintrayPlugin : "com.jfrog.bintray.gradle:gradle-bintray-plugin:${pluginVersion.bintray}",
kotlinPlugin : "org.jetbrains.kotlin:kotlin-gradle-plugin:${version.kotlin}",
androidPublishPlugin: "digital.wup:android-maven-publish:${pluginVersion.androidPublish}",
artifactory : "org.jfrog.buildinfo:build-info-extractor-gradle:${pluginVersion.artifactory}",
kotlinPlugin : "org.jetbrains.kotlin:kotlin-gradle-plugin:${version.kotlin}"
mapboxSdkRegistry : "com.mapbox.gradle.plugins:sdk-registry:${pluginVersion.sdkRegistry}",
]
}
99 changes: 0 additions & 99 deletions gradle/gradle-bintray.gradle

This file was deleted.

Loading

0 comments on commit 18846f3

Please sign in to comment.