summaryrefslogtreecommitdiff
path: root/android
diff options
context:
space:
mode:
authorTobrun <tobrun.van.nuland@gmail.com>2015-11-13 11:17:10 +0100
committerTobrun <tobrun.van.nuland@gmail.com>2015-11-13 11:21:41 +0100
commitf4de4a799cd60fb6bdfa4f17935daca87d7b56e3 (patch)
treee618bd245b6a896fe60d06a58576270633b3657f /android
parentbcd5db4a46fcbc2fd8db315cbc4e45d3014713a1 (diff)
downloadqtlocation-mapboxgl-f4de4a799cd60fb6bdfa4f17935daca87d7b56e3.tar.gz
[android] #3023 - reactive token generation
[android] #3023 - update documentation to reflect change
Diffstat (limited to 'android')
-rw-r--r--android/MapboxGLAndroidSDKTestApp/build.gradle19
1 files changed, 19 insertions, 0 deletions
diff --git a/android/MapboxGLAndroidSDKTestApp/build.gradle b/android/MapboxGLAndroidSDKTestApp/build.gradle
index 7283d2d067..bdb4837211 100644
--- a/android/MapboxGLAndroidSDKTestApp/build.gradle
+++ b/android/MapboxGLAndroidSDKTestApp/build.gradle
@@ -15,6 +15,25 @@ apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'checkstyle'
+task accessToken {
+ def tokenFile = new File("MapboxGLAndroidSDKTestApp/src/main/res/values/developer-config.xml")
+ if (!tokenFile.exists()) {
+ String tokenFileContents = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" +
+ "<resources>\n" +
+ " <string name=\"access_token\">" + "$System.env.MAPBOX_ACCESS_TOKEN" + "</string>\n" +
+ "</resources>"
+
+ if (tokenFileContents == null) {
+ throw new InvalidUserDataException("You must set the MAPBOX_ACCESS_TOKEN environment variable.")
+ }
+ tokenFile.write(tokenFileContents)
+ }
+}
+
+gradle.projectsEvaluated {
+ preBuild.dependsOn('accessToken')
+}
+
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"