2017-05-08 10 views

Odpowiedz

3

ustawienia SBT jest niezmienna w Runtime, więc nie możemy aktualizować scalacOptions w Dostosuj Task.

http://www.scala-sbt.org/0.13/docs/Full-Def.html#Reminder%3A+it%E2%80%99s+all+immutable

Ale jest sposób, aby osiągnąć zmianę scalacOptions w Dostosuj Task przez tworzenia config customize i wiążą scalacOptions w tym config, jak:

lazy val MyCompile = config("MyCompile") extend Compile // customize config: MyCompile 
configs(MyCompile) //configs 
inConfig(MyCompile)(Defaults.configTasks) //inConfig and append the Defaults.configTasks 

val compileWall = taskKey[Unit]("compileWall") 

compileWall in ThisBuild := { 
    (compile in MyCompile).value 
} 

scalacOptions in MyCompile := Seq("-Xfatal-warnings") // bind the scalacOptions in customize config. 
Powiązane problemy