Skip to content

Instantly share code, notes, and snippets.

@ipereziriarte
Created September 13, 2013 13:08
Show Gist options
  • Save ipereziriarte/6550455 to your computer and use it in GitHub Desktop.
Save ipereziriarte/6550455 to your computer and use it in GitHub Desktop.
This is a build gradle file for android that includes robolectric, checkstyle, sonar, findbugs and pmd.
buildscript {
dependencies {
repositories {
mavenCentral()
mavenLocal()
}
classpath 'com.android.tools.build:gradle:0.5.+'
classpath 'com.squareup.gradle:gradle-android-test-plugin:0.9.+'
}
}
apply plugin: 'android'
apply plugin: 'android-test'
apply plugin: 'sonar-runner'
apply from: 'checkstyle.gradle'
apply from: 'findbugs.gradle'
apply from: 'pmd.gradle'
dependencies {
repositories {
mavenCentral()
}
compile 'com.android.support:support-v4:18.0+'
compile 'com.android.support:appcompat-v7:18.0.+'
compile 'ch.acra:acra:4.5.0'
compile 'com.google.guava:guava:15.0.+'
compile ('de.keyboardsurfer.android.widget:crouton:1.8.1') {
exclude module: 'support-v4'
compile 'com.android.support:support-v4:18.0+'
}
compile fileTree(dir: 'libs', include: '*.jar')
testCompile 'junit:junit:4.10'
testCompile 'org.robolectric:robolectric:2.1.+'
testCompile 'com.squareup:fest-android:1.0.+'
}
android {
compileSdkVersion 18
buildToolsVersion "18.0.1"
defaultConfig {
minSdkVersion 10
targetSdkVersion 18
}
sonarRunner {
sonarProperties {
property "sonar.host.url", "http://localhost:9000"
property "sonar.jdbc.url", "jdbc:postgresql://localhost/sonar"
//property "sonar.jdbc.driverClassName", "org.h2.Driver"
property "sonar.jdbc.username", "sonar"
property "sonar.jdbc.password", "sonar"
property "sonar.branch", "gradle-robolectric"
property "sonar.dynamicAnalysis", "reuseReports"
properties["sonar.sources"] = android.sourceSets.main.java.srcDirs
properties["sonar.tests"] = android.sourceSets.instrumentTest.java.srcDirs
properties["sonar.binaries"] = file("build/classes/debug")
property "sonar.surefire.reportsPath","build/test-report/debug"
property "sonar.projectVersion", "2.5"
}
}
checkstyle {
configFile file('../config/quality/checkstyle/checkstyle.xml')
ignoreFailures true
showViolations false
xslFile null
}
findbugs {
excludeFile file('../config/quality/findbugs/findbugs-filter.xml')
ignoreFailures true
xslFile null
}
pmd {
rulesetFile file('../config/quality/pmd/pmd-ruleset.xml')
ignoreFailures true
xslFile null
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment