From e9c95bfc06ed371566a9df0890f92702a4f14c7f Mon Sep 17 00:00:00 2001 From: Li Haoyi Date: Sat, 17 Feb 2018 11:33:45 -0800 Subject: Resolve individual Scala files before passing them to `ScalaModule#compile`, to ensure other rubbish in the source folders (e.g. vim `.swp` files) do not trigger spurious recompiles --- scalalib/src/mill/scalalib/ScalaModule.scala | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'scalalib/src') diff --git a/scalalib/src/mill/scalalib/ScalaModule.scala b/scalalib/src/mill/scalalib/ScalaModule.scala index b7810246..390672c6 100644 --- a/scalalib/src/mill/scalalib/ScalaModule.scala +++ b/scalalib/src/mill/scalalib/ScalaModule.scala @@ -102,10 +102,18 @@ trait ScalaModule extends mill.Module with TaskModule { outer => def generatedSources = T{ Seq.empty[PathRef] } def allSources = T{ sources() ++ generatedSources() } + def allSourceFiles = T{ + for { + root <- allSources() + if exists(root.path) + path <- ls.rec(root.path) + if path.isFile && (path.ext == "scala" || path.ext == "java") + } yield PathRef(path) + } def compile: T[CompilationResult] = T.persistent{ mill.scalalib.ScalaWorkerApi.scalaWorker().compileScala( scalaVersion(), - allSources().map(_.path), + allSourceFiles().map(_.path), scalaCompilerBridgeSources().map(_.path), compileClasspath().map(_.path), scalaCompilerClasspath().map(_.path), -- cgit v1.2.3