-
-
Notifications
You must be signed in to change notification settings - Fork 372
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move BuildInfo from sources into resources, defer use of resources du…
…ring compilation (#2425) Instead of compiling the buildinfo values into the source code, we only compile the buildinfo keys into the source code and store the buildinfo values in the resources, to be loaded at runtime. This greatly reduces the amount of time spent compiling things when buildinfo changes. In this repo, some rough tests indicate that it makes the second `-i installLocal` after a one-line change in the `LICENSE` file drop from 50s to 14s of runtime `mill-profile.json` Before: [mill-profile.txt](https://github.com/com-lihaoyi/mill/files/11177836/mill-profile.txt) `mill-profile.json` After: [mill-profile.txt](https://github.com/com-lihaoyi/mill/files/11177798/mill-profile.txt) Notes: 1. To really benefit from this, I had to make `compileClasspath` depend only on upstream module's `compileClasspath()`/`compile().classes`, so it doesn't end up depending on their runtime `resources()` and forcing unnecessary recompiles when the buildinfo resources change. This is probably a change we want to do anyway, given the direction set by #1811 2. I consolidated the BuildInfo implementation with `contrib/buildinfo/`. 3. Extended `contrib/buildinfo/` to support Java modules, which we dogfood in `main.client`. 4. The old behavior of statically compiling the values into the binary is still available under `def buildInfoStaticCompiled = true`, for anyone who needs it. That includes anyone using `BuildInfo` in Scala.js, which doesn't support JVM resources by default 5. For now, I copy-pasted the implementation into the root `build.sc` file, and updated `mill-bootstrap.patch` to remove it and make use of the `mill-contrib` version. When we re-bootstrap Mill on latest main, we can remove the copy-pasta 6. `contrib/buildinfo/` should be mostly source compatible with the previous implementation, except that I made `buildInfoPackageName` a required field to encourage the best practice of not putting code in the empty package
- Loading branch information
Showing
18 changed files
with
942 additions
and
388 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/usr/bin/env sh | ||
# Apply a patch, if present, before bootstrapping | ||
|
||
set -eux | ||
|
||
./mill contrib.buildinfo.publishLocal | ||
|
||
# Patch local build | ||
ci/patch-mill-bootstrap.sh | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.