2017-05-08 15 views

Trả lời

3

thiết lập SBT là bất biến trong Runtime, vì vậy chúng tôi không thể cập nhật scalacOptions trong tùy chỉnh Task.

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

nhưng Có một cách để đạt được sự thay đổi scalacOptions trong tùy chỉnh Task bởi tạo tùy chỉnh cấu hình và ràng buộc scalacOptions trong cấu hình này, như:

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. 
Các vấn đề liên quan