-
Notifications
You must be signed in to change notification settings - Fork 30
Expand file tree
/
Copy pathbuild.gradle
More file actions
255 lines (224 loc) · 9.54 KB
/
Copy pathbuild.gradle
File metadata and controls
255 lines (224 loc) · 9.54 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
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
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/
import org.opensearch.gradle.VersionProperties
buildscript {
ext {
opensearch_group = "org.opensearch"
opensearch_version = System.getProperty("opensearch.version", "3.9.0-SNAPSHOT")
is_snapshot = "true" == System.getProperty("build.snapshot", "true")
build_version_qualifier = System.getProperty("build.version_qualifier", "")
version_tokens = opensearch_version.tokenize('-')
opensearch_build = version_tokens[0] + '.0'
if (build_version_qualifier) {
opensearch_build += "-${build_version_qualifier}"
}
if (is_snapshot) {
opensearch_build += "-SNAPSHOT"
}
opensearch_java_version = '3.9.0'
aws_sdk_version = '2.30.18'
junit_version = '6.1.1' // version catalog is 4.x
junit_platform_version = '6.1.1' // version catalog brings in earlier
aws_crypto_material_providers_version = '1.11.0' // version for crypto material provider
aws_database_encryption_sdk_dynamodb_version = '3.9.0' // version for ddb encrypt
}
repositories {
mavenLocal()
maven { url = "https://ci.opensearch.org/maven2/" }
maven { url = "https://ci.opensearch.org/m2/" }
maven { url = "https://ci.opensearch.org/ci/dbc/snapshots/maven/" }
mavenCentral()
maven { url = "https://plugins.gradle.org/m2/" }
}
dependencies {
classpath "org.opensearch.gradle:build-tools:${opensearch_version}"
classpath "com.diffplug.spotless:spotless-plugin-gradle:8.8.0"
}
}
allprojects {
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'maven-publish'
apply plugin: 'eclipse'
apply plugin: 'jacoco'
apply plugin: 'com.diffplug.spotless'
apply plugin: 'checkstyle'
apply plugin: 'opensearch.java-agent'
repositories {
mavenLocal()
maven { url = "https://ci.opensearch.org/maven2/" }
maven { url = "https://ci.opensearch.org/m2/" }
maven { url = "https://ci.opensearch.org/ci/dbc/snapshots/maven/" }
mavenCentral()
maven { url = "https://plugins.gradle.org/m2/" }
maven { url = "https://artifacts.opensearch.org/releases/" }
}
group = opensearch_group
version = opensearch_build
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
java {
targetCompatibility = JavaVersion.VERSION_21
sourceCompatibility = JavaVersion.VERSION_21
withSourcesJar()
withJavadocJar()
}
project.getExtensions().getExtraProperties().set("versions", VersionProperties.getVersions())
checkstyle {
toolVersion = "13.9.0"
}
configurations.checkstyle {
// Fix for CVE-2025-27820 and WS-2019-0379
exclude group: 'org.apache.httpcomponents.client5', module: 'httpclient5'
exclude group: 'org.apache.httpcomponents.core5', module: 'httpcore5'
exclude group: 'org.apache.httpcomponents', module: 'httpclient'
exclude group: 'org.apache.httpcomponents', module: 'httpcore'
// Fix for CVE-2025-48924
exclude group: 'org.apache.commons', module: 'commons-lang3'
// Fix for CVE-2025-67030
exclude group: 'org.codehaus.plexus', module: 'plexus-utils'
}
}
subprojects {
apply plugin: 'java-library'
dependencies {
// Common dependencies for all subprojects
implementation "org.opensearch:opensearch:${opensearch_version}"
implementation "org.apache.logging.log4j:log4j-api:${versions.log4j}"
implementation "org.apache.logging.log4j:log4j-core:${versions.log4j}"
implementation("com.fasterxml.jackson.core:jackson-annotations:${versions.jackson_annotations}")
implementation("tools.jackson.core:jackson-databind:${versions.jackson3_databind}")
implementation "tools.jackson.core:jackson-core:${versions.jackson3}"
implementation "org.apache.httpcomponents.client5:httpclient5:${versions.httpclient5}"
implementation "org.apache.httpcomponents.core5:httpcore5:${versions.httpcore5}"
// prevent conflicts with upstream JUnit 4
testImplementation("org.opensearch.test:framework:${opensearch_version}") {
exclude group: "org.junit.platform"
}
testImplementation("org.junit.jupiter:junit-jupiter:${junit_version}")
testImplementation("org.junit.platform:junit-platform-launcher:${junit_platform_version}")
testImplementation("org.mockito:mockito-core:${versions.mockito}")
}
configurations {
testImplementation.extendsFrom testFixtures
}
configurations.all {
resolutionStrategy {
force "net.bytebuddy:byte-buddy:${versions.bytebuddy}"
force "net.bytebuddy:byte-buddy-agent:${versions.bytebuddy}"
force "org.codehaus.plexus:plexus-utils:4.0.3"
// Fix for CVE-2026-33870 and CVE-2026-33871
force "io.netty:netty-codec-http:${versions.netty}"
force "io.netty:netty-codec-http2:${versions.netty}"
// Fix for CVE-2026-40542
force "org.apache.httpcomponents.client5:httpclient5:${versions.httpclient5}"
}
}
test {
include '**/*Tests.class'
systemProperty 'tests.security.manager', 'false'
useJUnitPlatform()
outputs.upToDateWhen { false }
testLogging {
events "failed", "skipped"
showExceptions = true
showCauses = true
showStackTraces = true
exceptionFormat = "full"
}
afterSuite { desc, result ->
if (!desc.parent) {
println "\nTest result: ${result.resultType}"
println "Test summary: ${result.testCount} tests, " +
"${result.successfulTestCount} succeeded, " +
"${result.failedTestCount} failed, " +
"${result.skippedTestCount} skipped"
}
}
}
jacocoTestReport {
dependsOn test
reports {
xml.required = true
}
}
tasks.named("check").configure { dependsOn(jacocoTestReport) }
java {
withSourcesJar()
withJavadocJar()
}
// checkstyle gives us the warnings we need, suppress overzelous jdk checks
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
// These are for unpublished test classes
suppressPomMetadataWarningsFor('testFixturesApiElements')
suppressPomMetadataWarningsFor('testFixturesRuntimeElements')
// Customize artifact ID for core project
if (project.name == 'opensearch-remote-metadata-sdk-core') {
artifactId = 'opensearch-remote-metadata-sdk'
}
pom {
name = project.name == 'opensearch-remote-metadata-sdk-core'
? "OpenSearch Remote Metadata SDK for Java"
: "OpenSearch Remote Metadata SDK for Java - ${project.name}"
packaging = "jar"
description = project.name == 'opensearch-remote-metadata-sdk-core'
? "OpenSearch Remote Metadata SDK for Java"
: "OpenSearch Remote Metadata SDK for Java - ${project.name}"
url = "https://github.com/opensearch-project/opensearch-remote-metadata-sdk"
scm {
connection = "scm:git@github.com:opensearch-project/opensearch-remote-metadata-sdk.git"
developerConnection = "scm:git@github.com:opensearch-project/opensearch-remote-metadata-sdk.git"
url = "git@github.com:opensearch-project/opensearch-remote-metadata-sdk.git"
}
licenses {
license {
name = "The Apache License, Version 2.0"
url = "http://www.apache.org/licenses/LICENSE-2.0.txt"
}
}
developers {
developer {
id = "amazonwebservices"
organization = "Amazon Web Services"
organizationUrl = "https://aws.amazon.com"
}
}
}
}
}
repositories {
maven {
name = 'staging'
url = "${rootProject.buildDir}/local-staging-repo"
}
maven {
name = "Snapshots"
url = System.getenv("MAVEN_SNAPSHOTS_S3_REPO")
credentials(AwsCredentials) {
accessKey = System.getenv("AWS_ACCESS_KEY_ID")
secretKey = System.getenv("AWS_SECRET_ACCESS_KEY")
sessionToken = System.getenv("AWS_SESSION_TOKEN")
}
}
}
}
}
apply from: rootProject.file('formatter/formatting.gradle')
// Task to update version
task updateVersion {
onlyIf { System.getProperty('newVersion') }
doLast {
ext.newVersion = System.getProperty('newVersion')
println "Setting version to ${newVersion}."
ant.replaceregexp(file:'build.gradle', match: '"opensearch.version", "\\d.*"', replace: '"opensearch.version", "' + newVersion.tokenize('-')[0] + '-SNAPSHOT"', flags:'g', byline:true)
}
}