Skip to content

Commit

Permalink
Merge pull request google#828 from cco3/soter
Browse files Browse the repository at this point in the history
Use soter for checkstyle/pmd/findbugs check
  • Loading branch information
cco3 authored Sep 19, 2016
2 parents ca4718e + 791dd96 commit 5f47ef8
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 59 deletions.
78 changes: 20 additions & 58 deletions android/PhysicalWeb/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
plugins {
id 'checkstyle'
id 'findbugs'
id 'pmd'
}

apply plugin: 'com.android.application'
apply plugin: 'si.dlabs.soter'

android {
compileSdkVersion 24
Expand Down Expand Up @@ -80,64 +75,31 @@ dependencies {
compile 'com.android.support:appcompat-v7:24.0.0'
compile 'com.youview:tinydnssd:1.2.7'
compile 'org.nanohttpd:nanohttpd:2.3.0'
}

checkstyle {
toolVersion = "6.19"
checkstyleRules files('config/checkstyle/checkstyle.xml')
findbugsRules files('config/findbugs/exclude-filter.xml')
pmdRules files('config/pmd/pmd-ruleset.xml')
}

task checkstyle(type: Checkstyle) {
configProperties.checkstyleSuppressionsPath = new File(rootDir, "app/config/checkstyle/suppressions.xml").absolutePath
source 'src'
include '**/*.java'
exclude '**/gen/**'
classpath = files()
}

task findbugs(type: FindBugs, dependsOn: assembleDebug) {
ignoreFailures = false
effort = "max"
reportLevel = "high"
classes = files("${project.rootDir}/app/build/intermediates/classes")
excludeFilter = file("${project.rootDir}/app/config/findbugs/exclude-filter.xml")

source 'src'
include '**/*.java'
exclude '**/gen/**'

reports {
xml.enabled = false
html.enabled = true
xml {
destination "$project.buildDir/reports/findbugs/findbugs.xml"
}
html {
destination "$project.buildDir/reports/findbugs/findbugs.html"
}
soter {
checkstyle {
enabled true
toolVersion "6.19"
}

classpath = files()
}

task pmd(type: Pmd, dependsOn: assembleDebug) {
ignoreFailures = false
ruleSetFiles = files("${project.rootDir}/app/config/pmd/pmd-ruleset.xml")
ruleSets = []

source 'src'
include '**/*.java'
exclude '**/gen/**'
findbugs {
enabled true
effort = "max"
reportLevel "high"
reportType "html"
ignoreFailures false
}

reports {
xml.enabled = false
html.enabled = true
xml {
destination "$project.buildDir/reports/pmd/pmd.xml"
}
html {
destination "$project.buildDir/reports/pmd/pmd.html"
}
pmd {
enabled true
ignoreFailures false
}
}

check.dependsOn 'checkstyle', 'findbugs', 'lint', 'pmd'

check.dependsOn 'lint'
3 changes: 2 additions & 1 deletion android/PhysicalWeb/app/config/checkstyle/checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,8 @@ page at http://checkstyle.sourceforge.net/config.html -->
</module>

<module name="SuppressionFilter">
<property name="file" value="${checkstyleSuppressionsPath}"/>
<!-- Can't set ${samedir} using soter, so we have to hardcode the path -->
<property name="file" value="app/config/checkstyle/suppressions.xml"/>
</module>
</module>

4 changes: 4 additions & 0 deletions android/PhysicalWeb/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@
buildscript {
repositories {
jcenter()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
classpath 'gradle.plugin.si.dlabs.gradle:soter:1.0.8'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down

0 comments on commit 5f47ef8

Please sign in to comment.