diff options
author | Li Haoyi <haoyi.sg@gmail.com> | 2018-02-17 11:33:45 -0800 |
---|---|---|
committer | Li Haoyi <haoyi.sg@gmail.com> | 2018-02-17 11:35:40 -0800 |
commit | e9c95bfc06ed371566a9df0890f92702a4f14c7f (patch) | |
tree | 2056847bec8453dc7b79d0782d7e076248d08b39 | |
parent | a225e7650892ecc1e672bcaf95dff0d598682583 (diff) | |
download | mill-e9c95bfc06ed371566a9df0890f92702a4f14c7f.tar.gz mill-e9c95bfc06ed371566a9df0890f92702a4f14c7f.tar.bz2 mill-e9c95bfc06ed371566a9df0890f92702a4f14c7f.zip |
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
-rw-r--r-- | .travis.yml | 2 | ||||
-rw-r--r-- | docs/pages/1 - Intro to Mill.md | 8 | ||||
-rw-r--r-- | scalalib/src/mill/scalalib/ScalaModule.scala | 10 | ||||
-rw-r--r-- | scalaworker/src/mill/scalaworker/ScalaWorker.scala | 7 |
4 files changed, 15 insertions, 12 deletions
diff --git a/.travis.yml b/.travis.yml index 4c9581a1..04f1bfc2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,7 +19,7 @@ matrix: - stage: build env: CI_SCRIPT=ci/test-mill-release.sh - stage: release - env: CI_SCRIPT="ci/on-master.py ci/release.py" + env: CI_SCRIPT="ci/on-master.py ci/release.sh" - stage: release env: CI_SCRIPT="ci/on-master.py ci/publish-docs.sh" diff --git a/docs/pages/1 - Intro to Mill.md b/docs/pages/1 - Intro to Mill.md index 20fe83b8..b07595a2 100644 --- a/docs/pages/1 - Intro to Mill.md +++ b/docs/pages/1 - Intro to Mill.md @@ -49,13 +49,13 @@ resolved dependency lists, ...) would live in `out/foo/`. This can be run from the Bash shell via: ```bash -$ mill foo.compile # compile sources into classfiles +$ mill foo.compile # compile sources into classfiles -$ mill foo.run # run the main method, if any +$ mill foo.runMain foo.ExampleMain # run the specified main method -$ mill foo.jar # bundle the classfiles into a jar +$ mill foo.jar # bundle the classfiles into a jar -$ mill foo.assembly # bundle the classfiles and all dependencies into a jar +$ mill foo.assembly # bundle classfiles and all dependencies into a jar ``` The most common **tasks** that Mill can run are cached **targets**, such as 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), diff --git a/scalaworker/src/mill/scalaworker/ScalaWorker.scala b/scalaworker/src/mill/scalaworker/ScalaWorker.scala index 3990d9dc..5b5808cb 100644 --- a/scalaworker/src/mill/scalaworker/ScalaWorker.scala +++ b/scalaworker/src/mill/scalaworker/ScalaWorker.scala @@ -182,12 +182,7 @@ class ScalaWorker(ctx0: mill.util.Ctx, val newResult = ic.compile( ic.inputs( classpath = classesIODir +: compileClasspathFiles, - sources = for { - root <- sources.toArray - if exists(root) - path <- ls.rec(root) - if path.isFile && (path.ext == "scala" || path.ext == "java") - } yield path.toIO, + sources = sources.toArray.map(_.toIO), classesDirectory = classesIODir, scalacOptions = (scalacPluginClasspath.map(jar => s"-Xplugin:${jar}") ++ scalacOptions).toArray, javacOptions = javacOptions.toArray, |