我有一个项目定义如下:使用不同的设置编译在不同的命令
lazy val tests = Project(
id = "tests",
base = file("tests")
) settings(
commands += testScalalib
) settings (
sharedSettings ++ useShowRawPluginSettings ++ usePluginSettings: _*
) settings (
libraryDependencies <+= (scalaVersion)("org.scala-lang" % "scala-reflect" % _),
libraryDependencies <+= (scalaVersion)("org.scala-lang" % "scala-compiler" % _),
libraryDependencies += "org.tukaani" % "xz" % "1.5",
scalacOptions ++= Seq()
)
我想有这将只编译这个项目里面的一些文件的三个不同的命令。例如上面添加的testScalalib
命令应该只编译一些特定的文件。
我最好的尝试,到目前为止是:
lazy val testScalalib: Command = Command.command("testScalalib") { state =>
val extracted = Project extract state
import extracted._
val newState = append(Seq(
(sources in Compile) <<= (sources in Compile).map(_ filter(f => !f.getAbsolutePath.contains("scalalibrary/") && f.name != "Typers.scala"))),
state)
runTask(compile in Compile, newState)
state
}
不幸的是,当我使用的命令,但它仍然编译整个项目,而不仅仅是指定的文件...
你有任何想法如何我应该那样做?
谢谢!有用! – mdemarne
如果作品不需要感谢,只需接受/投票就够了;) – lpiepiora