1

磨坊文件

源使用 T.sources {…​} 定义,将一个或多个 os.Paths 作为参数。Source 是 Target[Seq[PathRef]] 的子类

所以这在mill v0.9.9中是可能的

def sourceRoots: Sources = T.sources { os.pwd / "src" }

和这个

def sourceRoots: Sources = T.sources ( os.pwd / "src", os.pwd / "foobar" ) 

但这些不编译:

def sourceRoots = T.sources { os.pwd / "src", os.pwd / "foobar" }
def sourceRoots = T.sources { Seq(os.pwd / "src", os.pwd / "foobar") }
def sourceRoots = T.sources { Seq(os.pwd / "src", os.pwd / "foobar") : _* }
def sourceRoots = T.sources ( Seq(os.pwd / "src", os.pwd / "foobar") )
def sourceRoots = T.sources ( Seq(os.pwd / "src", os.pwd / "foobar") : _* )

是否有可能def sourceRoots: Sources = T.sources ...从一系列路径创建?

4

1 回答 1

0

构造有两个重载T.sources。一个接受os.Paths,另一个接受 a Seq[mill.api.PathRef]

要从 a 创建 a T.sourcesSeq[os.Path]请执行以下操作:

val paths = Seq(millSourcePath / "src", millSourcePath / "src-jvm")

def sourceRoots = T.sources { paths.map(p => PathRef(p)) }
于 2021-08-31T07:25:27.527 回答