diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1244cd12..346644a4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,8 +4,6 @@ on: branches: - master pull_request: - branches: - - master workflow_dispatch: jobs: @@ -16,34 +14,37 @@ jobs: matrix: java: [8, 11, 17, 21] steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - name: Setup java - uses: actions/setup-java@v4 + uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0 with: distribution: temurin java-version: | ${{ matrix.java }} 21 + - name: Setup Gradle + uses: gradle/actions/setup-gradle@0723195856401067f7a2779048b490ace7a47d7c # v5.0.2 - name: Execute test - uses: eskatos/gradle-command-action@v1 - with: + run: | # Java is installed on JAVA_HOME_{java major version}_X64 - # refs: https://github.com/actions/setup-java/tree/v4.1.0?tab=readme-ov-file#install-multiple-jdks - arguments: | - -Ptest.java.major.version=${{ matrix.java }} - -Porg.gradle.java.installations.fromEnv=JAVA_HOME_${{ matrix.java }}_X64 - build jmhJar integrationTest + # refs: https://github.com/actions/setup-java#install-multiple-jdks + ./gradlew \ + -Ptest.java.major.version=${{ matrix.java }} \ + -Porg.gradle.java.installations.fromEnv=JAVA_HOME_${{ matrix.java }}_X64 \ + build jmhJar integrationTest publishToMavenLocal json-schema: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - name: Setup java - uses: actions/setup-java@v4 + uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0 with: distribution: temurin java-version: 21 + - name: Setup Gradle + uses: gradle/actions/setup-gradle@0723195856401067f7a2779048b490ace7a47d7c # v5.0.2 - name: Check no diff run: | diff --git a/build.gradle b/build.gradle index e4d8c4a0..c8a6e500 100644 --- a/build.gradle +++ b/build.gradle @@ -6,9 +6,9 @@ import java.net.http.HttpRequest import java.net.http.HttpResponse plugins { - id "me.champeau.jmh" version "0.6.6" apply false - id 'com.gradleup.shadow' version '8.3.6' apply false - id 'io.freefair.lombok' version '8.2.2' apply false + id "me.champeau.jmh" version "0.7.3" apply false + id 'com.gradleup.shadow' version '9.4.1' apply false + id 'io.freefair.lombok' version '8.14.2' apply false } // After sunsetting OSSRH, we need to publish artifacts on Sonatype Central Publisher Portal, after @@ -19,7 +19,7 @@ plugins { // create deployment on the portal, so we need to upload artifacts to the portal manually by // calling API. // This task is used to upload artifacts to the portal after publishing artifacts to OSSRH staging service. -task sonatypeUpload { +tasks.register('sonatypeUpload') { description = "Uploads artifacts to Sonatype Portal from OSSRH staging service." doLast { def token = findProperty("sonatypeUsername") + ':' + findProperty("sonatypePassword") @@ -56,8 +56,10 @@ subprojects { group = "com.linecorp.decaton" version = "${version}" + (snapshot.toBoolean() ? "-SNAPSHOT" : "") - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 + java { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + } repositories { mavenCentral() @@ -83,10 +85,19 @@ subprojects { } } + sourceSets.create('it') { + compileClasspath += sourceSets.main.output + runtimeClasspath += sourceSets.main.output + compileClasspath += sourceSets.testFixtures.output + runtimeClasspath += sourceSets.testFixtures.output + } + configurations { shade api.extendsFrom(shade) - itImplementation.extendsFrom(implementation) + } + configurations.named('itImplementation') { + extendsFrom(configurations.named('implementation').get()) } dependencies { @@ -95,24 +106,19 @@ subprojects { // Likely be used for most modules testImplementation libs.junitJupiter + testRuntimeOnly libs.junitPlatformLauncher testImplementation libs.mockitoCore testImplementation libs.mockitoJunitJupiter itImplementation libs.junitJupiter + itRuntimeOnly libs.junitPlatformLauncher } - sourceSets.create('it') { - compileClasspath += sourceSets.main.output - runtimeClasspath += sourceSets.main.output - compileClasspath += sourceSets.testFixtures.output - runtimeClasspath += sourceSets.testFixtures.output - } - - task integrationTest(type: Test) { + tasks.register('integrationTest', Test) { testClassesDirs = sourceSets.it.output.classesDirs classpath = sourceSets.it.runtimeClasspath } - tasks.withType(Test) { + tasks.withType(Test).configureEach { useJUnitPlatform() testLogging { // set options for log level LIFECYCLE @@ -120,11 +126,11 @@ subprojects { TestLogEvent.PASSED, TestLogEvent.SKIPPED, TestLogEvent.STANDARD_OUT - exceptionFormat TestExceptionFormat.FULL - showExceptions true - showCauses true - showStackTraces true - showStandardStreams false + exceptionFormat = TestExceptionFormat.FULL + showExceptions = true + showCauses = true + showStackTraces = true + showStandardStreams = false } def testJavaVersion = findProperty("test.java.major.version") if (testJavaVersion != null) { @@ -141,13 +147,13 @@ subprojects { repositories { maven { if (isReleaseVersion) { - url("https://ossrh-staging-api.central.sonatype.com/service/local/staging/deploy/maven2/") + url = uri("https://ossrh-staging-api.central.sonatype.com/service/local/staging/deploy/maven2/") } else { - url("https://central.sonatype.com/repository/maven-snapshots/") + url = uri("https://central.sonatype.com/repository/maven-snapshots/") } credentials { - username findProperty("sonatypeUsername") - password findProperty("sonatypePassword") + username = findProperty("sonatypeUsername") + password = findProperty("sonatypePassword") } } } @@ -249,26 +255,29 @@ subprojects { } assemble.dependsOn(shadowJar) - tasks.withType(PublishToMavenRepository) { + tasks.withType(PublishToMavenRepository).configureEach { onlyIf { !publishOnlyLocal } } - task sourcesJar(type: Jar, dependsOn: classes) { + def sourcesJar = tasks.register('sourcesJar', Jar) { + dependsOn(tasks.named('classes')) archiveClassifier.set('sources') from sourceSets.main.allSource } - javadoc { + tasks.named('javadoc', Javadoc) { source = delombok options.encoding = 'UTF-8' options.locale = 'en_US' } - task javadocJar(type: Jar) { + def javadocJar = tasks.register('javadocJar', Jar) { archiveClassifier.set('javadoc') - from javadoc + from tasks.named('javadoc') + } + tasks.named('build') { + dependsOn(tasks.named('javadoc')) } - build.dependsOn(javadoc) } diff --git a/docs/build.gradle b/docs/build.gradle index 57b217fa..7ffd1f0c 100644 --- a/docs/build.gradle +++ b/docs/build.gradle @@ -6,8 +6,9 @@ dependencies { implementation libs.asciidoctorj } -task(validateDocs, dependsOn: 'classes', type: JavaExec) { - main = 'com.linecorp.decaton.DocumentChecker' +tasks.register('validateDocs', JavaExec) { + dependsOn(tasks.named('classes')) + mainClass.set('com.linecorp.decaton.DocumentChecker') classpath = sourceSets.main.runtimeClasspath - args project.version, project.projectDir.toString() + args(project.version, project.projectDir.toString()) } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 8a317ec5..4f1a5c83 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -8,6 +8,7 @@ micrometerTracing = "1.2.4" # Keep this explicit because the Freefair Lombok plugin may bring an outdated Lombok version. lombok = "1.18.30" junit = "5.10.0" +junitPlatform = "1.10.0" hamcrest = "2.2" therapi = "0.15.0" mockito = "4.11.0" @@ -36,6 +37,7 @@ slf4jApiJsonschema = { module = "org.slf4j:slf4j-api", version.ref = "jsonSchema slf4jSimple = { module = "org.slf4j:slf4j-simple", version.ref = "jsonSchemaSlf4j" } lombok = { module = "org.projectlombok:lombok", version.ref = "lombok" } junitJupiter = { module = "org.junit.jupiter:junit-jupiter", version.ref = "junit" } +junitPlatformLauncher = { module = "org.junit.platform:junit-platform-launcher", version.ref = "junitPlatform" } hamcrest = { module = "org.hamcrest:hamcrest", version.ref = "hamcrest" } mockitoCore = { module = "org.mockito:mockito-core", version.ref = "mockito" } mockitoJunitJupiter = { module = "org.mockito:mockito-junit-jupiter", version.ref = "mockito" } diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 7f93135c..1b33c55b 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 1af9e093..5dd3c012 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.5.1-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/gradlew b/gradlew index 1aa94a42..23d15a93 100755 --- a/gradlew +++ b/gradlew @@ -15,6 +15,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +# SPDX-License-Identifier: Apache-2.0 +# ############################################################################## # @@ -55,7 +57,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -84,7 +86,7 @@ done # shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) -APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -112,7 +114,7 @@ case "$( uname )" in #( NONSTOP* ) nonstop=true ;; esac -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar +CLASSPATH="\\\"\\\"" # Determine the Java command to use to start the JVM. @@ -203,7 +205,7 @@ fi DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Collect all arguments for the java command: -# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, # and any embedded shellness will be escaped. # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be # treated as '${Hostname}' itself on the command line. @@ -211,7 +213,7 @@ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ -classpath "$CLASSPATH" \ - org.gradle.wrapper.GradleWrapperMain \ + -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \ "$@" # Stop when "xargs" is not available. diff --git a/gradlew.bat b/gradlew.bat index 6689b85b..5eed7ee8 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -13,6 +13,8 @@ @rem See the License for the specific language governing permissions and @rem limitations under the License. @rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem @if "%DEBUG%"=="" @echo off @rem ########################################################################## @@ -43,11 +45,11 @@ set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 if %ERRORLEVEL% equ 0 goto execute -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail @@ -57,22 +59,22 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe if exist "%JAVA_EXE%" goto execute -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail :execute @rem Setup the command line -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar +set CLASSPATH= @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* +"%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" %* :end @rem End local scope for the variables with windows NT shell diff --git a/protocol/build.gradle b/protocol/build.gradle index ab6faae5..a15ec6b2 100644 --- a/protocol/build.gradle +++ b/protocol/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'com.google.protobuf' version '0.8.18' + id 'com.google.protobuf' version '0.10.0' } dependencies { diff --git a/spring/build.gradle b/spring/build.gradle index 0ca7d495..28019b93 100644 --- a/spring/build.gradle +++ b/spring/build.gradle @@ -20,12 +20,12 @@ sourceSets.create('integrationTestSpringBoot3') { runtimeClasspath += sourceSets.testFixtures.output } -task integrationTestSpringBoot2(type: Test) { +def integrationTestSpringBoot2 = tasks.register('integrationTestSpringBoot2', Test) { testClassesDirs = sourceSets.integrationTestSpringBoot2.output.classesDirs classpath = sourceSets.integrationTestSpringBoot2.runtimeClasspath } -task integrationTestSpringBoot3(type: Test) { +def integrationTestSpringBoot3 = tasks.register('integrationTestSpringBoot3', Test) { testClassesDirs = sourceSets.integrationTestSpringBoot3.output.classesDirs classpath = sourceSets.integrationTestSpringBoot3.runtimeClasspath @@ -33,7 +33,9 @@ task integrationTestSpringBoot3(type: Test) { enabled = javaLauncher.get().metadata.languageVersion.asInt() >= 17 } -check.dependsOn(integrationTestSpringBoot2, integrationTestSpringBoot3) +tasks.named('check') { + dependsOn(integrationTestSpringBoot2, integrationTestSpringBoot3) +} tasks.named('compileIntegrationTestSpringBoot3Java') { // These settings are necessary to resolve boot3 dependencies correctly @@ -47,8 +49,10 @@ dependencies { integrationTestSpringBoot2Implementation libs.springBoot2Starter integrationTestSpringBoot2Implementation libs.springBoot2StarterTest integrationTestSpringBoot2Implementation libs.junitJupiter + integrationTestSpringBoot2RuntimeOnly libs.junitPlatformLauncher integrationTestSpringBoot3Implementation project(":processor") integrationTestSpringBoot3Implementation libs.springBoot3Starter integrationTestSpringBoot3Implementation libs.springBoot3StarterTest integrationTestSpringBoot3Implementation libs.junitJupiter + integrationTestSpringBoot3RuntimeOnly libs.junitPlatformLauncher }