forked from opensearch-project/data-prepper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
328 lines (306 loc) · 10 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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/
import com.github.jk1.license.render.TextReportRenderer
buildscript {
repositories {
mavenCentral() {
metadataSources {
mavenPom()
ignoreGradleMetadataRedirection()
}
}
maven {
url 'https://plugins.gradle.org/m2/'
metadataSources {
mavenPom()
ignoreGradleMetadataRedirection()
}
}
}
dependencies {
classpath 'com.github.jk1:gradle-license-report:2.1'
}
}
plugins {
id 'com.diffplug.spotless' version '6.11.0'
id 'io.spring.dependency-management' version '1.1.0'
}
apply from: file("${rootDir}/build-resources.gradle")
allprojects {
apply plugin: 'checkstyle'
apply plugin: 'com.diffplug.spotless'
apply plugin: 'com.github.jk1.dependency-license-report'
group = 'org.opensearch.dataprepper'
ext {
mavenPublicationRootFile = file("${rootProject.buildDir}/m2")
}
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
maven {
url 'https://packages.confluent.io/maven/'
}
}
spotless {
format 'markdown', {
target '*.md'
// TODO: enrich format rules
endWithNewline()
}
format 'misc', {
target '.gitignore', '*.yml', '*.yaml'
// TODO: enrich format rules
trimTrailingWhitespace()
endWithNewline()
}
}
checkstyle {
toolVersion = '10.12.3'
}
}
subprojects {
apply plugin: 'java'
apply plugin: 'maven-publish'
apply plugin: 'jacoco'
java {
toolchain {
languageVersion = JavaLanguageVersion.of(11)
}
}
spotless {
java {
targetExclude 'build/generated-src/antlr/**'
// TODO: enrich format rules
removeUnusedImports()
}
}
dependencies {
implementation platform('com.fasterxml.jackson:jackson-bom:2.15.0')
implementation platform('org.eclipse.jetty:jetty-bom:11.0.17')
implementation platform('io.micrometer:micrometer-bom:1.10.5')
implementation libs.guava.core
implementation libs.slf4j.api
testImplementation testLibs.bundles.junit
testImplementation testLibs.bundles.mockito
testImplementation testLibs.hamcrest
testImplementation testLibs.awaitility
constraints {
implementation('org.apache.httpcomponents:httpclient') {
version {
require '4.5.14'
}
because 'We want the newest version of httpclient.'
}
implementation('org.apache.logging.log4j:log4j-core') {
version {
require '2.17.1'
}
because 'Log4j 2.17.1 fixes CVE-2021-44228, CVE-2021-45046, CVE-2021-45105, and CVE-2021-44832'
}
implementation('org.apache.logging.log4j:log4j-api') {
version {
require '2.17.1'
}
because 'the build fails if the Log4j API is not update along with log4j-core'
}
implementation('com.google.code.gson:gson') {
version {
require '2.8.9'
}
because 'Fixes WS-2021-0419 DoS vulnerability'
}
implementation('com.google.protobuf:protobuf-java') {
version {
require '3.21.11'
}
because 'Fixes CVE-2022-3509, CVE-2022-3510'
}
implementation('org.yaml:snakeyaml') {
version {
require '2.0'
}
because 'Fixes CVE-2022-1471'
}
implementation('org.codehaus.jettison:jettison') {
version {
require '1.5.4'
}
because 'CVE from transitive dependecies'
}
implementation('net.minidev:json-smart') {
version {
require '2.5.0'
}
because 'CVE from transitive dependencies'
}
implementation('org.jetbrains.kotlin:kotlin-stdlib') {
version {
require '1.8.21'
}
because 'CVE from transitive dependencies'
}
implementation('org.eclipse.jetty:http2-common') {
version {
require '11.0.17'
}
because 'Fixes CVE-2023-44487'
}
implementation('org.eclipse.jetty:http2-server') {
version {
require '11.0.17'
}
because 'Fixes CVE-2023-44487'
}
implementation('org.xerial.snappy:snappy-java') {
version {
require '1.1.10.5'
}
because 'Fixes CVE-2023-43642'
}
implementation('com.squareup.okio:okio-jvm') {
version {
require '3.5.0'
}
because 'CVE from transitive dependencies'
}
implementation('com.charleskorn.kaml:kaml') {
version {
require '0.55.0'
}
because 'CVE from transitive dependencies'
}
implementation('org.bitbucket.b_c:jose4j') {
version {
require '0.9.3'
}
because 'CVE from transitive dependencies'
}
implementation('org.scala-lang:scala-library') {
version {
require '2.13.12'
}
because 'CVE from transitive dependencies'
}
implementation('org.json:json') {
version {
require '20230618'
}
because 'CVE from transitive dependencies'
}
}
}
configurations.all {
resolutionStrategy.eachDependency { def details ->
if (details.requested.group == 'io.netty') {
if (details.requested.name == 'netty') {
details.useTarget group: 'io.netty', name: 'netty-all', version: '4.1.100.Final'
details.because 'Fixes CVE-2022-41881, CVE-2021-21290 and CVE-2022-41915.'
} else if (!details.requested.name.startsWith('netty-tcnative')) {
details.useVersion '4.1.100.Final'
details.because 'Fixes CVE-2022-41881, CVE-2021-21290 and CVE-2022-41915.'
}
} else if (details.requested.group == 'log4j' && details.requested.name == 'log4j') {
details.useTarget group: 'org.apache.logging.log4j', name: 'log4j-1.2-api', version: '2.17.1'
}
}
}
test {
useJUnitPlatform()
}
build.dependsOn test
jacocoTestReport {
dependsOn test // tests are required to run before generating the report
reports {
xml.required
}
}
task allDeps(type: DependencyReportTask) {}
}
configure(subprojects.findAll {it.name != 'data-prepper-api'}) {
dependencies {
implementation platform('software.amazon.awssdk:bom:2.20.67')
implementation 'jakarta.validation:jakarta.validation-api:3.0.2'
}
}
configure(mavenArtifactProjects) {
java {
withJavadocJar()
withSourcesJar()
}
publishing {
repositories {
maven {
url "file://${mavenPublicationRootFile.absolutePath}"
}
}
publications {
maven(MavenPublication) {
from components.java
pom {
name = project.name
description = "Data Prepper project: ${project.name}"
url = 'https://github.com/opensearch-project/data-prepper'
licenses {
license {
name = 'The Apache Software License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution = 'repo'
}
}
developers {
developer {
name = 'OpenSearch'
url = 'https://github.com/opensearch-project'
}
}
scm {
url = 'https://github.com/opensearch-project/data-prepper'
}
}
}
}
}
}
configure(coreProjects) {
jacocoTestReport {
dependsOn test // tests are required to run before generating the report
reports {
xml.required
csv.required
html.destination file("${buildDir}/reports/jacocoHtml")
}
}
test {
finalizedBy jacocoTestReport // report is always generated after tests run
}
jacocoTestCoverageVerification {
dependsOn jacocoTestReport
violationRules {
rule {
limit {
minimum = 0.65 //TODO increase this to 0.75
}
}
}
}
check.dependsOn jacocoTestCoverageVerification
}
task generateAggregateTestReport(type: TestReport) {
destinationDirectory = file("${layout.buildDirectory}/reports/tests")
reportOn subprojects*.test
}
licenseReport {
excludeOwnGroup = true
excludeBoms = true
excludes = ['software.amazon.awssdk:bom']
renderers = new TextReportRenderer()
}
task generateThirdPartyReport(type: Copy) {
from 'build/reports/dependency-license/'
into '.'
include 'THIRD-PARTY-NOTICES.txt'
rename 'THIRD-PARTY-NOTICES.txt', 'THIRD-PARTY'
generateThirdPartyReport.dependsOn(generateLicenseReport)
}