Skip to content

Commit

Permalink
sbt 2
Browse files Browse the repository at this point in the history
  • Loading branch information
xuwei-k committed Oct 15, 2024
1 parent 27890f6 commit 814342f
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 7 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
50 changes: 45 additions & 5 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion src/main/scala/scalaprops/ScalapropsPlugin.scala
Original file line number Diff line number Diff line change
@@ -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.*
Expand Down

0 comments on commit 814342f

Please sign in to comment.