summaryrefslogtreecommitdiff
path: root/platform/android/MapboxGLAndroidSDKWearTestApp/gradle-config.gradle
blob: 27c13b935bbc1932cd43d25ce9fd43f874facaba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
//
// Configuration file for gradle build execution.
//

task accessToken {
    def tokenFile = new File("MapboxGLAndroidSDKWearTestApp/src/main/res/values/developer-config.xml")
    if (!tokenFile.exists()) {
        String tokenFileContents = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" +
                "<resources>\n" +
                "    <string name=\"mapbox_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')
}