Skip to content

Commit 7b7dd8a

Browse files
committed
Merge remote-tracking branch 'origin/main' into support-jackson3
# Conflicts: # .github/workflows/CI.yml
2 parents 531d3d0 + 6d26864 commit 7b7dd8a

9 files changed

Lines changed: 82 additions & 21 deletions

File tree

.github/workflows/CI.yml

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
docs: ${{ steps.changes.outputs.docs }}
1616
steps:
1717
- name: Checkout
18-
uses: actions/checkout@v6
18+
uses: actions/checkout@v7
1919
- uses: dorny/paths-filter@v4
2020
id: changes
2121
with:
@@ -40,12 +40,17 @@ jobs:
4040
needs: changes
4141
if: ${{ needs.changes.outputs.code == 'true' }}
4242
steps:
43-
- uses: actions/checkout@v6
43+
- uses: actions/checkout@v7
44+
# sbt 2 requires JDK 17+ to run
45+
- uses: actions/setup-java@v5
46+
with:
47+
distribution: 'zulu'
48+
java-version: '21'
4449
- name: jcheckstyle
4550
run: ./sbt jcheckStyle
4651
- name: scalafmtCheckAll
4752
run: ./sbt scalafmtCheckAll
48-
53+
4954
test:
5055
name: Test JDK${{ matrix.java }}
5156
runs-on: ubuntu-latest
@@ -55,24 +60,37 @@ jobs:
5560
matrix:
5661
java: ['8', '11', '17', '21', '24']
5762
steps:
58-
- uses: actions/checkout@v6
63+
- uses: actions/checkout@v7
64+
# The JDK under test: msgpack-core forks its tests onto this JDK (via
65+
# TEST_JAVA_HOME) so we still verify runtime behavior on each target JDK.
5966
- uses: actions/setup-java@v5
67+
id: target-jdk
6068
with:
6169
distribution: 'zulu'
6270
java-version: ${{ matrix.java }}
63-
- uses: actions/cache@v5
71+
# sbt 2 itself requires JDK 17+ to run, so install a fixed, newer JDK to
72+
# actually launch sbt. This becomes the default JDK on PATH/JAVA_HOME.
73+
- uses: actions/setup-java@v5
74+
with:
75+
distribution: 'zulu'
76+
java-version: '21'
77+
- uses: actions/cache@v6
6478
with:
6579
path: ~/.cache
6680
key: ${{ runner.os }}-jdk${{ matrix.java }}-${{ hashFiles('**/*.sbt') }}
6781
restore-keys: ${{ runner.os }}-jdk${{ matrix.java }}-
6882
- name: Test
83+
env:
84+
TEST_JAVA_HOME: ${{ steps.target-jdk.outputs.path }}
6985
run: |
7086
if [[ ${{ matrix.java }} -lt 17 ]]; then
7187
./sbt msgpack-core/test msgpack-jackson/test
7288
else
7389
./sbt test
7490
fi
7591
- name: Universal Buffer Test
92+
env:
93+
TEST_JAVA_HOME: ${{ steps.target-jdk.outputs.path }}
7694
run: |
7795
if [[ ${{ matrix.java }} -lt 17 ]]; then
7896
./sbt msgpack-core/test msgpack-jackson/test -J-Dmsgpack.universal-buffer=true

.github/workflows/auto-merge.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
steps:
1919
- name: Dependabot metadata
2020
id: metadata
21-
uses: dependabot/fetch-metadata@v2
21+
uses: dependabot/fetch-metadata@v3
2222
- name: Enable auto-merge for non-major updates
2323
if: ${{ steps.metadata.outputs.update-type != 'version-update:semver-major' }}
2424
run: gh pr merge --squash --auto "${{ github.event.pull_request.html_url }}"

