Throw error on missing token

This commit is contained in:
Leith Bade
2015-01-24 07:25:02 +11:00
parent 2f1192d45b
commit 3bf9efd95a

View File

@@ -4,7 +4,11 @@ task accessToken {
def rawDir = new File("app/src/main/res/raw")
rawDir.mkdirs()
def tokenFile = new File("app/src/main/res/raw/token.txt")
tokenFile.write(System.getenv('MAPBOX_ACCESS_TOKEN'))
String token = System.getenv('MAPBOX_ACCESS_TOKEN')
if (token == null) {
throw new InvalidUserDataException("You must set the MAPBOX_ACCESS_TOKEN environment variable.")
}
tokenFile.write(token)
}
gradle.projectsEvaluated {