From f4de4a799cd60fb6bdfa4f17935daca87d7b56e3 Mon Sep 17 00:00:00 2001 From: Tobrun Date: Fri, 13 Nov 2015 11:17:10 +0100 Subject: [android] #3023 - reactive token generation [android] #3023 - update documentation to reflect change --- android/MapboxGLAndroidSDKTestApp/build.gradle | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'android') 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 = "\n" + + "\n" + + " " + "$System.env.MAPBOX_ACCESS_TOKEN" + "\n" + + "" + + 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" -- cgit v1.2.1