# HG changeset patch # User Tomas Zeman # Date 1545126369 -3600 # Node ID b5c85ad66f1749f7723ecfa34c1a0e534776fc72 # Parent 1fa630ed9b8a2905e35a26b295e541b0f226789b build.sc: recompile if .scalatex file changes diff -r 1fa630ed9b8a -r b5c85ad66f17 build.sc --- a/build.sc Thu Dec 13 17:33:35 2018 +0100 +++ b/build.sc Tue Dec 18 10:46:09 2018 +0100 @@ -1,6 +1,6 @@ import ammonite.ops._ import mill._ -import mill.define.{Input, Target} +import mill.define.{Input, Sources, Target} import mill.scalajslib._ import mill.scalalib._ import mill.scalalib.publish._ @@ -108,12 +108,12 @@ override def moduleDeps = Seq(base) - def contentSources: Target[PathRef] + def contentSources: Sources override def generatedSources: Target[Seq[PathRef]] = T{ val dir = T.ctx().dest - val src = contentSources().path - val ids = ls! src filter(_.name endsWith ".scalatex") map { p => + val src = contentSources() map(_.path) + val ids = src flatMap(ls! _ filter(_.name endsWith ".scalatex") map { p => val id = p.name replaceAllLiterally (".scalatex", "") val aid = s"article-$id" write(dir / s"$id.scala", @@ -128,9 +128,13 @@ | implicit val id = Articles.Id("$id") | twf("${p.toString}") | } + | + |/* + |${os.read(p).lines mkString "\n"} + |*/ """.stripMargin) aid - } + }) write(dir / "initializer.scala", s""" @@ -161,13 +165,13 @@ } object example extends Content { - def contentSources: Target[PathRef] = - T{ PathRef(millSourcePath / up / 'example / 'content) } + def contentSources: Sources = + T.sources{ millSourcePath / up / 'example / 'content } } object production extends Content { - def contentSources: Target[PathRef] = - T{ PathRef(millSourcePath / up / 'production / 'content) } + def contentSources: Sources = + T.sources{ millSourcePath / up / 'production / 'content } }