Skip to content

Commit 7939003

Browse files
yuye-awsronnaksaxena
authored andcommitted
update to gradle 8.1.1 in 2.x branch (opensearch-project#777)
* upgrade to gradle 8.1.1 Signed-off-by: yuye-aws <[email protected]> * upgrade gradle wrapper Signed-off-by: yuye-aws <[email protected]> * Fix flaky test: test history shard settings Signed-off-by: yuye-aws <[email protected]> --------- Signed-off-by: yuye-aws <[email protected]> Signed-off-by: Ronnak Saxena <[email protected]>
1 parent c059977 commit 7939003

File tree

9 files changed

+67
-42
lines changed

9 files changed

+67
-42
lines changed

build-tools/coverage.gradle

+4-4
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
// testing tasks don't derive from Test so the jacoco plugin can't do this automatically.
2222
def jacocoDir = "${buildDir}/jacoco"
2323

24-
task dummyTest(type: Test) {
24+
tasks.register("dummyTest", Test) {
2525
enabled = false
2626
workingDir = file("/") // Force absolute path to jacoco agent jar
2727
jacoco {
@@ -31,7 +31,7 @@ task dummyTest(type: Test) {
3131
}
3232
}
3333

34-
task dummyIntegTest(type: Test) {
34+
tasks.register("dummyIntegTest", Test) {
3535
enabled = false
3636
workingDir = file("/") // Force absolute path to jacoco agent jar
3737
jacoco {
@@ -51,8 +51,8 @@ jacocoTestReport {
5151
sourceDirectories.from = "src/main/kotlin"
5252
classDirectories.from = sourceSets.main.output
5353
reports {
54-
html.enabled = true // human readable
55-
xml.enabled = true // for coverlay
54+
html.required = true // human readable
55+
xml.required = true // for coverlay
5656
}
5757
}
5858

build-tools/pkgbuild.gradle

+10-10
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55

6-
apply plugin: 'nebula.ospackage'
6+
apply plugin: 'com.netflix.nebula.ospackage'
77

88
// This is afterEvaluate because the bundlePlugin ZIP task is updated afterEvaluate and changes the ZIP name to match the plugin name
99
afterEvaluate {
@@ -13,7 +13,7 @@ afterEvaluate {
1313
version = "${project.version}" - "-SNAPSHOT"
1414

1515
into '/usr/share/opensearch/plugins'
16-
from(zipTree(bundlePlugin.archivePath)) {
16+
from(zipTree(bundlePlugin.archiveFile)) {
1717
into opensearchplugin.name
1818
}
1919

@@ -41,24 +41,24 @@ afterEvaluate {
4141
arch = 'NOARCH'
4242
dependsOn 'assemble'
4343
finalizedBy 'renameRpm'
44-
task renameRpm(type: Copy) {
44+
tasks.register("renameRpm", Copy) {
4545
from("$buildDir/distributions")
4646
into("$buildDir/distributions")
47-
include archiveName
48-
rename archiveName, "${packageName}-${version}.rpm"
49-
doLast { delete file("$buildDir/distributions/$archiveName") }
47+
include archiveFileName
48+
rename archiveFileName, "${packageName}-${version}.rpm"
49+
doLast { delete file("$buildDir/distributions/$archiveFileName") }
5050
}
5151
}
5252
buildDeb {
5353
arch = 'all'
5454
dependsOn 'assemble'
5555
finalizedBy 'renameDeb'
56-
task renameDeb(type: Copy) {
56+
tasks.register("renameDeb", Copy) {
5757
from("$buildDir/distributions")
5858
into("$buildDir/distributions")
59-
include archiveName
60-
rename archiveName, "${packageName}-${version}.deb"
61-
doLast { delete file("$buildDir/distributions/$archiveName") }
59+
include archiveFileName
60+
rename archiveFileName, "${packageName}-${version}.deb"
61+
doLast { delete file("$buildDir/distributions/$archiveFileName") }
6262
}
6363
}
6464
}

build.gradle

+4-4
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ buildscript {
6363
notifications_core_build_download = 'https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/' + opensearch_no_snapshot +
6464
'/latest/linux/x64/tar/builds/opensearch/plugins/opensearch-notifications-core-' + notifications_no_snapshot + '.zip'
6565

66-
kotlin_version = System.getProperty("kotlin.version", "1.6.10")
66+
kotlin_version = System.getProperty("kotlin.version", "1.8.21")
6767

6868
security_plugin_version = System.getProperty("security.version", opensearch_build)
6969
}
@@ -85,7 +85,7 @@ buildscript {
8585
}
8686

8787
plugins {
88-
id 'nebula.ospackage' version "8.3.0"
88+
id "com.netflix.nebula.ospackage" version "11.3.0"
8989
id "com.dorongold.task-tree" version "2.1.1"
9090
}
9191

@@ -137,6 +137,8 @@ opensearchplugin {
137137
description 'OpenSearch Index Management Plugin'
138138
classname 'org.opensearch.indexmanagement.IndexManagementPlugin'
139139
extendedPlugins = ['opensearch-job-scheduler']
140+
licenseFile rootProject.file('LICENSE')
141+
noticeFile rootProject.file('NOTICE')
140142
}
141143

142144
tasks.named("integTest").configure {
@@ -182,8 +184,6 @@ configurations.testImplementation {
182184

183185
ext {
184186
projectSubstitutions = [:]
185-
licenseFile = rootProject.file('LICENSE')
186-
noticeFile = rootProject.file('NOTICE')
187187
}
188188

189189
allprojects {

gradle/wrapper/gradle-wrapper.jar

2.2 KB
Binary file not shown.
+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
4+
networkTimeout=10000
45
zipStoreBase=GRADLE_USER_HOME
56
zipStorePath=wrapper/dists

gradlew

+18-7
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
# Darwin, MinGW, and NonStop.
5656
#
5757
# (3) This script is generated from the Groovy template
58-
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
58+
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
5959
# within the Gradle project.
6060
#
6161
# You can find Gradle at https://github.com/gradle/gradle/.
@@ -80,13 +80,10 @@ do
8080
esac
8181
done
8282

83-
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
84-
85-
APP_NAME="Gradle"
83+
# This is normally unused
84+
# shellcheck disable=SC2034
8685
APP_BASE_NAME=${0##*/}
87-
88-
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
89-
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
86+
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
9087

9188
# Use the maximum available, or set MAX_FD != -1 to use that value.
9289
MAX_FD=maximum
@@ -143,12 +140,16 @@ fi
143140
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
144141
case $MAX_FD in #(
145142
max*)
143+
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
144+
# shellcheck disable=SC3045
146145
MAX_FD=$( ulimit -H -n ) ||
147146
warn "Could not query maximum file descriptor limit"
148147
esac
149148
case $MAX_FD in #(
150149
'' | soft) :;; #(
151150
*)
151+
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
152+
# shellcheck disable=SC3045
152153
ulimit -n "$MAX_FD" ||
153154
warn "Could not set maximum file descriptor limit to $MAX_FD"
154155
esac
@@ -193,6 +194,10 @@ if "$cygwin" || "$msys" ; then
193194
done
194195
fi
195196

197+
198+
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
199+
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
200+
196201
# Collect all arguments for the java command;
197202
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
198203
# shell script including quotes and variable substitutions, so put them in
@@ -205,6 +210,12 @@ set -- \
205210
org.gradle.wrapper.GradleWrapperMain \
206211
"$@"
207212

213+
# Stop when "xargs" is not available.
214+
if ! command -v xargs >/dev/null 2>&1
215+
then
216+
die "xargs is not available"
217+
fi
218+
208219
# Use "xargs" to parse quoted args.
209220
#
210221
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.

gradlew.bat

+9-6
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
@rem limitations under the License.
1515
@rem
1616

17-
@if "%DEBUG%" == "" @echo off
17+
@if "%DEBUG%"=="" @echo off
1818
@rem ##########################################################################
1919
@rem
2020
@rem Gradle startup script for Windows
@@ -25,7 +25,8 @@
2525
if "%OS%"=="Windows_NT" setlocal
2626

2727
set DIRNAME=%~dp0
28-
if "%DIRNAME%" == "" set DIRNAME=.
28+
if "%DIRNAME%"=="" set DIRNAME=.
29+
@rem This is normally unused
2930
set APP_BASE_NAME=%~n0
3031
set APP_HOME=%DIRNAME%
3132

@@ -40,7 +41,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
4041

4142
set JAVA_EXE=java.exe
4243
%JAVA_EXE% -version >NUL 2>&1
43-
if "%ERRORLEVEL%" == "0" goto execute
44+
if %ERRORLEVEL% equ 0 goto execute
4445

4546
echo.
4647
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
@@ -75,13 +76,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
7576

7677
:end
7778
@rem End local scope for the variables with windows NT shell
78-
if "%ERRORLEVEL%"=="0" goto mainEnd
79+
if %ERRORLEVEL% equ 0 goto mainEnd
7980

8081
:fail
8182
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
8283
rem the _cmd.exe /c_ return code!
83-
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
84-
exit /b 1
84+
set EXIT_CODE=%ERRORLEVEL%
85+
if %EXIT_CODE% equ 0 set EXIT_CODE=1
86+
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
87+
exit /b %EXIT_CODE%
8588

8689
:mainEnd
8790
if "%OS%"=="Windows_NT" endlocal

spi/build.gradle

+18-9
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,23 @@ ext {
2323
noticeFile = rootProject.file('NOTICE')
2424
}
2525

26+
plugins.withId('java') {
27+
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_11
28+
}
29+
30+
plugins.withId('org.jetbrains.kotlin.jvm') {
31+
compileKotlin.kotlinOptions.jvmTarget = compileTestKotlin.kotlinOptions.jvmTarget = JavaVersion.VERSION_11
32+
}
33+
2634
jacoco {
2735
toolVersion = '0.8.7'
28-
reportsDir = file("$buildDir/JacocoReport")
36+
reportsDirectory = file("$buildDir/JacocoReport")
2937
}
3038

3139
jacocoTestReport {
3240
reports {
33-
xml.enabled false
34-
csv.enabled false
41+
xml.required = false
42+
csv.required = false
3543
html.destination file("${buildDir}/jacoco/")
3644
}
3745
}
@@ -44,7 +52,7 @@ repositories {
4452
maven { url "https://aws.oss.sonatype.org/content/repositories/snapshots" }
4553
}
4654

47-
configurations.all {
55+
configurations.configureEach {
4856
if (it.state != Configuration.State.UNRESOLVED) return
4957
resolutionStrategy {
5058
force "org.jetbrains.kotlin:kotlin-stdlib:${kotlin_version}"
@@ -69,21 +77,22 @@ idea.module {
6977
excludeDirs -= file("$buildDir")
7078
}
7179

72-
task sourcesJar(type: Jar, dependsOn: classes) {
73-
classifier = 'sources'
80+
tasks.register("sourcesJar", Jar) {
81+
dependsOn "classes"
82+
archiveClassifier = 'sources'
7483
from sourceSets.main.allSource
7584
}
7685

7786
test {
7887
doFirst {
7988
test.classpath -= project.files(project.tasks.named('shadowJar'))
80-
test.classpath -= project.configurations.getByName(ShadowBasePlugin.CONFIGURATION_NAME)
81-
test.classpath += project.extensions.getByType(SourceSetContainer).getByName(SourceSet.MAIN_SOURCE_SET_NAME).runtimeClasspath
89+
test.classpath -= project.configurations.named(ShadowBasePlugin.CONFIGURATION_NAME)
90+
test.classpath += project.extensions.getByType(SourceSetContainer).named(SourceSet.MAIN_SOURCE_SET_NAME).runtimeClasspath
8291
}
8392
systemProperty 'tests.security.manager', 'false'
8493
}
8594

86-
task integTest(type: RestIntegTestTask) {
95+
tasks.register("integTest", RestIntegTestTask) {
8796
description 'Run integ test with opensearch test framework'
8897
group 'verification'
8998
systemProperty 'tests.security.manager', 'false'

src/test/kotlin/org/opensearch/indexmanagement/indexstatemanagement/action/IndexStateManagementHistoryIT.kt

+2-1
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,7 @@ class IndexStateManagementHistoryIT : IndexStateManagementRestTestCase() {
395395
}
396396

397397
fun `test history shard settings`() {
398+
deleteIndex(IndexManagementIndices.HISTORY_ALL)
398399
val indexName = "${testIndexName}_shard_settings"
399400
val policyID = "${testIndexName}_shard_settings_1"
400401
val actionConfig = ReadOnlyAction(0)
@@ -429,7 +430,7 @@ class IndexStateManagementHistoryIT : IndexStateManagementRestTestCase() {
429430
waitFor {
430431
assertIndexExists(IndexManagementIndices.HISTORY_WRITE_INDEX_ALIAS)
431432
val indexSettings = getIndexSettings(IndexManagementIndices.HISTORY_WRITE_INDEX_ALIAS)
432-
val historyIndexName = indexSettings.keys.filter { it.startsWith(IndexManagementIndices.HISTORY_INDEX_BASE) }.firstOrNull()
433+
val historyIndexName = indexSettings.keys.firstOrNull { it.startsWith(IndexManagementIndices.HISTORY_INDEX_BASE) }
433434
assertNotNull("Could not find a concrete history index", historyIndexName)
434435
assertEquals("Wrong number of shards", 2, getNumberOfShardsSetting(historyIndexName!!))
435436
assertEquals("Wrong number of replicas", 3, getNumberOfReplicasSetting(historyIndexName))

0 commit comments

Comments
 (0)