// // Configuration file for gradle build execution. // task accessToken { def tokenFile = new File("${projectDir}/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') }