Skip to content

Commit daedb09

Browse files
authored
add sbt 2 cross build setting (sbt#191)
1 parent 7f65385 commit daedb09

File tree

5 files changed

+39
-4
lines changed

5 files changed

+39
-4
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ jobs:
7676
run: sbt '++ ${{ matrix.scala }}' githubWorkflowCheck
7777

7878
- shell: bash
79-
run: sbt '++ ${{ matrix.scala }}' javafmtCheckAll test scripted
79+
run: sbt '++ ${{ matrix.scala }}' javafmtCheckAll '+ test' scripted
8080

8181
- name: Clean up Ivy Local repo
8282
shell: bash

build.sbt

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,15 @@ lazy val plugin = (project in file("src/plugin"))
5757
.settings(
5858
commonSettings,
5959
name := "sbt-jupiter-interface",
60-
Compile / scalacOptions ++= Seq("-Xlint", "-Xfatal-warnings"),
60+
Compile / scalacOptions ++= Seq("-Xlint"),
61+
Compile / scalacOptions ++= {
62+
scalaBinaryVersion.value match {
63+
case "2.12" =>
64+
Seq("-Xfatal-warnings")
65+
case _ =>
66+
Nil
67+
}
68+
},
6169
scriptedBufferLog := false,
6270
scriptedLaunchOpts ++= Seq(
6371
s"-Dproject.version=${version.value}",
@@ -73,8 +81,10 @@ lazy val plugin = (project in file("src/plugin"))
7381
(pluginCrossBuild / sbtVersion) := {
7482
scalaBinaryVersion.value match {
7583
case "2.12" => "1.5.8"
84+
case "3" => "2.0.0-RC6"
7685
}
7786
},
87+
crossScalaVersions += "3.7.3"
7888
)
7989

8090
lazy val root = (project in file("."))
@@ -116,7 +126,7 @@ ThisBuild / githubWorkflowBuildMatrixExclusions ++= {
116126
MatrixExclude(Map("scala" -> sv, "java" -> "temurin@17", "os" -> "windows-latest")),
117127
)
118128
}
119-
ThisBuild / githubWorkflowBuild := Seq(WorkflowStep.Sbt(List("javafmtCheckAll", "test", "scripted")))
129+
ThisBuild / githubWorkflowBuild := Seq(WorkflowStep.Sbt(List("javafmtCheckAll", "+ test", "scripted")))
120130
ThisBuild / githubWorkflowBuildPostamble += WorkflowStep.Run(
121131
commands = List("""rm -rf "$HOME/.ivy2/local""""),
122132
name = Some("Clean up Ivy Local repo")
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package com.github.sbt.junit.jupiter.sbt
2+
3+
import _root_.sbt.Def
4+
import _root_.sbt.Keys.*
5+
import _root_.sbt.Task
6+
import java.net.URL
7+
8+
private[sbt] object JupiterPluginCompat {
9+
val dependencyClasspathUrlArray: Def.Initialize[Task[Array[URL]]] = Def.task {
10+
dependencyClasspath.value.map(_.data.toURI.toURL).toArray
11+
}
12+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package com.github.sbt.junit.jupiter.sbt
2+
3+
import _root_.sbt.Def
4+
import _root_.sbt.Keys.*
5+
import _root_.sbt.Task
6+
import java.net.URL
7+
8+
private[sbt] object JupiterPluginCompat {
9+
val dependencyClasspathUrlArray: Def.Initialize[Task[Array[URL]]] = Def.task {
10+
val converter = fileConverter.value
11+
dependencyClasspath.value.map(x => converter.toPath(x.data).toFile.toURI.toURL).toArray
12+
}
13+
}

src/plugin/src/main/scala/com/github/sbt/junit/jupiter/sbt/JupiterPlugin.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ object JupiterPlugin extends AutoPlugin {
9696
*/
9797
private def collectTests = Def.task[Seq[TestDefinition]] {
9898
val classes = classDirectory.value
99-
val classpath = dependencyClasspath.value.map(_.data.toURI.toURL).toArray :+ classes.toURI.toURL
99+
val classpath = JupiterPluginCompat.dependencyClasspathUrlArray.value :+ classes.toURI.toURL
100100

101101
val collector = new JupiterTestCollector.Builder()
102102
.withClassDirectory(classes)

0 commit comments

Comments
 (0)