diff --git a/android/java/app/build.gradle b/android/java/app/build.gradle index 2677f9088..00c5c3f62 100644 --- a/android/java/app/build.gradle +++ b/android/java/app/build.gradle @@ -8,6 +8,7 @@ buildscript { } apply plugin: 'com.android.application' +apply plugin: 'checkstyle' task accessToken { def rawDir = new File("app/src/main/res/raw") @@ -55,6 +56,7 @@ android { lintOptions { checkAllWarnings true disable 'UnusedAttribute' + abortOnError false //disable 'IconDensities' } @@ -67,9 +69,27 @@ android { } dependencies { - compile project(':lib') + compile(project(':lib')) { + transitive = true + } compile 'com.android.support:support-annotations:21.0.0' compile 'com.android.support:support-v4:21.0.3' compile 'com.android.support:appcompat-v7:21.0.3' compile 'com.mapzen.android:lost:0.2' } + +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 +} diff --git a/android/java/checks.xml b/android/java/checks.xml new file mode 100644 index 000000000..0ee271678 --- /dev/null +++ b/android/java/checks.xml @@ -0,0 +1,185 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +