-
Notifications
You must be signed in to change notification settings - Fork 69
/
build.gradle
159 lines (132 loc) · 4.89 KB
/
build.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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
import com.github.jk1.license.render.TextReportRenderer
import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask
// There is a transitive dependency which causes the bootJar task to fail.
// This fixes the issue by forcing the correct version of the dependency.
buildscript {
configurations.configureEach {
resolutionStrategy {
force "org.apache.commons:commons-compress:1.26.2"
}
}
}
plugins {
alias(libs.plugins.nlLittlerobotsVersionCatalogUpdate)
alias(libs.plugins.comGithubJk1DependencyLicenseReport)
alias(libs.plugins.orgOwaspDependencycheck) apply false
alias(libs.plugins.comGithubBenManesVersions)
}
licenseReport {
outputDir = "$projectDir/build/licenses"
renderers = [new TextReportRenderer("../../THIRD-PARTY-LICENSES.txt")]
}
allprojects {
repositories {
mavenCentral()
}
apply plugin: 'java'
apply plugin: 'jacoco'
apply plugin: 'org.owasp.dependencycheck'
if (!project.hasProperty('buildVersion') || project.getProperty('buildVersion').empty) {
ext.buildVersion = 'SNAPSHOT'
}
version = "$buildVersion"
dependencyCheck {
//failBuildOnCVSS = 6
scanProjects = [
':inspectit-ocelot-agent',
':inspectit-ocelot-core',
':inspectit-ocelot-sdk',
':inspectit-ocelot-bootstrap',
':inspectit-ocelot-configurationserver',
':inspectit-ocelot-configurationserver-ui'
]
skipConfigurations = ["jmh", "jmhCompileClasspath", "systemTest", "systemTestCompileClasspath", "systemTestRuntimeClasspath"]
analyzers {
assemblyEnabled = false
ossIndex {
enabled = true
}
nodeAudit {
yarnEnabled = false
}
}
}
}
versionCatalogUpdate {
// sort the catalog by key (default is true)
sortByKey = true
keep {
// keep versions without any library or plugin reference
keepUnusedVersions = true
// keep all libraries that aren't used in the project
keepUnusedLibraries = true
// keep all plugins that aren't used in the project
keepUnusedPlugins = true
}
versionCatalogs {
configServerLibs {
catalogFile = file("gradle/configserverlibs.versions.toml")
}
}
}
tasks.withType(DependencyUpdatesTask).configureEach {
// default settings
revision = 'milestone'
gradleReleaseChannel = "current"
checkConstraints = true
checkBuildEnvironmentConstraints = true
outputFormatter = 'json,plain'
}
def isNonStable = { String candidate ->
def stableKeyword = ['RELEASE', 'FINAL', 'GA', 'JRE'].any { it -> candidate.toUpperCase().contains(it) }
def versionRegex = /^[0-9,.v-]+(-r)?$/
return !stableKeyword && !(candidate ==~ versionRegex)
}
def isNotSameMajorMinor = { String current, String candidate, boolean matchMinor ->
if(current.equals(candidate)) return false
def firstDot = current.indexOf('.')
def secondDot = current.indexOf('.', firstDot + 1)
def major = current.substring(0, firstDot)
def minor = current.substring(firstDot + 1, secondDot)
def majorRegex = /^$major\..*/
def minorRegex = /^$major\.${minor}\..*/
return !((candidate ==~ majorRegex) && (!matchMinor || (candidate ==~ minorRegex)))
}
tasks.named("dependencyUpdates").configure {
rejectVersionIf {
// only patch updates
isNonStable(it.candidate.version) || isNotSameMajorMinor(it.currentVersion, it.candidate.version, true)
}
}
tasks.register('dependencyUpdatesMinor', DependencyUpdatesTask) {
rejectVersionIf {
// only minor updates
isNonStable(it.candidate.version) || isNotSameMajorMinor(it.currentVersion, it.candidate.version, false)
}
}
tasks.register('dependencyUpdatesMajor', DependencyUpdatesTask) {
rejectVersionIf {
// all updates including major updates
isNonStable(it.candidate.version)
}
}
tasks.register('codeCoverageReport', JacocoReport) {
group = 'Verification'
description = 'Generates a combined report from all subprojects'
executionData { fileTree(project.rootDir.absolutePath).include("**/build/jacoco/*.exec") }
dependsOn(':inspectit-ocelot-agent:systemTest')
dependsOn(':inspectit-ocelot-agent:test')
dependsOn(':inspectit-ocelot-bootstrap:test')
dependsOn(':inspectit-ocelot-config:test')
dependsOn(':inspectit-ocelot-core:test')
[project(':inspectit-ocelot-agent'), project(':inspectit-ocelot-bootstrap'), project(':inspectit-ocelot-config'), project(':inspectit-ocelot-core')].each {
sourceSets it.sourceSets.main
}
reports {
xml.required = true
xml.destination file("${buildDir}/reports/jacoco/report.xml")
html.required = true
html.destination file("${buildDir}/reports/jacoco/html")
csv.required = false
}
}