138 lines
3.8 KiB
Groovy
138 lines
3.8 KiB
Groovy
buildscript {
|
|
repositories {
|
|
mavenCentral()
|
|
maven { url 'https://maven.fabric.io/public' }
|
|
}
|
|
dependencies {
|
|
classpath 'com.android.tools.build:gradle:1.3.0'
|
|
classpath 'com.jakewharton.sdkmanager:gradle-plugin:0.12.0'
|
|
classpath 'io.fabric.tools:gradle:1.+'
|
|
}
|
|
}
|
|
|
|
apply plugin: 'android-sdk-manager'
|
|
apply plugin: 'com.android.application'
|
|
apply plugin: 'io.fabric'
|
|
|
|
repositories {
|
|
maven { url 'https://maven.fabric.io/public' }
|
|
}
|
|
|
|
apply plugin: 'checkstyle'
|
|
|
|
task accessToken {
|
|
def rawDir = new File("MapboxGLAndroidSDKTestApp/src/main/res/raw")
|
|
rawDir.mkdirs()
|
|
def tokenFile = new File("MapboxGLAndroidSDKTestApp/src/main/res/raw/token.txt")
|
|
if (!tokenFile.exists()) {
|
|
String token = "$System.env.MAPBOX_ACCESS_TOKEN"
|
|
if (token == null) {
|
|
throw new InvalidUserDataException("You must set the MAPBOX_ACCESS_TOKEN environment variable.")
|
|
}
|
|
tokenFile.write(token)
|
|
}
|
|
}
|
|
|
|
gradle.projectsEvaluated {
|
|
preBuild.dependsOn('accessToken')
|
|
}
|
|
|
|
android {
|
|
compileSdkVersion 23
|
|
buildToolsVersion "23.0.1"
|
|
|
|
repositories {
|
|
mavenCentral()
|
|
}
|
|
|
|
defaultConfig {
|
|
applicationId "com.mapbox.mapboxgl.testapp"
|
|
minSdkVersion 15
|
|
targetSdkVersion 23
|
|
versionCode 4
|
|
versionName "0.1.3"
|
|
|
|
// 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 false
|
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
}
|
|
}
|
|
|
|
splits {
|
|
abi {
|
|
enable true
|
|
reset()
|
|
include 'armeabi', 'armeabi-v7a', 'x86', 'mips'
|
|
universalApk true
|
|
}
|
|
}
|
|
}
|
|
|
|
crashlytics {
|
|
enableNdk true
|
|
androidNdkOut '../MapboxGLAndroidSDK/src/main/obj.target'
|
|
androidNdkLibsOut '../MapboxGLAndroidSDK/src/main/obj.target'
|
|
}
|
|
|
|
dependencies {
|
|
compile(project(':MapboxGLAndroidSDK')) {
|
|
transitive = true
|
|
}
|
|
compile 'com.android.support:support-annotations:23.0.1'
|
|
compile 'com.android.support:support-v4:23.0.1'
|
|
compile 'com.android.support:appcompat-v7:23.0.1'
|
|
compile 'com.android.support:design:23.0.1'
|
|
compile('com.crashlytics.sdk.android:crashlytics:2.5.1@aar') {
|
|
transitive = true;
|
|
}
|
|
compile('com.crashlytics.sdk.android:crashlytics-ndk:1.1.1@aar') {
|
|
transitive = true;
|
|
}
|
|
|
|
// Testing dependencies
|
|
testCompile 'junit:junit:4.12'
|
|
testCompile 'org.mockito:mockito-core:1.+'
|
|
androidTestCompile 'com.android.support.test:runner:0.4'
|
|
androidTestCompile 'com.android.support.test:rules:0.4'
|
|
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
|
|
}
|