diff options
author | Guillaume Martres <smarter@ubuntu.com> | 2018-08-25 18:28:59 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-25 18:28:59 +0900 |
commit | 146d58bc5d98da1d142758f974d4d5de6f5948bf (patch) | |
tree | 1395134291f0bdf474ba8e7e6d846bbdb04a126b /docs | |
parent | e4d16b38e76884c06ce74903a318b1a148c7a63d (diff) | |
download | mill-146d58bc5d98da1d142758f974d4d5de6f5948bf.tar.gz mill-146d58bc5d98da1d142758f974d4d5de6f5948bf.tar.bz2 mill-146d58bc5d98da1d142758f974d4d5de6f5948bf.zip |
Fix incremental compilation when a Scala project depends on a Java project (#414)
* Upgrade ammonite to 1.1.2-30-53edc31
This is mainly to get https://github.com/lihaoyi/Ammonite/pull/851 which
should reduce the amount of unnecessary work done by incremental
compilation in the Mill build. This requires some code changes since
this means we now depend on a more recent version of coursier, as a
side-effect this means that we do not depend on scalaz anymore.
Also use the same ammonite version in the Mill build and in
ScalaModule#ammoniteReplClasspath.
Also remove an incorrect dependency in the caffeine integration test.
This was always wrong but did not start failing until this commit,
probably due to dependencies appearing in a different order on the
classpath.
* Rename ScalaWorker to ZincWorker
Starting with the next commit, it will be used in Java-only projects
too, so the name is misleading.
* Upgrade to Zinc 1.2.1
* Fix incremental compilation when a Scala project depends on a Java project
Before this commit, JavaModule#compile simply called javac
unconditionally, thus generating new classfiles every time. But if a
Scala project depends on a Java project, this will throw off the
incremental compilation algorithm which will unnecessarily recompile
files. To avoid this we now use Zinc to compile Java projects too (as a
bonus this means that Java compilation becomes incremental). This
required some refactoring in ZincWorkerImpl to be able to compile stuff
without having to pass Scala-specific options.
The issue solved by this commit could be reproduced by running in the
Mill repository:
$ mill main.compile
$ mill -i
@ main.compile()
and observing that before this commit, the `main.compile()` call ended
up recompiling code.
Diffstat (limited to 'docs')
-rw-r--r-- | docs/VisualizePlan.svg | 30 | ||||
-rw-r--r-- | docs/pages/2 - Configuring Mill.md | 6 | ||||
-rw-r--r-- | docs/pages/5 - Modules.md | 2 |
3 files changed, 19 insertions, 19 deletions
diff --git a/docs/VisualizePlan.svg b/docs/VisualizePlan.svg index f6e50b39..9f13384f 100644 --- a/docs/VisualizePlan.svg +++ b/docs/VisualizePlan.svg @@ -3,33 +3,33 @@ <g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 328)"> <title>example1</title> <polygon fill="#ffffff" stroke="transparent" points="-4,4 -4,-328 3469.1473,-328 3469.1473,4 -4,4"/> -<!-- mill.scalalib.ScalaWorkerModule.classpath --> +<!-- mill.scalalib.ZincWorkerModule.classpath --> <g id="node1" class="node"> -<title>mill.scalalib.ScalaWorkerModule.classpath</title> +<title>mill.scalalib.ZincWorkerModule.classpath</title> <ellipse fill="none" stroke="#000000" stroke-dasharray="1,5" cx="179.1736" cy="-162" rx="179.3473" ry="18"/> -<text text-anchor="middle" x="179.1736" y="-157.8" font-family="Times,serif" font-size="14.00" fill="#000000">mill.scalalib.ScalaWorkerModule.classpath</text> +<text text-anchor="middle" x="179.1736" y="-157.8" font-family="Times,serif" font-size="14.00" fill="#000000">mill.scalalib.ZincWorkerModule.classpath</text> </g> -<!-- mill.scalalib.ScalaWorkerModule.compilerInterfaceClasspath --> +<!-- mill.scalalib.ZincWorkerModule.compilerInterfaceClasspath --> <g id="node2" class="node"> -<title>mill.scalalib.ScalaWorkerModule.compilerInterfaceClasspath</title> +<title>mill.scalalib.ZincWorkerModule.compilerInterfaceClasspath</title> <ellipse fill="none" stroke="#000000" stroke-dasharray="1,5" cx="626.1736" cy="-162" rx="249.9102" ry="18"/> -<text text-anchor="middle" x="626.1736" y="-157.8" font-family="Times,serif" font-size="14.00" fill="#000000">mill.scalalib.ScalaWorkerModule.compilerInterfaceClasspath</text> +<text text-anchor="middle" x="626.1736" y="-157.8" font-family="Times,serif" font-size="14.00" fill="#000000">mill.scalalib.ZincWorkerModule.compilerInterfaceClasspath</text> </g> -<!-- mill.scalalib.ScalaWorkerModule.worker --> +<!-- mill.scalalib.ZincWorkerModule.worker --> <g id="node3" class="node"> -<title>mill.scalalib.ScalaWorkerModule.worker</title> +<title>mill.scalalib.ZincWorkerModule.worker</title> <ellipse fill="none" stroke="#000000" stroke-dasharray="1,5" cx="626.1736" cy="-234" rx="171.2452" ry="18"/> -<text text-anchor="middle" x="626.1736" y="-229.8" font-family="Times,serif" font-size="14.00" fill="#000000">mill.scalalib.ScalaWorkerModule.worker</text> +<text text-anchor="middle" x="626.1736" y="-229.8" font-family="Times,serif" font-size="14.00" fill="#000000">mill.scalalib.ZincWorkerModule.worker</text> </g> -<!-- mill.scalalib.ScalaWorkerModule.worker->mill.scalalib.ScalaWorkerModule.classpath --> +<!-- mill.scalalib.ZincWorkerModule.worker->mill.scalalib.ZincWorkerModule.classpath --> <g id="edge1" class="edge"> -<title>mill.scalalib.ScalaWorkerModule.worker->mill.scalalib.ScalaWorkerModule.classpath</title> +<title>mill.scalalib.ZincWorkerModule.worker->mill.scalalib.ZincWorkerModule.classpath</title> <path fill="none" stroke="#000000" d="M532.4677,-218.9064C459.9462,-207.2251 359.5232,-191.0496 284.2741,-178.9289"/> <polygon fill="#000000" stroke="#000000" points="284.7249,-175.4565 274.2956,-177.3217 283.6117,-182.3675 284.7249,-175.4565"/> </g> -<!-- mill.scalalib.ScalaWorkerModule.worker->mill.scalalib.ScalaWorkerModule.compilerInterfaceClasspath --> +<!-- mill.scalalib.ZincWorkerModule.worker->mill.scalalib.ZincWorkerModule.compilerInterfaceClasspath --> <g id="edge2" class="edge"> -<title>mill.scalalib.ScalaWorkerModule.worker->mill.scalalib.ScalaWorkerModule.compilerInterfaceClasspath</title> +<title>mill.scalalib.ZincWorkerModule.worker->mill.scalalib.ZincWorkerModule.compilerInterfaceClasspath</title> <path fill="none" stroke="#000000" d="M626.1736,-215.8314C626.1736,-208.131 626.1736,-198.9743 626.1736,-190.4166"/> <polygon fill="#000000" stroke="#000000" points="629.6737,-190.4132 626.1736,-180.4133 622.6737,-190.4133 629.6737,-190.4132"/> </g> @@ -297,9 +297,9 @@ <ellipse fill="none" stroke="#000000" cx="1913.1736" cy="-306" rx="89.7283" ry="18"/> <text text-anchor="middle" x="1913.1736" y="-301.8" font-family="Times,serif" font-size="14.00" fill="#000000">moduledefs.compile</text> </g> -<!-- moduledefs.compile->mill.scalalib.ScalaWorkerModule.worker --> +<!-- moduledefs.compile->mill.scalalib.ZincWorkerModule.worker --> <g id="edge24" class="edge"> -<title>moduledefs.compile->mill.scalalib.ScalaWorkerModule.worker</title> +<title>moduledefs.compile->mill.scalalib.ZincWorkerModule.worker</title> <path fill="none" stroke="#000000" d="M1824.9751,-302.6013C1641.2815,-295.2954 1204.2998,-276.7314 838.1736,-252 814.9556,-250.4316 790.326,-248.5451 766.3857,-246.592"/> <polygon fill="#000000" stroke="#000000" points="766.4274,-243.0836 756.174,-245.7515 765.8532,-250.06 766.4274,-243.0836"/> </g> diff --git a/docs/pages/2 - Configuring Mill.md b/docs/pages/2 - Configuring Mill.md index 7db19833..989272dd 100644 --- a/docs/pages/2 - Configuring Mill.md +++ b/docs/pages/2 - Configuring Mill.md @@ -72,20 +72,20 @@ def repositories = super.repositories ++ Seq( ``` To add custom resolvers to the initial bootstrap of the build, you can create a -custom `ScalaWorkerModule`, and override the `scalaWorker` method in your +custom `ZincWorkerModule`, and override the `zincWorker` method in your `ScalaModule` by pointing it to that custom object: ```scala import coursier.maven.MavenRepository -object CustomScalaWorkerModule extends ScalaWorkerModule { +object CustomZincWorkerModule extends ZincWorkerModule { def repositories() = super.repositories ++ Seq( MavenRepository("https://oss.sonatype.org/content/repositories/releases") ) } object YourBuild extends ScalaModule { - def scalaWorker = CustomScalaWorkerModule + def zincWorker = CustomZincWorkerModule // ... rest of your build definitions } ``` diff --git a/docs/pages/5 - Modules.md b/docs/pages/5 - Modules.md index 2c13a3e9..fa6260f3 100644 --- a/docs/pages/5 - Modules.md +++ b/docs/pages/5 - Modules.md @@ -152,7 +152,7 @@ mill foo.Bar/qux `ExternalModule`s are useful for someone providing a library for use with Mill that is shared by the entire build: for example, -`mill.scalalib.ScalaWorkerApi/scalaWorker` provides a shared Scala compilation +`mill.scalalib.ZincWorkerApi/zincWorker` provides a shared Scala compilation service & cache that is shared between all `ScalaModule`s, and `mill.scalalib.GenIdea/idea` lets you generate IntelliJ projects without needing to define your own `T.command` in your `build.sc` file |