6
6
buildscript {
7
7
8
8
ext {
9
- opensearch_version = System . getProperty(" opensearch.version" , " 1.3.0-SNAPSHOT" )
9
+ opensearch_version = System . getProperty(" opensearch.version" , " 2.0.0-alpha1-SNAPSHOT" )
10
+ isSnapshot = " true" == System . getProperty(" build.snapshot" , " true" )
11
+ buildVersionQualifier = System . getProperty(" build.version_qualifier" , " alpha1" )
12
+
13
+ // 2.0.0-alpha1-SNAPSHOT -> 2.0.0.0-alpha1-SNAPSHOT
14
+ version_tokens = opensearch_version. tokenize(' -' )
15
+ opensearch_build = version_tokens[0 ] + ' .0'
16
+ if (buildVersionQualifier) {
17
+ opensearch_build + = " -${ buildVersionQualifier} "
18
+ }
19
+ if (isSnapshot) {
20
+ opensearch_build + = " -SNAPSHOT"
21
+ }
10
22
}
11
23
12
24
// Used to resolve build file dependencies
@@ -26,11 +38,13 @@ buildscript {
26
38
plugins {
27
39
id ' java'
28
40
id ' nebula.ospackage' version " 8.3.0"
29
- id ' com.github.spotbugs' version ' 4.6 .0'
41
+ id ' com.github.spotbugs' version ' 5.0 .0'
30
42
id ' jacoco'
31
43
id ' com.diffplug.spotless' version ' 5.11.0'
32
44
id ' checkstyle'
45
+ id ' org.ajoberstar.grgit' version ' 5.0.0'
33
46
id ' org.gradle.test-retry' version ' 1.3.1'
47
+
34
48
}
35
49
36
50
spotbugsMain {
@@ -49,8 +63,6 @@ spotbugsTest {
49
63
}
50
64
51
65
ext {
52
- isSnapshot = " true" == System . getProperty(" build.snapshot" , " true" )
53
-
54
66
// The RCA branch that will be built. Default branch is main.
55
67
rcaProjectRepo = System . getProperty(" performance-analyzer-rca.repo" , " https://github.com/opensearch-project/performance-analyzer-rca.git" )
56
68
rcaProjectBranch = System . getProperty(" performance-analyzer-rca.branch" , " main" )
64
76
65
77
allprojects {
66
78
group = " org.opensearch"
67
- version = opensearch_version - ' -SNAPSHOT' + ' .0'
68
- if (isSnapshot) {
69
- version + = " -SNAPSHOT"
70
- }
79
+ version = opensearch_build
71
80
}
72
81
73
82
apply plugin : ' opensearch.opensearchplugin'
@@ -78,7 +87,7 @@ noticeFile = rootProject.file('NOTICE.txt')
78
87
spotless {
79
88
java {
80
89
licenseHeaderFile(file(' license-header' ))
81
- googleJavaFormat(). aosp()
90
+ googleJavaFormat(' 1.12.0 ' ). aosp()
82
91
importOrder()
83
92
removeUnusedImports()
84
93
trimTrailingWhitespace()
@@ -112,22 +121,14 @@ opensearchplugin {
112
121
classname ' org.opensearch.performanceanalyzer.PerformanceAnalyzerPlugin'
113
122
}
114
123
115
- sourceCompatibility = 1.8
116
- targetCompatibility = 1.8
124
+ sourceCompatibility = JavaVersion . VERSION_11
125
+ targetCompatibility = JavaVersion . VERSION_11
117
126
118
127
compileJava {
119
128
dependsOn spotlessApply
120
- JavaVersion targetVersion = JavaVersion . toVersion(targetCompatibility);
121
- if (targetVersion. isJava9Compatible()) {
122
- options. compilerArgs + = [" --add-exports" , " jdk.attach/sun.tools.attach=ALL-UNNAMED" ]
123
- }
124
129
}
125
130
126
131
javadoc {
127
- JavaVersion targetVersion = JavaVersion . toVersion(targetCompatibility);
128
- if (targetVersion. isJava9Compatible()) {
129
- options. addStringOption(" -add-exports" , " jdk.attach/sun.tools.attach=ALL-UNNAMED" )
130
- }
131
132
}
132
133
133
134
project. afterEvaluate {
@@ -159,7 +160,7 @@ tasks.withType(JavaCompile) {
159
160
}
160
161
161
162
jacoco {
162
- toolVersion = " 0.8.5 "
163
+ toolVersion = " 0.8.7 "
163
164
}
164
165
165
166
jacocoTestReport {
@@ -212,7 +213,7 @@ checkstyleTest.enabled = false
212
213
213
214
dependencies {
214
215
if (JavaVersion . current() <= JavaVersion . VERSION_1_8 ) {
215
- compile files(" ${ System.properties['java.home']} /../lib/tools.jar" )
216
+ implementation files(" ${ System.properties['java.home']} /../lib/tools.jar" )
216
217
}
217
218
218
219
def jacksonVersion = " 2.12.6"
@@ -233,88 +234,92 @@ dependencies {
233
234
force " com.fasterxml.jackson.core:jackson-core:${ jacksonVersion} "
234
235
force " com.fasterxml.jackson.core:jackson-databind:${ jacksonVersion} "
235
236
force " com.fasterxml.jackson.module:jackson-module-paranamer:${ jacksonVersion} "
237
+ force " com.fasterxml.jackson.dataformat:jackson-dataformat-smile:${ jacksonVersion} "
238
+ force " com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:${ jacksonVersion} "
239
+ force " com.fasterxml.jackson.dataformat:jackson-dataformat-cbor:${ jacksonVersion} "
240
+ force " org.apache.commons:commons-lang3:3.12.0"
236
241
}
237
242
}
238
243
239
- compile (' com.google.guava:guava:30.1-jre' ) {
244
+ implementation (' com.google.guava:guava:30.1-jre' ) {
240
245
force = ' true'
241
246
}
242
- compile ' org.jooq:jooq:3.10.8'
243
- compile ' org.apache.commons:commons-lang3:3.9'
244
- compile ' org.bouncycastle:bcprov-jdk15on:1.70'
245
- compile ' org.bouncycastle:bcpkix-jdk15on:1.70'
246
- compile " org.opensearch:performanceanalyzer-rca:${ version} "
247
- compile " com.fasterxml.jackson.core:jackson-annotations:${ jacksonVersion} "
248
- compile " com.fasterxml.jackson.core:jackson-databind:${ jacksonVersion} "
249
- compile " com.fasterxml.jackson.module:jackson-module-paranamer:${ jacksonVersion} "
250
- compile (group : ' org.apache.logging.log4j' , name : ' log4j-api' , version : ' 2.17.1' )
251
- compile (group : ' org.apache.logging.log4j' , name : ' log4j-core' , version : ' 2.17.1' )
252
- compile (group : ' com.google.errorprone' , name : ' error_prone_annotations' , version : ' 2.9.0' ) {
247
+ implementation ' org.jooq:jooq:3.10.8'
248
+ implementation ' org.apache.commons:commons-lang3:3.9'
249
+ implementation ' org.bouncycastle:bcprov-jdk15on:1.70'
250
+ implementation ' org.bouncycastle:bcpkix-jdk15on:1.70'
251
+ implementation " org.opensearch:performanceanalyzer-rca:${ version} "
252
+ implementation " com.fasterxml.jackson.core:jackson-annotations:${ jacksonVersion} "
253
+ implementation " com.fasterxml.jackson.core:jackson-databind:${ jacksonVersion} "
254
+ implementation " com.fasterxml.jackson.module:jackson-module-paranamer:${ jacksonVersion} "
255
+ implementation (group : ' org.apache.logging.log4j' , name : ' log4j-api' , version : ' 2.17.1' )
256
+ implementation (group : ' org.apache.logging.log4j' , name : ' log4j-core' , version : ' 2.17.1' )
257
+ implementation (group : ' com.google.errorprone' , name : ' error_prone_annotations' , version : ' 2.9.0' ) {
253
258
force = ' true'
254
259
}
255
- compile (group : ' com.google.protobuf' , name :' protobuf-java' , version : ' 3.19.2' ) {
260
+ implementation (group : ' com.google.protobuf' , name :' protobuf-java' , version : ' 3.19.2' ) {
256
261
force = ' true'
257
262
}
258
- compile (" io.netty:netty-buffer:${ nettyVersion} " ) {
263
+ implementation (" io.netty:netty-buffer:${ nettyVersion} " ) {
259
264
force = ' true'
260
265
}
261
- compile (" io.netty:netty-codec:${ nettyVersion} " ) {
266
+ implementation (" io.netty:netty-codec:${ nettyVersion} " ) {
262
267
force = ' true'
263
268
}
264
- compile (" io.netty:netty-codec-http:${ nettyVersion} " ) {
269
+ implementation (" io.netty:netty-codec-http:${ nettyVersion} " ) {
265
270
force = ' true'
266
271
}
267
- compile (" io.netty:netty-common:${ nettyVersion} " ) {
272
+ implementation (" io.netty:netty-common:${ nettyVersion} " ) {
268
273
force = ' true'
269
274
}
270
- compile (" io.netty:netty-handler:${ nettyVersion} " ) {
275
+ implementation (" io.netty:netty-handler:${ nettyVersion} " ) {
271
276
force = ' true'
272
277
}
273
- compile (" io.netty:netty-resolver:${ nettyVersion} " ) {
278
+ implementation (" io.netty:netty-resolver:${ nettyVersion} " ) {
274
279
force = ' true'
275
280
}
276
- compile (" io.netty:netty-transport:${ nettyVersion} " ) {
281
+ implementation (" io.netty:netty-transport:${ nettyVersion} " ) {
277
282
force = ' true'
278
283
}
279
- compile (" io.netty:netty-codec-http2:${ nettyVersion} " ) {
284
+ implementation (" io.netty:netty-codec-http2:${ nettyVersion} " ) {
280
285
force = ' true'
281
286
}
282
- compile (" io.netty:netty-codec-socks:${ nettyVersion} " ) {
287
+ implementation (" io.netty:netty-codec-socks:${ nettyVersion} " ) {
283
288
force = ' true'
284
289
}
285
- compile (" io.netty:netty-handler-proxy:${ nettyVersion} " ) {
290
+ implementation (" io.netty:netty-handler-proxy:${ nettyVersion} " ) {
286
291
force = ' true'
287
292
}
288
293
289
294
290
295
// JDK9+ has to run powermock 2+. https://github.com/powermock/powermock/issues/888
291
- testCompile group : ' org.powermock' , name : ' powermock-api-mockito2' , version : ' 2.0.0'
292
- testCompile (group : ' org.powermock' , name : ' powermock-module-junit4' , version : ' 2.0.0' ) {
296
+ testImplementation group : ' org.powermock' , name : ' powermock-api-mockito2' , version : ' 2.0.0'
297
+ testImplementation (group : ' org.powermock' , name : ' powermock-module-junit4' , version : ' 2.0.0' ) {
293
298
exclude(group : ' org.hamcrest' , module : ' hamcrest-core' )
294
299
}
295
- testCompile (group : ' org.mockito' , name : ' mockito-core' , version : ' 2.23.0' ) {
300
+ testImplementation (group : ' org.mockito' , name : ' mockito-core' , version : ' 2.23.0' ) {
296
301
force = ' true'
297
302
}
298
303
// Dependency to mock final classes.
299
304
testImplementation group : ' org.mockito' , name : ' mockito-inline' , version : ' 2.13.0'
300
- testCompile group : ' org.powermock' , name : ' powermock-core' , version : ' 2.0.0'
301
- testCompile group : ' org.powermock' , name : ' powermock-api-support' , version : ' 2.0.0'
302
- testCompile (group : ' org.powermock' , name : ' powermock-module-junit4-common' , version : ' 2.0.0' ) {
305
+ testImplementation group : ' org.powermock' , name : ' powermock-core' , version : ' 2.0.0'
306
+ testImplementation group : ' org.powermock' , name : ' powermock-api-support' , version : ' 2.0.0'
307
+ testImplementation (group : ' org.powermock' , name : ' powermock-module-junit4-common' , version : ' 2.0.0' ) {
303
308
exclude(group : ' org.hamcrest' , module : ' hamcrest-core' )
304
309
}
305
- testCompile group : ' org.javassist' , name : ' javassist' , version : ' 3.24.0-GA'
306
- testCompile group : ' org.powermock' , name : ' powermock-reflect' , version : ' 2.0.0'
310
+ testImplementation group : ' org.javassist' , name : ' javassist' , version : ' 3.24.0-GA'
311
+ testImplementation group : ' org.powermock' , name : ' powermock-reflect' , version : ' 2.0.0'
307
312
// minimum byte-buddy version to be compatible with mockito-core 2.23.0 is 1.9.7+. https://github.com/mockito/mockito/issues/1606
308
- testCompile (group : ' net.bytebuddy' , name : ' byte-buddy' , version : ' 1.9.7' ) {
313
+ testImplementation (group : ' net.bytebuddy' , name : ' byte-buddy' , version : ' 1.9.7' ) {
309
314
force = ' true'
310
315
}
311
- testCompile (group : ' net.bytebuddy' , name : ' byte-buddy-agent' , version : ' 1.9.7' ) {
316
+ testImplementation (group : ' net.bytebuddy' , name : ' byte-buddy-agent' , version : ' 1.9.7' ) {
312
317
force = ' true'
313
318
}
314
- testCompile (group : ' org.objenesis' , name : ' objenesis' , version : ' 3.0.1' ) {
319
+ testImplementation (group : ' org.objenesis' , name : ' objenesis' , version : ' 3.0.1' ) {
315
320
force = ' true'
316
321
}
317
- testCompile group : ' com.google.code.gson' , name : ' gson' , version : ' 2.8.9'
322
+ testImplementation group : ' com.google.code.gson' , name : ' gson' , version : ' 2.8.9'
318
323
}
319
324
320
325
dependencyLicenses {
@@ -332,7 +337,7 @@ gradle.startParameter.excludedTaskNames += [ "forbiddenApisMain",
332
337
" testingConventions" ]
333
338
334
339
import java.util.concurrent.Callable
335
- import org.ajoberstar.gradle.git.tasks.GitClone
340
+ import org.ajoberstar.grgit.Grgit
336
341
import org.opensearch.gradle.test.RestIntegTestTask
337
342
import org.opensearch.gradle.testclusters.StandaloneRestIntegTestTask
338
343
@@ -347,16 +352,21 @@ static def propEnabled(property) {
347
352
* cloneRcaGitRepo clones the performance-analyzer-rca repo if the -Dtests.enableIT=true flag is passed
348
353
* to the Gradle JVM
349
354
*/
350
- task cloneRcaGitRepo (type : GitClone ) {
355
+ task cloneRcaGitRepo () {
351
356
def destination = file(rcaProjectDir)
352
- uri = rcaProjectRepo
353
- branch = rcaProjectBranch
354
- destinationPath = destination
355
- bare = false
356
- enabled = cloneRcaProject && ! destination. exists() // to clone only once
357
-
357
+ def uri = rcaProjectRepo
358
+ def branch = rcaProjectBranch
358
359
doFirst {
359
- logger. info(" Cloning performance-analyzer-rca into ${ rcaProjectDir} from ${ rcaProjectRepo} #${ rcaProjectBranch} " )
360
+ println " Cloning performance-analyzer-rca into ${ rcaProjectDir} from ${ rcaProjectRepo} #${ rcaProjectBranch} "
361
+ }
362
+ doLast {
363
+ if (destination. exists() && destination. isDirectory()) { // If directory exists, use this instead.
364
+ def grgit = Grgit . open(dir : destination. toString())
365
+ } else { // Otherwise pull it from git.
366
+ def grgit = Grgit . clone(dir : destination. toString(), uri : uri)
367
+ grgit. fetch(remote : ' origin' )
368
+ grgit. checkout(branch : branch)
369
+ }
360
370
}
361
371
}
362
372
@@ -370,11 +380,21 @@ task buildRca() {
370
380
doLast {
371
381
exec {
372
382
workingDir(" $rcaProjectDir " )
373
- commandLine ' ./gradlew' , ' build' , ' -x' , ' test' , " -Dopensearch.version=${ opensearch_version} " , " -Dbuild.snapshot=${ isSnapshot} "
383
+ if (buildVersionQualifier == null || buildVersionQualifier == ' ' || buildVersionQualifier == ' null' ) {
384
+ commandLine ' ./gradlew' , ' build' , ' -x' , ' test' , " -Dopensearch.version=${ opensearch_version} " , " -Dbuild.snapshot=${ isSnapshot} "
385
+ }
386
+ else {
387
+ commandLine ' ./gradlew' , ' build' , ' -x' , ' test' , " -Dopensearch.version=${ opensearch_version} " , " -Dbuild.snapshot=${ isSnapshot} " , " -Dbuild.version_qualifier=${ buildVersionQualifier} "
388
+ }
374
389
}
375
390
exec {
376
391
workingDir(" $rcaProjectDir " )
377
- commandLine ' ./gradlew' , ' publishToMavenLocal' , " -Dopensearch.version=${ opensearch_version} " , " -Dbuild.snapshot=${ isSnapshot} "
392
+ if (buildVersionQualifier == null || buildVersionQualifier == ' ' || buildVersionQualifier == ' null' ) {
393
+ commandLine ' ./gradlew' , ' publishToMavenLocal' , " -Dopensearch.version=${ opensearch_version} " , " -Dbuild.snapshot=${ isSnapshot} "
394
+ }
395
+ else {
396
+ commandLine ' ./gradlew' , ' publishToMavenLocal' , " -Dopensearch.version=${ opensearch_version} " , " -Dbuild.snapshot=${ isSnapshot} " , " -Dbuild.version_qualifier=${ buildVersionQualifier} "
397
+ }
378
398
}
379
399
exec {
380
400
def licenseDir = " $projectDir /licenses"
@@ -401,6 +421,14 @@ task unpackRca(type: Copy) {
401
421
}
402
422
}
403
423
424
+ tasks. withType(Test ) {
425
+ jvmArgs(' --add-opens=java.base/sun.security.jca=ALL-UNNAMED' )
426
+ jvmArgs(' --add-opens=java.base/java.util.concurrent=ALL-UNNAMED' )
427
+ jvmArgs(' --add-opens=java.base/java.io=ALL-UNNAMED' )
428
+ jvmArgs(' --add-opens=java.base/java.nio.file=ALL-UNNAMED' )
429
+ }
430
+
431
+
404
432
bundlePlugin {
405
433
dependsOn ' unpackRca'
406
434
from(" $rcaArtifactsDir /pa_config" ) {
@@ -522,7 +550,7 @@ String bwcFilePath = "src/test/resources/org/opensearch/performanceanalyzer/bwc/
522
550
testClusters {
523
551
" ${ baseName} $i " {
524
552
testDistribution = " ARCHIVE"
525
- versions = [" 7.10.2" ," 1.3.0-SNAPSHOT " ]
553
+ versions = [" 7.10.2" , opensearch_version ]
526
554
numberOfNodes = 3
527
555
plugin(provider(new Callable<RegularFile > (){
528
556
@Override
@@ -662,7 +690,7 @@ afterEvaluate {
662
690
ospackage {
663
691
packageName = " opensearch-performance-analyzer"
664
692
release = isSnapshot ? " 0.1" : ' 1'
665
- version = " ${ project.version} " - " -SNAPSHOT "
693
+ version = " ${ project.version} "
666
694
667
695
into ' /usr/share/opensearch/plugins'
668
696
from(zipTree(bundlePlugin. archivePath)) {
0 commit comments