forked from daolq3012/Structure_Android
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathcheckci.gradle
104 lines (90 loc) · 2.47 KB
/
checkci.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
/*
* for ci
*/
apply plugin: 'checkstyle'
apply plugin: 'findbugs'
apply plugin: 'pmd'
check.dependsOn 'checkstyle', 'findbugs', 'pmd', 'cpd'
dependencies {
checkstyle 'com.puppycrawl.tools:checkstyle:7.6'
}
task checkstyle(type: Checkstyle) {
def conf
if (project.hasProperty('checkStyleConfigFile')) {
conf = file(checkStyleConfigFile)
} else {
conf = file("${project.rootDir}/config/checkstyle/android-style.xml")
}
configFile conf
configProperties.checkstyleSuppressionsPath = file("${project.rootDir}/config/checkstyle/suppressions.xml")
source 'src'
include '**/*.java'
exclude '**/gen/**'
exclude '**/R.java'
exclude '**/BuildConfig.java'
classpath = files()
ignoreFailures = true
}
task findbugs(type: FindBugs, dependsOn: "assembleDebug") {
ignoreFailures = true
effort = "max"
reportLevel = "high"
def conf
if (project.hasProperty('findBugsExcludeFilter')) {
conf = file(findBugsExcludeFilter)
} else {
conf = file("${project.rootDir}/config/findbugs/exclude.xml")
}
excludeFilter = conf
classes = files("$project.buildDir/intermediates/classes/")
source 'src'
include '**/*.java'
exclude '**/gen/**'
reports {
xml.enabled = true
html.enabled = false
xml {
destination "$project.buildDir/reports/findbugs/findbugs.xml"
xml.withMessages true
}
}
classpath = files()
}
task pmd(type: Pmd) {
ignoreFailures = true
def conf
if (project.hasProperty('pmdRuleSetFiles')) {
conf = file(pmdRuleSetFiles)
} else {
conf = files("${project.rootDir}/config/pmd/ruleset.xml")
}
ruleSetFiles = conf
ruleSets = []
source 'src'
include '**/*.java'
exclude '**/gen/**'
reports {
xml.enabled = true
html.enabled = true
xml {
destination "$project.buildDir/reports/pmd/pmd.xml"
}
html {
destination "$project.buildDir/reports/pmd/pmd.html"
}
}
}
task cpd doLast {
File outDir = new File("$project.buildDir/reports/pmd/")
outDir.mkdirs()
ant.taskdef(name: 'cpd',
classname: 'net.sourceforge.pmd.cpd.CPDTask',
classpath: configurations.pmd.asPath)
ant.cpd(minimumTokenCount: '100',
format: 'xml',
outputFile: new File(outDir , 'cpd.xml')) {
fileset(dir: "src/main/java") {
include(name: '**/*.java')
}
}
}