.github/workflows/release.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,32 @@ jobs:
1111
name: Release
1212
runs-on: ubuntu-latest
1313
steps:
14-
- uses: actions/checkout@v6
14+
- uses: actions/checkout@v7
1515
with:
1616
fetch-depth: 10000
1717
# Fetch all tags so that sbt-dynver can find the previous release version
1818
- run: git fetch --tags -f
19-
# Install OpenJDK 8
19+
# We need to compile with JDK8 for Android compatibility
20+
# https://github.com/msgpack/msgpack-java/issues/516
2021
- uses: actions/setup-java@v5
22+
id: jdk8
2123
with:
22-
# We need to use JDK8 for Android compatibility https://github.com/msgpack/msgpack-java/issues/516
2324
java-version: 8
2425
distribution: adopt
26+
# sbt 2 itself requires JDK 17+ to run; build.sbt forks the compiler (and tests)
27+
# onto JDK8 via TEST_JAVA_HOME, so this becomes the default JDK on PATH/JAVA_HOME.
28+
- uses: actions/setup-java@v5
29+
with:
30+
java-version: 21
31+
distribution: adopt
2532
- name: Setup GPG
2633
env:
2734
PGP_SECRET: ${{ secrets.PGP_SECRET }}
2835
run: echo $PGP_SECRET | base64 --decode | gpg --import --batch --yes
2936
- name: Build bundle
3037
env:
3138
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
39+
TEST_JAVA_HOME: ${{ steps.jdk8.outputs.path }}
3240
run: |
3341
./sbt msgpack-core/publishSigned msgpack-jackson/publishSigned
3442
# msgpack-jackson3 requires JDK 17+

.github/workflows/snapshot.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,25 @@ jobs:
1616
name: Publish snapshots
1717
runs-on: ubuntu-latest
1818
steps:
19-
- uses: actions/checkout@v6
19+
- uses: actions/checkout@v7
2020
with:
2121
fetch-depth: 10000
2222
# Fetch all tags so that sbt-dynver can find the previous release version
2323
- run: git fetch --tags
2424
- uses: actions/setup-java@v5
25+
id: jdk11
2526
with:
2627
java-version: 11
2728
distribution: adopt
29+
# sbt 2 itself requires JDK 17+ to run; build.sbt forks the compiler onto JDK11
30+
# via TEST_JAVA_HOME, so this becomes the default JDK on PATH/JAVA_HOME.
31+
- uses: actions/setup-java@v5
32+
with:
33+
java-version: 21
34+
distribution: adopt
2835
- name: Publish snapshots
2936
env:
3037
SONATYPE_USERNAME: '${{ secrets.SONATYPE_USERNAME }}'
3138
SONATYPE_PASSWORD: '${{ secrets.SONATYPE_PASSWORD }}'
39+
TEST_JAVA_HOME: ${{ steps.jdk11.outputs.path }}
3240
run: ./sbt publish

.scala-steward.conf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# JUnit 6.x requires Java 17 at runtime, but this project still targets and
2+
# tests on JDK 8 (see javacOptions in build.sbt and the test matrix in
3+
# .github/workflows/CI.yml). Pin JUnit to the 5.x line until JDK 8 support is
4+
# dropped.
5+
updates.pin = [
6+
{ groupId = "org.junit.jupiter", artifactId = "junit-jupiter", version = "5." },
7+
{ groupId = "org.junit.vintage", artifactId = "junit-vintage-engine", version = "5." }
8+
]

build.sbt

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1+
import scala.language.implicitConversions
2+
13
Global / onChangedBuildSource := ReloadOnSourceChanges
24

35
// For performance testing, ensure each test run one-by-one
46
Global / concurrentRestrictions := Seq(Tags.limit(Tags.Test, 1))
57

6-
val AIRFRAME_VERSION = "2025.1.27"
8+
val AIRFRAME_VERSION = "2026.2.2"
79

