forked from crate/crate
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjavaModule.gradle
More file actions
136 lines (117 loc) · 3.97 KB
/
Copy pathjavaModule.gradle
File metadata and controls
136 lines (117 loc) · 3.97 KB
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'de.thetaphi.forbiddenapis'
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'pmd'
apply plugin: 'checkstyle'
repositories {
mavenCentral()
jcenter()
maven { url "https://jitpack.io" }
}
compileJava {
options.warnings = false
options.deprecation = false
options.compilerArgs << '-XDignore.symbol.file'
options.fork = true
options.forkOptions.executable = 'javac'
finalizedBy checkstyleMain
}
javadoc {
options.addStringOption('XDignore.symbol.file', '')
}
sourceCompatibility = "8"
targetCompatibility = "8"
if (project.hasProperty('testLogging')) {
// Used to enable logging for tests
test {
testLogging.showStandardStreams = true
}
}
if (project.hasProperty('lint-unchecked')) {
compileJava.options.compilerArgs = compileJava.options.compilerArgs << '-Xlint:unchecked'
compileTestJava.options.compilerArgs = compileTestJava.options.compilerArgs << '-Xlint:unchecked'
}
if (project.hasProperty('lint-deprecation')) {
compileJava.options.compilerArgs = compileJava.options.compilerArgs << '-Xlint:deprecation'
compileTestJava.options.compilerArgs = compileTestJava.options.compilerArgs << '-Xlint:deprecation'
}
forbiddenApisMain {
bundledSignatures = ['jdk-unsafe', 'jdk-deprecated']
signaturesFiles = files("$rootDir/gradle/forbidden-signatures.txt")
suppressAnnotations = ['**.SuppressForbidden']
ignoreFailures = false
}
pmd {
consoleOutput = true
if (project.hasProperty('pmdFull')) {
ignoreFailures = true
consoleOutput = false
ruleSets = [
'java-basic',
'java-braces',
'java-clone',
'java-codesize',
'java-controversial',
'java-design',
'java-empty',
'java-finalizers',
'java-imports',
'java-logging-jakarta-commons',
'java-logging-java',
'java-naming',
'java-optimizations',
'java-strictexception',
'java-strings',
'java-sunsecure',
'java-typeresolution',
'java-unnecessary',
'java-unusedcode'
]
} else {
ignoreFailures = false
consoleOutput = true
ruleSetFiles = files("$rootDir/gradle/pmd/customrulesset.xml")
ruleSets = []
}
}
// Required if ignoreFailures = true
[pmdMain,pmdTest]*.ignoreFailures = project.pmd.ignoreFailures
tasks.withType(Pmd) {
pmdClasspath += files("$rootDir/gradle/pmd")
}
checkstyle {
toolVersion = "8.10"
def checkstyle_dir = new String("$rootDir/gradle/checkstyle/")
configProperties = [
'checkstyleDir' : checkstyle_dir,
// May be overwritten by other modules, e.g. enterprise
'licenseHeaderFile' : 'header.txt'
]
configFile = file(checkstyle_dir + "rules.xml")
checkstyleTest.enabled = false
}
test {
// by default `-D` arguments are "caught" in the gradle process
// and not passed-through to the test process.
// this enables test options like '-Dtests.iters=20'
System.properties.each { k, v ->
if (k.startsWith('tests.')) {
systemProperty k, v
}
}
jacoco {
enabled = true;
}
// ES testing framework adds the resources target build paths to the classpath of the tests,
// but if the src/[main|test]/resources directories of a project are empty, then these dirs
// are missing from the target build directory which causes all tests to fail.
// The groovy target build paths have the same problem.
// To prevent this case we always create the target build resource and groovy directories upfront.
doFirst {
file(project.buildDir.path + '/resources/main').mkdirs()
file(project.buildDir.path + '/resources/test').mkdirs()
file(project.buildDir.path + '/classes/groovy/main').mkdirs()
file(project.buildDir.path + '/classes/groovy/test').mkdirs()
}
}