apply plugin: 'com.android.library' apply plugin: 'robolectric' apply plugin: 'maven' apply plugin: 'findbugs' apply plugin: 'pmd' apply plugin: 'jacoco' apply plugin: 'com.github.kt3k.coveralls' findbugs { toolVersion = "2.0.3" } jacoco { toolVersion = "0.7.1.201405082137" } coveralls { jacocoReportPath = 'build/reports/jacoco/jacocoTestReport/jacocoTestReport.xml' } dependencies { compile project(':third_party:gif_decoder') compile project(':third_party:gif_encoder') compile project(':third_party:disklrucache') compile "com.android.support:support-v4:${SUPPORT_V4_VERSION}" androidTestCompile project(':testutil') androidTestCompile 'com.google.guava:guava-testlib:18.0' androidTestCompile "com.android.support:support-v4:${SUPPORT_V4_VERSION}" androidTestCompile "com.google.truth:truth:${TRUTH_VERSION}" androidTestCompile "junit:junit:${JUNIT_VERSION}" androidTestCompile "org.mockito:mockito-all:${MOCKITO_VERSION}" androidTestCompile "org.robolectric:robolectric:${ROBOLECTRIC_VERSION}" // TODO: increase this to 2.0.+ when we compile against Java 7. androidTestCompile "com.squareup.okhttp:mockwebserver:${MOCKWEBSERVER_VERSION}" } android { compileSdkVersion COMPILE_SDK_VERSION as int buildToolsVersion BUILD_TOOLS_VERSION as String defaultConfig { minSdkVersion MIN_SDK_VERSION as int targetSdkVersion TARGET_SDK_VERSION as int versionCode VERSION_CODE as int versionName VERSION_NAME as String } buildTypes { debug { testCoverageEnabled = true } } } afterEvaluate { task findbugs(type: FindBugs, dependsOn: assembleDebug) { description 'Run findbugs' group 'verification' classes = fileTree('build/intermediates/classes/debug/') source = fileTree('src/main/java') classpath = files(project.configurations.compile.asPath) effort = 'max' excludeFilter = file("findbugs-exclude.xml") reports { xml.enabled = false html.enabled = true } } findbugsTestDebug { enabled = false } check.dependsOn('findbugs') task pmd(type: Pmd) { description 'Run pmd' group 'verification' // If ruleSets is not empty, it seems to contain some // defaults which override rules in the ruleset file... ruleSets = [] ruleSetFiles = files('pmd-ruleset.xml') source = fileTree('src/main/java') reports { xml.enabled = false html.enabled = true } } pmdTestDebug { enabled = false } check.dependsOn('pmd') task jacocoTestReport(type:JacocoReport, dependsOn: testDebug) { def coverageSourceDirs = ['src/main/java'] group = "Reporting" description = "Generate Jacoco coverage reports" classDirectories = fileTree( dir: 'build/intermediates/classes/debug', excludes: ['**/R.class', '**/R$*.class', '**/BuildConfig.*', '**/Manifest*.*', '**/BitmapRequestBuilder.class', '**/DrawableRequestBuilder.class', '**/GifRequestBuilder.class', ] ) additionalSourceDirs = files(coverageSourceDirs) sourceDirectories = files(coverageSourceDirs) executionData = files('build/jacoco/testDebug.exec') reports { xml.enabled = true html.enabled = true } } }