810
// Use dynamic snapshot version strings for non tagged versions
911
ThisBuild / dynverSonatypeSnapshots := true
@@ -67,8 +69,25 @@ val buildSettings = Seq[Setting[?]](
6769
crossPaths := false,
6870
publishMavenStyle := true,
6971
// JVM options for building
70-
scalacOptions ++= Seq("-encoding", "UTF-8", "-deprecation", "-unchecked", "-feature"),
72+
// -release 8 pins scalac's resolution of JDK API calls to the JDK8 surface (e.g.
73+
// test code calling ByteBuffer.flip() resolves to the inherited Buffer.flip():Buffer
74+
// rather than JDK9's covariant ByteBuffer.flip():ByteBuffer override, which doesn't
75+
// exist on a real JDK8 at runtime -> NoSuchMethodError). Unlike javac's --release,
76+
// this doesn't need an ignore-symbol-file escape hatch since test code never touches
77+
// JDK-internal APIs the way the main sources' Unsafe usage does.
78+
scalacOptions ++=
79+
Seq("-encoding", "UTF-8", "-deprecation", "-unchecked", "-feature", "-release", "8"),
7180
Test / javaOptions ++= Seq("-ea"),
81+
// sbt 2 itself requires JDK 17+ to run, but each CI lane still needs to compile and
82+
// test against its own target JDK (e.g. 8) to faithfully reproduce runtime behavior:
83+
// javac resolves API calls against whichever JDK actually runs it (-source/-target
84+
// only constrain language level and bytecode version, not API resolution), so e.g.
85+
// compiling on JDK9+ can bind to covariant overloads like ByteBuffer.flip():
86+
// ByteBuffer that don't exist on a real JDK8 at runtime. When TEST_JAVA_HOME is set,
87+
// fork both compilation and test execution onto that JDK; otherwise use the JDK
88+
// running sbt, as before.
89+
javaHome := sys.env.get("TEST_JAVA_HOME").map(file),
90+
Test / fork := true,
7291
javacOptions ++= Seq("-source", "1.8", "-target", "1.8"),
7392
Compile / compile / javacOptions ++=
7493
Seq("-encoding", "UTF-8", "-Xlint:unchecked", "-Xlint:deprecation"),
@@ -92,8 +111,8 @@ val buildSettings = Seq[Setting[?]](
92111
// Style check config: (sbt-jchekcstyle)
93112
jcheckStyleConfig := "facebook",
94113
// Run jcheckstyle both for main and test codes
95-
Compile / compile := ((Compile / compile) dependsOn (Compile / jcheckStyle)).value,
96-
Test / compile := ((Test / compile) dependsOn (Test / jcheckStyle)).value
114+
Compile / compile := Def.uncached((Compile / compile).dependsOn(Compile / jcheckStyle).value),
115+
Test / compile := Def.uncached((Test / compile).dependsOn(Test / jcheckStyle).value)
97116
)
98117

99118
val junitJupiter = "org.junit.jupiter" % "junit-jupiter" % "5.14.4" % "test"
@@ -145,7 +164,6 @@ lazy val msgpackCore = Project(id = "msgpack-core", base = file("msgpack-core"))
145164
"--add-opens=java.base/java.nio=ALL-UNNAMED",
146165
"--add-opens=java.base/sun.nio.ch=ALL-UNNAMED"
147166
),
148-
Test / fork := true,
149167
libraryDependencies ++=
150168
Seq(
151169
// msgpack-core should have no external dependencies
@@ -173,7 +191,7 @@ lazy val msgpackJackson = Project(id = "msgpack-jackson", base = file("msgpack-j
173191
OsgiKeys.exportPackage := Seq("org.msgpack.jackson", "org.msgpack.jackson.dataformat"),
174192
libraryDependencies ++=
175193
Seq(
176-
"com.fasterxml.jackson.core" % "jackson-databind" % "2.20.0",
194+
"com.fasterxml.jackson.core" % "jackson-databind" % "2.22.0",
177195
junitJupiter,
178196
junitVintage,
179197
"org.apache.commons" % "commons-math3" % "3.6.1" % "test"

msgpack-core/src/test/scala/org/msgpack/core/buffer/MessageBufferInputTest.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,9 @@ class MessageBufferInputTest extends AirSpec:
5858
def toByteBuffer = ByteBuffer.wrap(b)
5959

6060
def saveToTmpFile: File =
61-
val tmp = File.createTempFile("testbuf", ".dat", new File("target"))
62-
tmp.getParentFile.mkdirs()
61+
val dir = new File("target")
62+
dir.mkdirs()
63+
val tmp = File.createTempFile("testbuf", ".dat", dir)
6364
tmp.deleteOnExit()
6465
withResource(new FileOutputStream(tmp)) { out =>
6566
out.write(b)

project/build.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
sbt.version=1.12.11
1+
sbt.version=2.0.1
22

project/plugins.sbt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.3.1")
22
// TODO: Fixes jacoco error:
33
// java.lang.NoClassDefFoundError: Could not initialize class org.jacoco.core.internal.flow.ClassProbesAdapter
44
//addSbtPlugin("com.github.sbt" % "sbt-jacoco" % "3.3.0")
5-
addSbtPlugin("org.xerial.sbt" % "sbt-jcheckstyle" % "0.2.1")
6-
addSbtPlugin("com.github.sbt" % "sbt-osgi" % "0.10.0")
5+
addSbtPlugin("org.xerial.sbt" % "sbt-jcheckstyle" % "0.3.0")
6+
addSbtPlugin("com.github.sbt" % "sbt-osgi" % "0.11.0-RC1")
77
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.6.1")
88
addSbtPlugin("com.github.sbt" % "sbt-dynver" % "5.1.1")
99
addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.4.7")

0 commit comments

Comments
 (0)