Persist Mapbox SDK Versions
About android-sdk-versions-plugin
This plugin persists Mapbox android SDK version information in a file at compile time for further access at run time. This plugin also validates the version to be compliant with https://semver.org/ . This file is persisted in assets/sdk-versions folder. The persisted file is named after applicationId(for e.g. com.mapbox.andorid.core) and the file contents are in the following format.
SDK Module Name/Version
Version Code
This plugin is inspired from https://github.com/google/play-services-plugins/tree/master/oss-licenses-plugin
All Mapbox android SDK modules that incorporate the Telemetry SDK and meant to be released as libraries(artifacts) should apply this plugin to facilitate the Telemetry SDK access all Mapbox library versions at run time.
Add the Gradle plugin
In your root-level build.gradle, make sure you are using the Maven Central Repository and add android-sdk-versions-plugin to your dependencies
dependencies {
// ...
// Add this line:
classpath 'com.mapbox.mapboxsdk:mapbox-android-sdk-versions:X.X.X'
}
Apply the Gradle plugin
In all your module (library) level build.gradle files, apply the plugin.
apply plugin: 'com.mapbox.android.sdk.versions'
or
If all modules in your project are libraries, add this in project's root build.gradle file.
subprojects { subProject ->
afterEvaluate {
subProject.apply plugin: 'com.mapbox.android.sdk.versions'
}
}
Using Snapshots
If you want to test recent bug fixes or features that have not been packaged in an official release yet, you can use a -SNAPSHOT release of the current development version, available on Sonatype.
repositories {
mavenCentral()
maven { url "http://oss.sonatype.org/content/repositories/snapshots/" }
}
dependencies {
// ...
// Add this line:
classpath 'com.mapbox.mapboxsdk:mapbox-android-sdk-versions:X.X.X-SNAPSHOT'
}
Note:
A new folder sdk_versions
with a new file will be generated inside assets folder if built locally. This is a build generated folder and can be safely added to .gitignore if not required to be seen inside the remote repository.