diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7a101de..39ac32f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,7 +28,9 @@ jobs: -v scalafmtSbtCheck "+ scalafmtCheckAll" - $(if [[ "${{matrix.sbt_version}}" != "" ]] ; then echo "^^${{matrix.sbt_version}}" ; fi) test scripted + "++ 3.x" + test + scriptedTestSbt2 - run: rm -rf "$HOME/.ivy2/local" || true diff --git a/build.sbt b/build.sbt index b008a22..af470c6 100644 --- a/build.sbt +++ b/build.sbt @@ -21,14 +21,54 @@ val tagOrHash = Def.setting { scalapropsSettings -libraryDependencies += Defaults.sbtPluginExtra( - m = "org.scala-native" % "sbt-scala-native" % nativeVersion % "provided", - sbtV = (pluginCrossBuild / sbtBinaryVersion).value, - scalaV = (pluginCrossBuild / scalaBinaryVersion).value -) +crossScalaVersions += "3.3.3" + +libraryDependencies ++= { + scalaBinaryVersion.value match { + case "3" => + Nil + case _ => + Seq( + Defaults.sbtPluginExtra( + m = "org.scala-native" % "sbt-scala-native" % nativeVersion % "provided", + sbtV = (pluginCrossBuild / sbtBinaryVersion).value, + scalaV = (pluginCrossBuild / scalaBinaryVersion).value + ) + ) + } +} scalapropsVersion := "0.9.1" +pluginCrossBuild / sbtVersion := { + scalaBinaryVersion.value match { + case "2.12" => + (pluginCrossBuild / sbtVersion).value + case _ => + "2.0.0-M2" + } +} + +TaskKey[Unit]("scriptedTestSbt2") := Def.taskDyn { + val values = sbtTestDirectory.value + .listFiles(_.isDirectory) + .flatMap { dir1 => + dir1.listFiles(_.isDirectory).map { dir2 => + dir1.getName -> dir2.getName + } + } + .toList + val args = values.filter { + case ("native", _) => false + case _ => true + }.collect { case (x1, x2) => + s"${x1}/${x2}" + } + val arg = args.mkString(" ", " ", "") + streams.value.log.info("scripted" + arg) + scripted.toTask(arg) +}.value + enablePlugins(SbtPlugin) scriptedBufferLog := false diff --git a/src/main/scala/scalaprops/ScalapropsNativePlugin.scala b/src/main/scala-2/scalaprops/ScalapropsNativePlugin.scala similarity index 100% rename from src/main/scala/scalaprops/ScalapropsNativePlugin.scala rename to src/main/scala-2/scalaprops/ScalapropsNativePlugin.scala diff --git a/src/main/scala/scalaprops/ScalapropsPlugin.scala b/src/main/scala/scalaprops/ScalapropsPlugin.scala index 97a73e8..f9c8c83 100644 --- a/src/main/scala/scalaprops/ScalapropsPlugin.scala +++ b/src/main/scala/scalaprops/ScalapropsPlugin.scala @@ -1,6 +1,9 @@ package scalaprops -import sbt.*, Keys.* +// format: off +import sbt.{given, *} +// format: on +import sbt.Keys.* import sbt.complete.{DefaultParsers, Parser} import sbt.complete.DefaultParsers.* import sjsonnew.BasicJsonProtocol.*