forked from getodk/collect
-
Notifications
You must be signed in to change notification settings - Fork 0
/
quality.gradle
116 lines (90 loc) · 2.69 KB
/
quality.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
import com.github.spotbugs.SpotBugsTask
buildscript {
repositories {
maven { url "https://plugins.gradle.org/m2/" }
}
dependencies {
classpath 'gradle.plugin.com.github.spotbugs:spotbugs-gradle-plugin:1.6.4'
}
}
def configDir = "${project.rootDir}/config"
def reportsDir = "${project.buildDir}/reports"
//------------------------Checkstyle------------------------//
apply plugin: 'checkstyle'
checkstyle.toolVersion = '8.24'
tasks.register("checkstyle", Checkstyle) {
configFile file("$configDir/checkstyle.xml")
ignoreFailures false // Fail early
showViolations true
source 'src'
include '**/*.java'
exclude '**/gen/**'
classpath = files()
}
//------------------------Spotbugs------------------------//
apply plugin: 'com.github.spotbugs'
spotbugs.toolVersion = '3.1.7'
tasks.register("spotbugs", SpotBugsTask) {
ignoreFailures false // Fail early
effort = 'max' // Search better
reportLevel = 'low' // Possible reportLevels: 'high', 'medium', 'low'
excludeFilter = new File("$configDir/findbugs-filter.xml")
classes = fileTree("build/intermediates/javac/")
source = 'src'
classpath = files()
pluginClasspath = project.configurations.spotbugsPlugins
spotbugsClasspath = buildscript.configurations.classpath
/**
* Tweak worker process max heap size
* 128m = OutOfMemory
* 256m=~31s
* 384m=~31s
* 768m=~31s
* */
setMaxHeapSize('256m')
reports {
html {
enabled = true
setDestination new File("$reportsDir/spotbugs/spotbugs.html")
stylesheet resources.text.fromFile("$configDir/xsl/plain.xsl")
}
xml {
enabled = false
setDestination new File("$reportsDir/spotbugs/spotbugs.xml")
}
}
}
//------------------------Pmd------------------------//
apply plugin: 'pmd'
pmd {
toolVersion = '6.17.0'
}
tasks.register("pmd", Pmd) {
ignoreFailures = false // Fail early
ruleSetFiles = files("$configDir/pmd-ruleset.xml")
ruleSets = []
source 'src'
include '**/*.java'
exclude '**/gen/**'
reports {
xml.enabled = false
html.enabled = true
xml {
setDestination new File("$reportsDir/pmd/pmd.xml")
}
html {
setDestination new File("$reportsDir/pmd/pmd.html")
}
}
}
//------------------------Lint------------------------//
android {
lintOptions {
abortOnError true
xmlReport true
htmlReport true
lintConfig file("$configDir/lint.xml")
htmlOutput file("$reportsDir/lint/lint-result.html")
xmlOutput file("$reportsDir/lint/lint-result.xml")
}
}