Skip to content

Commit bed340a

Browse files
gaeljweed3si9n
andauthored
✨ feat: support Junit 6 (sbt#194)
Co-authored-by: eugene yokota <[email protected]>
1 parent 7a6592c commit bed340a

File tree

8 files changed

+36
-78
lines changed

8 files changed

+36
-78
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,8 @@ jobs:
2424
matrix:
2525
os: [ubuntu-latest, macos-latest, windows-latest]
2626
scala: [2.12.20]
27-
java: [zulu@8, temurin@17]
27+
java: [temurin@17]
2828
exclude:
29-
- scala: 2.12.20
30-
java: zulu@8
31-
os: macos-latest
3229
- scala: 2.12.20
3330
java: temurin@17
3431
os: windows-latest
@@ -52,14 +49,6 @@ jobs:
5249
with:
5350
fetch-depth: 0
5451

55-
- name: Setup Java (zulu@8)
56-
if: matrix.java == 'zulu@8'
57-
uses: actions/setup-java@v5
58-
with:
59-
distribution: zulu
60-
java-version: 8
61-
cache: sbt
62-
6352
- name: Setup Java (temurin@17)
6453
if: matrix.java == 'temurin@17'
6554
uses: actions/setup-java@v5
@@ -100,7 +89,7 @@ jobs:
10089
matrix:
10190
os: [ubuntu-latest]
10291
scala: [2.12.20]
103-
java: [zulu@8]
92+
java: [temurin@17]
10493
runs-on: ${{ matrix.os }}
10594
steps:
10695
- name: Ignore line ending differences in git
@@ -120,14 +109,6 @@ jobs:
120109
with:
121110
fetch-depth: 0
122111

123-
- name: Setup Java (zulu@8)
124-
if: matrix.java == 'zulu@8'
125-
uses: actions/setup-java@v5
126-
with:
127-
distribution: zulu
128-
java-version: 8
129-
cache: sbt
130-
131112
- name: Setup Java (temurin@17)
132113
if: matrix.java == 'temurin@17'
133114
uses: actions/setup-java@v5

README.md

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -40,24 +40,25 @@ ThisBuild / libraryDependencies += "com.github.sbt.junit" % "jupiter-interface"
4040

4141
## Releases
4242

43-
sbt Plugin | JUnit Platform | JUnit Engine
44-
:----------------|:---------------|:-------------
45-
0.16.x | 1.14.x | 5.14.x
46-
0.15.x | 1.13.x | 5.13.x
47-
0.14.x | 1.12.x | 5.12.x
48-
0.13.x | 1.11.x | 5.11.x
49-
0.12.x | 1.10.x | 5.10.x
50-
0.11.x | 1.9.x | 5.9.x
51-
0.10.x | 1.8.x | 5.8.x
52-
0.9.x | 1.7.x | 5.7.x
53-
0.8.x | 1.1.x | 5.1.x
54-
0.7.x | 1.1.0 | 5.1.0
55-
0.6.x | 1.0.0 | 5.0.0
56-
0.5.x | 1.0.0 | 5.0.0
57-
0.4.x | 1.0.0-RC2 | 5.0.0-RC2
58-
0.3.x | 1.0.0-M6 | 5.0.0-M6
59-
0.2.x | 1.0.0-M5 | 5.0.0-M5
60-
0.1.x | 1.0.0-M4 | 5.0.0-M4
43+
sbt Plugin | JUnit Platform | JUnit Engine | Minimum Java version |
44+
:-----------|:---------------|:-------------|:---------------------|
45+
0.17.x | 6.0.x | 6.0.x | 17+ |
46+
0.16.x | 1.14.x | 5.14.x | 8+ |
47+
0.15.x | 1.13.x | 5.13.x | 8+ |
48+
0.14.x | 1.12.x | 5.12.x | 8+ |
49+
0.13.x | 1.11.x | 5.11.x | 8+ |
50+
0.12.x | 1.10.x | 5.10.x | 8+ |
51+
0.11.x | 1.9.x | 5.9.x | 8+ |
52+
0.10.x | 1.8.x | 5.8.x | 8+ |
53+
0.9.x | 1.7.x | 5.7.x | 8+ |
54+
0.8.x | 1.1.x | 5.1.x | 8+ |
55+
0.7.x | 1.1.0 | 5.1.0 | 8+ |
56+
0.6.x | 1.0.0 | 5.0.0 | 8+ |
57+
0.5.x | 1.0.0 | 5.0.0 | 8+ |
58+
0.4.x | 1.0.0-RC2 | 5.0.0-RC2 | 8+ |
59+
0.3.x | 1.0.0-M6 | 5.0.0-M6 | 8+ |
60+
0.2.x | 1.0.0-M5 | 5.0.0-M5 | 8+ |
61+
0.1.x | 1.0.0-M4 | 5.0.0-M4 | 8+ |
6162

6263
**Note** `0.9.0`+ artifacts are published on Maven Central via Sonatype OSS. Previous versions were available via <https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/net.aichler/sbt-jupiter-interface/scala_2.10/sbt_0.13/>, whose underlying host has migrated from Bintray to Scala Center Artifactory instance.
6364

build.sbt

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ ThisBuild / scalaVersion := "2.12.20"
2424

2525
lazy val commonSettings: Seq[Setting[_]] = Def.settings(
2626
Compile / javacOptions ++= Seq(
27-
"-encoding", "UTF-8", "-Xlint:all", "-Xlint:-processing", "-source", "1.8", "-target", "1.8"
27+
"-encoding", "UTF-8", "-Xlint:all", "-Xlint:-processing", "-source", "17", "-target", "17"
2828
),
29-
Compile / doc / javacOptions := Seq("-encoding", "UTF-8", "-source", "1.8"),
29+
Compile / doc / javacOptions := Seq("-encoding", "UTF-8", "-source", "17"),
3030
)
3131

3232
lazy val library = (project in file("src/library"))
@@ -93,8 +93,8 @@ lazy val plugin = (project in file("src/plugin"))
9393
scriptedBufferLog := false,
9494
scriptedLaunchOpts ++= Seq(
9595
s"-Dproject.version=${version.value}",
96-
s"-Djunit.jupiter.version=${junitJupiterVer}",
97-
s"-Djunit.platform.version=${junitPlatformVer}"
96+
s"-Djunit.jupiter.version=${junitVersion}",
97+
s"-Djunit.platform.version=${junitVersion}"
9898
),
9999
scriptedDependencies := {
100100
val () = publishLocal.value
@@ -123,9 +123,9 @@ def generateVersionFile = Def.task {
123123
val version = (library / Keys.version).value
124124
val file = (Compile / resourceManaged).value / "jupiter-interface.properties"
125125
val content = s"version=$version\n" +
126-
s"junit.platform.version=${junitPlatformVer}\n" +
127-
s"junit.jupiter.version=${junitJupiterVer}\n" +
128-
s"junit.vintage.version=${junitVintageVer}\n"
126+
s"junit.platform.version=${junitVersion}\n" +
127+
s"junit.jupiter.version=${junitVersion}\n" +
128+
s"junit.vintage.version=${junitVersion}\n"
129129
IO.write(file, content)
130130
Seq(file)
131131
}
@@ -142,11 +142,10 @@ ThisBuild / scmInfo := Some(
142142
)
143143
)
144144
ThisBuild / githubWorkflowOSes := Seq("ubuntu-latest", "macos-latest", "windows-latest")
145-
ThisBuild / githubWorkflowJavaVersions := List(JavaSpec.zulu("8"), JavaSpec.temurin("17"))
145+
ThisBuild / githubWorkflowJavaVersions := List(JavaSpec.temurin("17"))
146146
ThisBuild / githubWorkflowBuildMatrixExclusions ++= {
147147
val sv = (ThisBuild / scalaVersion).value
148148
List(
149-
MatrixExclude(Map("scala" -> sv, "java" -> "zulu@8", "os" -> "macos-latest")),
150149
MatrixExclude(Map("scala" -> sv, "java" -> "temurin@17", "os" -> "windows-latest")),
151150
)
152151
}

project/Dependencies.scala

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,15 @@
11
import sbt.*
22

33
object Dependencies {
4-
val junitJupiterVer = "5.14.0"
5-
// based on https://github.com/junit-team/junit5/releases/tag/r5.10.3 etc
6-
// The platform version seems to be "1." of the corresponding JUnit 5.x version.
7-
def junitPlatformVer = junitJupiterVer.replaceFirst("""^5\.""", "1.")
8-
def junitVintageVer = junitJupiterVer
4+
val junitVersion = "6.0.0"
95
val testInterfaceVer = "1.0"
106

11-
val junitPlatformLauncher = "org.junit.platform" % "junit-platform-launcher" % junitPlatformVer
12-
val junitJupiterEngine = "org.junit.jupiter" % "junit-jupiter-engine" % junitJupiterVer
7+
val junitPlatformLauncher = "org.junit.platform" % "junit-platform-launcher" % junitVersion
8+
val junitJupiterEngine = "org.junit.jupiter" % "junit-jupiter-engine" % junitVersion
139
val testInterface = "org.scala-sbt" % "test-interface" % testInterfaceVer
14-
val junitJupiterParams = "org.junit.jupiter" % "junit-jupiter-params" % junitJupiterVer
15-
val junitVintageEngine = "org.junit.vintage" % "junit-vintage-engine" % junitVintageVer
16-
val junitPlatformSuite = "org.junit.platform" % "junit-platform-suite" % junitPlatformVer
10+
val junitJupiterParams = "org.junit.jupiter" % "junit-jupiter-params" % junitVersion
11+
val junitVintageEngine = "org.junit.vintage" % "junit-vintage-engine" % junitVersion
12+
val junitPlatformSuite = "org.junit.platform" % "junit-platform-suite" % junitVersion
1713
val hamcrestLibrary = "org.hamcrest" % "hamcrest-library" % "3.0"
1814
val mockitoCore = "org.mockito" % "mockito-core" % "4.11.0"
1915
val junit4Interface = "com.github.sbt" % "junit-interface" % "0.13.3"
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
val junit = Def.setting { "org.junit.jupiter" % "junit-jupiter-api" % JupiterKeys.junitJupiterVersion.value }
22
val junitEngine = Def.setting { "org.junit.jupiter" % "junit-jupiter-engine" % JupiterKeys.junitJupiterVersion.value }
3-
val junitRunner = Def.setting { "org.junit.platform" % "junit-platform-runner" % JupiterKeys.junitPlatformVersion.value }
43
val junitSuiteEngine = Def.setting { "org.junit.platform" % "junit-platform-suite-engine" % JupiterKeys.junitPlatformVersion.value }
54

65
name := "test-project"
76
libraryDependencies ++= Seq(
87
junit.value % Test,
98
junitEngine.value % Test,
10-
junitRunner.value % Test,
119
junitSuiteEngine.value % Test,
1210
"com.github.sbt.junit" % "jupiter-interface" % JupiterKeys.jupiterVersion.value % Test,
1311
)

src/plugin/src/sbt-test/interop/works-with-junit-interface/build.sbt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
name := "test-project"
2121
libraryDependencies ++= Seq(
2222
"com.github.sbt.junit" % "jupiter-interface" % JupiterKeys.jupiterVersion.value % Test,
23-
"org.junit.platform" % "junit-platform-runner" % JupiterKeys.junitPlatformVersion.value % Test,
2423
"com.github.sbt" % "junit-interface" % "0.13.3" % Test,
2524
"junit" % "junit" % "4.13.2" % Test,
2625
)
@@ -37,7 +36,6 @@ checkTestDefinitions := {
3736

3837
val expected = Map(
3938
"interop.JUnit4Test" -> "com.novocode.junit",
40-
"interop.JUnitVintageTest" -> "com.github.sbt.junit.jupiter",
4139
"interop.JUnitJupiterTest" -> "com.github.sbt.junit.jupiter"
4240
)
4341

@@ -48,5 +46,5 @@ checkTestDefinitions := {
4846
assert(count == 1, s"Expected test <$testName> to have annotation <$annotationName>")
4947
}
5048

51-
assert(definitions.length == 3, "Found more than the 3 tests (" + definitions.length + ")!")
49+
assert(definitions.length == 2, "Found more than the 2 tests (" + definitions.length + ")!")
5250
}

src/plugin/src/sbt-test/interop/works-with-junit-interface/src/test/java/interop/JUnitJupiterTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package interop;
22

33
import org.junit.jupiter.api.Test;
4-
import org.junit.platform.runner.JUnitPlatform;
54

65
class JUnitJupiterTest {
76

src/plugin/src/sbt-test/interop/works-with-junit-interface/src/test/java/interop/JUnitVintageTest.java

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)