-
Notifications
You must be signed in to change notification settings - Fork 62
Expand file tree
/
Copy pathbuild.gradle
More file actions
133 lines (106 loc) · 4.04 KB
/
build.gradle
File metadata and controls
133 lines (106 loc) · 4.04 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
import com.github.spotbugs.snom.SpotBugsTask
import java.util.concurrent.TimeUnit
plugins {
// Apply the application plugin to add support for building a CLI application in Java.
id 'application'
id 'com.github.spotbugs' version '6.4.8' apply false
id 'org.owasp.dependencycheck' version '12.2.0'
id 'com.palantir.git-version' version '4.3.0'
}
// Global checkstyle file
ext.checkstyleConfigFile = new File(rootDir, "/config/checkstyle/sun_checks.xml")
subprojects {
apply plugin: "checkstyle"
apply plugin: "com.github.spotbugs"
apply plugin: "java"
apply plugin: "jacoco"
apply plugin: "org.owasp.dependencycheck"
repositories {
flatDir { dirs "lib" }
mavenCentral()
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(25)
}
}
jacoco {
toolVersion = '0.8.14'
}
tasks.withType(Test).configureEach {
useJUnitPlatform()
finalizedBy(tasks.named('jacocoTestReport'))
}
jacocoTestReport {
dependsOn test // tests are required to run before generating the report
}
checkstyle {
toolVersion = '12.3.1'
configFile = file("${rootDir}/config/checkstyle/checkstyle.xml")
}
checkstyleMain {
source = 'src/main/java'
}
checkstyleTest {
source = 'src/test/java'
}
dependencyCheck {
// Read API key from a system property 'nvd.apiKey'
nvd.apiKey = System.getProperty("nvd.apiKey")
}
// Uncomment the lines right after this comment, if you wish to see all the places
// in the application that are using deprecated features
// tasks.withType(JavaCompile).configureEach {
// options.deprecation = true
// }
tasks.withType(Javadoc).configureEach {
if (project.name == 'HIRS_AttestationCA') {
// Remove the generated files from the source set
source = source.filter { file ->
!file.path.contains('build/generated/sources/proto/main/java')
}
}
// Uncomment this line if you wish to see all the warning signs produced by the JavaDoc command
// options.addStringOption('Xmaxwarns', '0')
}
tasks.withType(Checkstyle).configureEach {
reports {
xml.required = false
html.required = true
}
}
tasks.withType(SpotBugsTask).configureEach {
excludeFilter = file('config/spotbugs/spotbugs-exclude.xml')
reports {
html.required = true
}
}
// Global dependency resolution strategy for all subprojects
configurations.configureEach {
exclude group: 'org.springframework.boot', module: 'spring-boot-starter-logging'
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
if (details.requested.group == 'org.apache.logging.log4j') {
details.useVersion '2.25.3' // Force patched Log4j version
}
if (details.requested.group == 'org.apache.commons' &&
details.requested.name == 'commons-lang3') {
details.useVersion '3.20.0' // Force patched Commons Lang version
}
if (details.requested.group == 'org.apache.httpcomponents' &&
details.requested.name == 'httpclient') {
details.useVersion '4.5.14' // Force patched Apache Http Client version
}
if (details.requested.group == 'org.assertj' &&
details.requested.name == 'assertj-core') {
details.useVersion '3.27.7' // Force patched Assert Core version
}
}
}
}
def projectVersion = rootProject.file('VERSION').text.trim()
project.ext["projVersion"] = projectVersion
def details = versionDetails()
def gitHash = details.gitHash
long buildTimeInSecs = TimeUnit.MILLISECONDS.toSeconds(new Date().getTime())
project.ext["jarVersion"] = "${projectVersion}.${buildTimeInSecs}.${gitHash}"
project.ext["packageVersion"] = "${projectVersion}.${buildTimeInSecs}.${gitHash}.el8"