forked from LibraryOfCongress/bagit-java
-
Notifications
You must be signed in to change notification settings - Fork 0
/
code-quality.gradle
93 lines (81 loc) · 2.22 KB
/
code-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
//this build file is responsible for all the configuration of code quality items, such as code coverage, syntax style checking, static bug finding, etc.
apply plugin: "jacoco"
apply plugin: "findbugs"
apply plugin: "pmd"
sourceSets {
integrationTest {
java {
compileClasspath += main.output + test.output
runtimeClasspath += main.output + test.output
srcDir file('src/integration/java')
}
}
}
configurations {
integrationTestCompile.extendsFrom testCompile
integrationTestRuntime.extendsFrom testRuntime
}
jacoco {
toolVersion = "0.7.5.201505241946" //needed for jenkins to report code coverage correctly
}
task integrationTest(type: Test) {
description "Runs the integration tests."
testClassesDir = sourceSets.integrationTest.output.classesDir
classpath = sourceSets.integrationTest.runtimeClasspath
testLogging.showStandardStreams = true
}
jacocoTestReport.dependsOn integrationTest
jacocoTestReport.dependsOn test
check.dependsOn integrationTest
check.dependsOn jacocoTestReport
findbugsIntegrationTest.enabled = false
findbugsTest.enabled = false
findbugs {
ignoreFailures = true //don't fail the gradle build if bugs are found
}
pmdIntegrationTest.enabled = false
pmdTest.enabled = false
pmd {
ruleSets = [
"java-basic",
"java-braces",
"java-clone",
"java-codesize",
"java-design",
"java-empty",
"java-finalizers",
"java-imports",
"java-j2ee",
"java-javabeans",
"java-optimizations",
"java-strictexception",
"java-strings",
"java-sunsecure",
"java-typeresolution",
"java-unnecessary",
"java-unusedcode"
]
}
jacocoTestReport {
reports {
xml.enabled = true // coveralls plugin depends on xml format report
html.enabled = true
}
afterEvaluate {
classDirectories = files(classDirectories.files.collect {
fileTree(dir: it, exclude: ['gov.loc.repository.bagit/domain/**',
'gov.loc.repository.bagit/annotation/**',
'gov.loc.repository.bagit/exceptions/**'])
})
}
}
cpdCheck {
source = sourceSets.main.allJava
}
//Keep this for easy viewing of html findbugs report
//tasks.withType(FindBugs) {
// reports {
// xml.enabled = false
// html.enabled = true
// }
//}