[android] #3023 - reactive token generation
[android] #3023 - update documentation to reflect change
This commit is contained in:
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user