mirror of
https://github.com/TheAnachronism/docspell.git
synced 2024-11-13 02:31:10 +00:00
b77402537b
Must not be `compile->test` as this pulls in test dependencies of the other project. Also improves on `withTestSettingsDependsOn` and removes junit dependency from stanfordnlp-core. Issue: #1856
35 lines
895 B
Scala
35 lines
895 B
Scala
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) {
|
|
def withTestSettings: Project =
|
|
project.settings(testSettings)
|
|
|
|
def withTestSettingsDependsOn(p: Project, ps: Project*): Project =
|
|
withTestSettings.dependsOn((p +: ps).map(_ % "test->test"): _*)
|
|
}
|
|
|
|
implicit class CrossprojectTestSettingsSyntax(project: CrossProject) {
|
|
def withTestSettings =
|
|
project.settings(testSettings)
|
|
}
|
|
|
|
}
|
|
|
|
import autoImport._
|
|
|
|
val testSettings = Seq(
|
|
libraryDependencies ++= (Dependencies.munit ++ Dependencies.scribe).map(_ % Test),
|
|
testFrameworks += TestFrameworks.MUnit
|
|
)
|
|
|
|
}
|