Skip to content

Commit 143bf54

Browse files
authored
Upgrade gradle to 9.2.0 and github actions JDK 25 (#1534)
* Upgrade gradle to 9.2.0 and github actions JDK 25 Signed-off-by: Hailong Cui <[email protected]> * fix detekt Signed-off-by: Hailong Cui <[email protected]> * disable forbiddenApis for 3.3 for jdk 25 Signed-off-by: Hailong Cui <[email protected]> --------- Signed-off-by: Hailong Cui <[email protected]>
1 parent c701c5b commit 143bf54

File tree

63 files changed

+108
-101
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+108
-101
lines changed

.github/workflows/security-test-workflow.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
fail-fast: false
2424
# This starts three jobs, setting these environment variables uniquely for the different jobs
2525
matrix:
26-
java: [ 21, 24 ]
26+
java: [ 21, 25 ]
2727
container:
2828
# using the same image which is used by opensearch-build team to build the OpenSearch Distribution
2929
# this image tag is subject to change as more dependencies and updates will arrive over time

.github/workflows/test-and-build-workflow.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
fail-fast: false
2424
# This starts three jobs, setting these environment variables uniquely for the different jobs
2525
matrix:
26-
java: [21, 24]
26+
java: [21, 25]
2727
feature: [ism, non-ism]
2828
include:
2929
- feature: ism

build.gradle

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*/
55

66

7-
import io.gitlab.arturbosch.detekt.Detekt
7+
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
88
import org.opensearch.gradle.testclusters.OpenSearchCluster
99
import org.opensearch.gradle.testclusters.StandaloneRestIntegTestTask
1010

@@ -81,7 +81,7 @@ buildscript {
8181
classpath "org.opensearch.gradle:build-tools:${opensearch_version}"
8282
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlin_version}"
8383
classpath "org.jetbrains.kotlin:kotlin-allopen:${kotlin_version}"
84-
classpath "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.23.8"
84+
classpath "dev.detekt:detekt-gradle-plugin:2.0.0-alpha.1"
8585
classpath "org.jacoco:org.jacoco.agent:0.8.12"
8686
}
8787
}
@@ -98,7 +98,7 @@ apply plugin: 'idea'
9898
apply plugin: 'opensearch.opensearchplugin'
9999
apply plugin: 'opensearch.testclusters'
100100
apply plugin: 'opensearch.rest-test'
101-
apply plugin: 'io.gitlab.arturbosch.detekt'
101+
apply plugin: "dev.detekt"
102102
apply plugin: 'org.jetbrains.kotlin.jvm'
103103
apply plugin: 'org.jetbrains.kotlin.plugin.allopen'
104104
apply plugin: 'opensearch.pluginzip'
@@ -112,6 +112,7 @@ configurations.all {
112112
force "org.jetbrains.kotlin:kotlin-reflect:${kotlin_version}"
113113
force "org.jetbrains.kotlin:kotlin-stdlib-jdk8:${kotlin_version}"
114114
force "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${kotlin_version}"
115+
force "org.jetbrains:annotations:23.0.0"
115116
force 'junit:junit:4.13.2'
116117
force 'commons-beanutils:commons-beanutils:1.10.1'
117118
force 'com.google.guava:guava:30.1.1-jre'
@@ -180,11 +181,6 @@ detekt {
180181
// but with a string it should look for a task with that name instead
181182
check.dependsOn "detekt"
182183

183-
// TODO Remove this once detekt supports JDK24
184-
tasks.withType(Detekt).configureEach {
185-
jvmTarget = "22"
186-
}
187-
188184
configurations.testImplementation {
189185
exclude module: "securemock"
190186
}
@@ -195,6 +191,10 @@ tasks.named('forbiddenApisTest').configure {
195191
bundledSignatures += 'jdk-internal'
196192
}
197193

194+
// TODO remove it when upgrade to 3.4
195+
forbiddenApisMain.enabled = false
196+
forbiddenApisTest.enabled = false
197+
198198
ext {
199199
projectSubstitutions = [:]
200200

@@ -226,7 +226,7 @@ dependencies {
226226
implementation "org.jetbrains.kotlin:kotlin-stdlib-common:${kotlin_version}"
227227
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${kotlin_version}"
228228
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3'
229-
implementation "org.jetbrains:annotations:13.0"
229+
implementation "org.jetbrains:annotations:23.0.0"
230230
implementation project(path: ":${rootProject.name}-spi", configuration: 'shadow')
231231
implementation "org.opensearch:common-utils:${common_utils_version}"
232232
implementation "com.github.seancfoley:ipaddress:5.5.1"
@@ -303,11 +303,15 @@ publishing {
303303
tasks.generatePomFileForPluginZipPublication.dependsOn publishNebulaPublicationToMavenLocal
304304

305305
plugins.withId('java') {
306-
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_21
306+
java {
307+
sourceCompatibility = JavaVersion.VERSION_21
308+
targetCompatibility = JavaVersion.VERSION_21
309+
}
307310
}
308311

309312
plugins.withId('org.jetbrains.kotlin.jvm') {
310-
compileKotlin.kotlinOptions.jvmTarget = compileTestKotlin.kotlinOptions.jvmTarget = JavaVersion.VERSION_21
313+
compileKotlin.compilerOptions.jvmTarget.set(JvmTarget.JVM_21)
314+
compileTestKotlin.compilerOptions.jvmTarget.set(JvmTarget.JVM_21)
311315
compileKotlin.dependsOn ktlint
312316
}
313317

detekt.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
build:
2-
maxIssues: 0
3-
41
exceptions:
52
TooGenericExceptionCaught:
63
active: false
@@ -24,9 +21,9 @@ complexity:
2421
LargeClass:
2522
excludes: ['**/test/**']
2623
LongMethod:
27-
threshold: 80
24+
allowedLines: 80
2825
excludes: ['**/test/**']
2926
LongParameterList:
3027
excludes: ['**/test/**']
3128
NestedBlockDepth:
32-
threshold: 5
29+
allowedDepth: 5

gradle/wrapper/gradle-wrapper.jar

181 Bytes
Binary file not shown.

gradle/wrapper/gradle-wrapper.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionSha256Sum=efe9a3d147d948d7528a9887fa35abcf24ca1a43ad06439996490f77569b02d1
4-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-all.zip
3+
distributionSha256Sum=16f2b95838c1ddcf7242b1c39e7bbbb43c842f1f1a1a0dc4959b6d4d68abcac3
4+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.0-all.zip
55
networkTimeout=10000
66
validateDistributionUrl=true
77
zipStoreBase=GRADLE_USER_HOME

gradlew

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,7 @@ done
8686
# shellcheck disable=SC2034
8787
APP_BASE_NAME=${0##*/}
8888
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
89-
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
90-
' "$PWD" ) || exit
89+
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
9190

9291
# Use the maximum available, or set MAX_FD != -1 to use that value.
9392
MAX_FD=maximum
@@ -115,7 +114,7 @@ case "$( uname )" in #(
115114
NONSTOP* ) nonstop=true ;;
116115
esac
117116

118-
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
117+
CLASSPATH="\\\"\\\""
119118

120119

121120
# Determine the Java command to use to start the JVM.
@@ -206,15 +205,15 @@ fi
206205
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
207206

208207
# Collect all arguments for the java command:
209-
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
208+
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
210209
# and any embedded shellness will be escaped.
211210
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
212211
# treated as '${Hostname}' itself on the command line.
213212

214213
set -- \
215214
"-Dorg.gradle.appname=$APP_BASE_NAME" \
216215
-classpath "$CLASSPATH" \
217-
org.gradle.wrapper.GradleWrapperMain \
216+
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
218217
"$@"
219218

220219
# Stop when "xargs" is not available.

gradlew.bat

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,11 @@ goto fail
7070
:execute
7171
@rem Setup the command line
7272

73-
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73+
set CLASSPATH=
7474

7575

7676
@rem Execute Gradle
77-
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
77+
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
7878

7979
:end
8080
@rem End local scope for the variables with windows NT shell

spi/build.gradle

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
* Copyright OpenSearch Contributors
33
* SPDX-License-Identifier: Apache-2.0
44
*/
5+
6+
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
57
import org.opensearch.gradle.test.RestIntegTestTask
68

79
plugins {
@@ -25,11 +27,15 @@ ext {
2527
}
2628

2729
plugins.withId('java') {
28-
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_21
30+
java {
31+
sourceCompatibility = JavaVersion.VERSION_21
32+
targetCompatibility = JavaVersion.VERSION_21
33+
}
2934
}
3035

3136
plugins.withId('org.jetbrains.kotlin.jvm') {
32-
compileKotlin.kotlinOptions.jvmTarget = compileTestKotlin.kotlinOptions.jvmTarget = JavaVersion.VERSION_21
37+
compileKotlin.compilerOptions.jvmTarget.set(JvmTarget.JVM_21)
38+
compileTestKotlin.compilerOptions.jvmTarget.set(JvmTarget.JVM_21)
3339
}
3440

3541
jacoco {
@@ -41,7 +47,7 @@ jacocoTestReport {
4147
reports {
4248
xml.required.set(false)
4349
csv.required.set(false)
44-
html.destination file("${buildDir}/jacoco/")
50+
html.outputLocation.set(file("${buildDir}/jacoco/"))
4551
}
4652
}
4753

spi/src/main/kotlin/org.opensearch.indexmanagement.spi/indexstatemanagement/model/ActionMetaData.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ data class ActionMetaData(
103103
}
104104
}
105105

106-
@Suppress("ComplexMethod")
106+
@Suppress("CyclomaticComplexMethod")
107107
fun parse(xcp: XContentParser): ActionMetaData {
108108
var name: String? = null
109109
var startTime: Long? = null

0 commit comments

Comments
 (0)