forked from opensearch-project/data-prepper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
240 lines (221 loc) · 7.19 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
/*
* 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.0.11.RELEASE'
}
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' }
}
spotless {
format 'markdown', {
target '*.md'
// TODO: enrich format rules
endWithNewline()
}
format 'misc', {
target '.gitignore', '*.yml', '*.yaml'
// TODO: enrich format rules
trimTrailingWhitespace()
endWithNewline()
}
}
}
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.13.4')
implementation platform('io.micrometer:micrometer-bom:1.9.4')
implementation 'com.google.guava:guava:31.1-jre'
implementation 'org.slf4j:slf4j-api:1.7.36'
testImplementation platform("org.junit:junit-bom:${versionMap.junitJupiter}")
testImplementation 'org.junit.jupiter:junit-jupiter'
testImplementation 'org.junit.vintage:junit-vintage-engine'
testImplementation "org.mockito:mockito-core:${versionMap.mockito}"
testImplementation "org.mockito:mockito-junit-jupiter:${versionMap.mockito}"
testImplementation 'org.hamcrest:hamcrest:2.2'
testImplementation 'org.awaitility:awaitility:4.2.0'
constraints {
implementation('org.apache.httpcomponents:httpclient') {
version {
require '4.5.13'
}
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'
}
}
constraints {
implementation('io.netty:netty-tcnative-boringssl-static') {
version {
require '2.0.42.Final'
}
because 'Netty 4.1.66+ requires new classes and methods in this version.'
}
}
}
test {
useJUnitPlatform()
}
configurations.all {
resolutionStrategy.eachDependency { def details ->
if (details.requested.group == 'io.netty' && !details.requested.name.startsWith('netty-tcnative')) {
details.useVersion '4.1.74.Final'
details.because 'Fixes CVE-2021-43797, CVE-2021-37136 and CVE-2021-37137. See https://netty.io/news/2021/09/09/4-1-68-Final.html'
}
}
}
build.dependsOn test
jacocoTestReport {
dependsOn test // tests are required to run before generating the report
reports {
xml.enabled true
}
}
task allDeps(type: DependencyReportTask) {}
}
configure(subprojects.findAll {it.name != 'data-prepper-api'}) {
dependencies {
implementation platform('software.amazon.awssdk:bom:2.17.264')
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.enabled true
csv.enabled false
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
}
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)
}