From c7d4f7d256b9a2320ea6dc76dba1605d1ed3999c Mon Sep 17 00:00:00 2001 From: Brad Leege Date: Mon, 9 Feb 2015 17:51:46 -0800 Subject: [PATCH] #826 -Adding checkstyle to TestApp build process. --- android/java/app/build.gradle | 22 +++- android/java/checks.xml | 185 ++++++++++++++++++++++++++++++++++ 2 files changed, 206 insertions(+), 1 deletion(-) create mode 100644 android/java/checks.xml 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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +