我有以下代码:
def compile(target: String, srcs: Seq[String]): Unit =
{
import scala.tools.nsc._
val settings = new Settings
settings.outputDirs.setSingleOutput(target)
val comp = new Global(settings)
val crun: comp.Run = new comp.Run
crun.compile(srcs.toList.flatMap(getFilesList))
}
def getFilesList(fName: String): List[String] =
{
val file = new java.io.File(fName)
if (file.isDirectory) file.listFiles.toList.flatMap(i => getFilesList(fName / i.getName))
else List(fName)
}
我想添加弃用,功能警告并明确启用隐式转换和宏。
答案 0 :(得分:0)
使用Lukas Rytz的评论(谢谢)这似乎有效:
settings.processArgumentString(
"-feature -language implicitConversions experimental.macros")