Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 14 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ on:
branches:
- master
pull_request:
branches:
- master
workflow_dispatch:

jobs:
Expand All @@ -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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


- 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: |
Expand Down
71 changes: 40 additions & 31 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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")
Expand Down Expand Up @@ -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()
Expand All @@ -83,10 +85,19 @@ subprojects {
}
}

sourceSets.create('it') {
compileClasspath += sourceSets.main.output
runtimeClasspath += sourceSets.main.output
compileClasspath += sourceSets.testFixtures.output
runtimeClasspath += sourceSets.testFixtures.output
}
Comment on lines +88 to +93

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The order here is important.

Since Gradle 8.14.4, accessing reserved configuration names derived from sourceSet before creating sourceSets has been deprecated. In Gradle 9, it becomes an error.

Without this change, the following error occurs:

Configuration with name 'itImplementation' not found.


configurations {
shade
api.extendsFrom(shade)
itImplementation.extendsFrom(implementation)
}
configurations.named('itImplementation') {
extendsFrom(configurations.named('implementation').get())
}

dependencies {
Expand All @@ -95,36 +106,31 @@ 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
events TestLogEvent.FAILED,
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) {
Expand All @@ -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")
}
}
}
Expand Down Expand Up @@ -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)
}
7 changes: 4 additions & 3 deletions docs/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}
2 changes: 2 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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" }
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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
Expand Down
12 changes: 7 additions & 5 deletions gradlew

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 14 additions & 12 deletions gradlew.bat

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion protocol/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'com.google.protobuf' version '0.8.18'
id 'com.google.protobuf' version '0.10.0'
}

dependencies {
Expand Down
Loading