2022-02-19 13:00:47 +00:00
|
|
|
import sbt._
|
|
|
|
import sbt.Keys._
|
|
|
|
import docspell.build._
|
|
|
|
import sbtcrossproject.CrossProject
|
|
|
|
|
|
|
|
object TestSettingsPlugin extends AutoPlugin {
|
|
|
|
|
|
|
|
object autoImport {
|
|
|
|
def inTest(d0: Seq[ModuleID], ds: Seq[ModuleID]*) =
|
|
|
|
ds.fold(d0)(_ ++ _).map(_ % Test)
|
|
|
|
|
|
|
|
implicit class ProjectTestSettingsSyntax(project: Project) {
|
2023-01-22 20:46:16 +00:00
|
|
|
def withTestSettings: Project =
|
2022-02-19 13:00:47 +00:00
|
|
|
project.settings(testSettings)
|
|
|
|
|
2023-01-22 20:46:16 +00:00
|
|
|
def withTestSettingsDependsOn(p: Project, ps: Project*): Project =
|
|
|
|
withTestSettings.dependsOn((p +: ps).map(_ % "test->test"): _*)
|
2022-02-19 13:00:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
implicit class CrossprojectTestSettingsSyntax(project: CrossProject) {
|
|
|
|
def withTestSettings =
|
|
|
|
project.settings(testSettings)
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
import autoImport._
|
|
|
|
|
|
|
|
val testSettings = Seq(
|
2023-01-22 20:46:16 +00:00
|
|
|
libraryDependencies ++= (Dependencies.munit ++ Dependencies.scribe).map(_ % Test),
|
2022-02-23 21:48:00 +00:00
|
|
|
testFrameworks += TestFrameworks.MUnit
|
2022-02-19 13:00:47 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
}
|