summaryrefslogtreecommitdiff
path: root/platform/android/MapboxGLAndroidSDKTestApp/build.gradle
diff options
context:
space:
mode:
Diffstat (limited to 'platform/android/MapboxGLAndroidSDKTestApp/build.gradle')
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/build.gradle113
1 files changed, 113 insertions, 0 deletions
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/build.gradle b/platform/android/MapboxGLAndroidSDKTestApp/build.gradle
new file mode 100644
index 0000000000..e5db90adc6
--- /dev/null
+++ b/platform/android/MapboxGLAndroidSDKTestApp/build.gradle
@@ -0,0 +1,113 @@
+buildscript {
+ repositories {
+ maven { url 'https://maven.fabric.io/public' }
+ }
+ dependencies {
+ classpath 'io.fabric.tools:gradle:1.+'
+ }
+}
+repositories {
+ maven { url 'https://maven.fabric.io/public' }
+}
+
+apply plugin: 'android-sdk-manager'
+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"
+
+ defaultConfig {
+ applicationId "com.mapbox.mapboxsdk.testapp"
+ minSdkVersion 15
+ targetSdkVersion 23
+ versionCode 6
+ versionName "2.2.0"
+
+ // Specify AndroidJUnitRunner as the default test instrumentation runner
+ testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
+ }
+
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_7
+ targetCompatibility JavaVersion.VERSION_1_7
+ }
+
+ packagingOptions {
+ exclude 'META-INF/LICENSE.txt'
+ exclude 'META-INF/NOTICE.txt'
+ exclude 'LICENSE.txt'
+ }
+
+ lintOptions {
+ checkAllWarnings true
+ warningsAsErrors true
+ disable 'IconDensities'
+ disable 'InvalidPackage'
+ }
+
+ buildTypes {
+ release {
+ minifyEnabled true
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ }
+ }
+}
+
+dependencies {
+ compile(project(':MapboxGLAndroidSDK')) {
+ transitive = true
+ }
+ compile 'com.android.support:support-annotations:23.1.0'
+ compile 'com.android.support:support-v4:23.1.0'
+ compile 'com.android.support:appcompat-v7:23.1.0'
+ compile 'com.android.support:design:23.1.0'
+ compile('com.crashlytics.sdk.android:crashlytics:2.5.2@aar') {
+ transitive = true;
+ }
+
+ // Testing dependencies
+ testCompile 'junit:junit:4.12'
+ testCompile 'org.mockito:mockito-core:1.10.19'
+ androidTestCompile 'com.android.support:support-annotations:23.1.0'
+ androidTestCompile 'com.android.support.test:runner:0.4.1'
+ androidTestCompile 'com.android.support.test:rules:0.4.1'
+ androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.1'
+}
+
+checkstyle {
+ configFile project.file('../checks.xml')
+ showViolations true
+}
+
+android.applicationVariants.all { variant ->
+ def name = variant.buildType.name
+ def checkstyle = project.tasks.create "checkstyle${name.capitalize()}", Checkstyle
+ checkstyle.dependsOn variant.javaCompile
+ checkstyle.source variant.javaCompile.source
+ checkstyle.classpath = project.fileTree(variant.javaCompile.destinationDir)
+ checkstyle.exclude('**/BuildConfig.java')
+ checkstyle.exclude('**/R.java')
+ project.tasks.getByName("check").dependsOn checkstyle
+}