From 8182e0fd84acb318bf8a6864cfac876229eb55a9 Mon Sep 17 00:00:00 2001 From: Li Haoyi Date: Sun, 22 Jul 2018 15:44:11 +0800 Subject: 0.2.5 tweak-readme reduce polling frequency of BackgroundWrapper --- docs/pages/1 - Intro to Mill.md | 17 +++++++++++++++-- readme.md | 15 +++++++++++++++ .../scalalib/backgroundwrapper/BackgroundWrapper.java | 2 +- 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/docs/pages/1 - Intro to Mill.md b/docs/pages/1 - Intro to Mill.md index 439e80e5..b8f4ea23 100644 --- a/docs/pages/1 - Intro to Mill.md +++ b/docs/pages/1 - Intro to Mill.md @@ -36,7 +36,7 @@ pacaur -S mill ### Windows To get started, download Mill from: -https://github.com/lihaoyi/mill/releases/download/0.2.4/0.2.4, and save it as +https://github.com/lihaoyi/mill/releases/download/0.2.5/0.2.5, and save it as `mill.bat`. If you're using [Scoop](https://scoop.sh) you can install Mill via @@ -73,7 +73,7 @@ To get started, download Mill and install it into your system via the following `curl`/`chmod` command: ```bash -sudo sh -c '(echo "#!/usr/bin/env sh" && curl -L https://github.com/lihaoyi/mill/releases/download/0.2.4/0.2.4) > /usr/local/bin/mill && chmod +x /usr/local/bin/mill' +sudo sh -c '(echo "#!/usr/bin/env sh" && curl -L https://github.com/lihaoyi/mill/releases/download/0.2.5/0.2.5) > /usr/local/bin/mill && chmod +x /usr/local/bin/mill' ``` ### Development Releases @@ -141,6 +141,8 @@ $ mill foo.compile # compile sources into classfiles $ mill foo.run # run the main method, if any +$ mill foo.runBackground # run the main method in the background + $ mill foo.launcher # prepares a foo/launcher/dest/run you can run later $ mill foo.jar # bundle the classfiles into a jar @@ -314,12 +316,23 @@ the task as necessary when the inputs change: ```bash $ mill --watch foo.compile $ mill --watch foo.run +$ mill -w foo.compile +$ mill -w foo.run ``` Mill's `--watch` flag watches both the files you are building using Mill, as well as Mill's own `build.sc` file and anything it imports, so any changes to your `build.sc` will automatically get picked up. +For long-running processes like web-servers, you can use `.runBackground` to +make sure they re-compile and re-start when code changes, forcefully terminating +the previous process even though it may be still alive: + +```bash +$ mill -w foo.compile +$ mill -w foo.runBackground +``` + ## Command-line Tools Mill comes built in with a small number of useful command-line utilities: diff --git a/readme.md b/readme.md index 88c03a6f..2ad2debe 100644 --- a/readme.md +++ b/readme.md @@ -151,6 +151,21 @@ optimizer without classpath conflicts. ## Changelog +### 0.2.5 + +- Add `.runBackground` and `.runMainBackground` commands, to run something in + the background without waiting for it to return. The process will keep running + until it exits normally, or until the same `.runBackground` command is run a + second time to spawn a new version of the process. Can be used with `-w` for + auto-reloading of long-running servers. + +- [Scala-Native support](http://www.lihaoyi.com/mill/page/common-project-layouts.html#scala-native-modules). + Try it out! + +- Add `--disable-ticker` to reduce spam in CI + +- Fix propagation of `--color` flag + ### 0.2.4 - Fix resolution of `scala-{library,compiler,reflect}` in case of conflict diff --git a/scalalib/backgroundwrapper/src/mill/scalalib/backgroundwrapper/BackgroundWrapper.java b/scalalib/backgroundwrapper/src/mill/scalalib/backgroundwrapper/BackgroundWrapper.java index 64719b53..02ee23eb 100644 --- a/scalalib/backgroundwrapper/src/mill/scalalib/backgroundwrapper/BackgroundWrapper.java +++ b/scalalib/backgroundwrapper/src/mill/scalalib/backgroundwrapper/BackgroundWrapper.java @@ -10,7 +10,7 @@ public class BackgroundWrapper { public void run() { while (true) { try{ - Thread.sleep(10); + Thread.sleep(50); String token = new String( java.nio.file.Files.readAllBytes(java.nio.file.Paths.get(watched)) ); -- cgit v1.2.3