From d13b6b1f306c1e660da66ab7b8bf5595772af55c Mon Sep 17 00:00:00 2001 From: rockjam <5min4eq.unity@gmail.com> Date: Wed, 10 Jan 2018 01:19:55 +0300 Subject: add command line examples to readme.md --- readme.md | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/readme.md b/readme.md index 27d29655..46fbae26 100644 --- a/readme.md +++ b/readme.md @@ -66,6 +66,71 @@ Lastly, you can generate IntelliJ Scala project files using Mill via Allowing you to import a Mill project into Intellij without using SBT +### Command line + +There is a number of ways to run targets via command line: + +* Run single target: +```bash +mill core.compile +``` + +* Run single command with arguments: +```bash +mill bridges[2.12.4].publish --credentials foo --gpgPassphrase bar +``` + +* Run multiple targets: +```bash +mill --all core.test scalalib.test +``` + +**Note**: don't forget to put `--all` flag when you run multiple commands, otherwise the only first command will be run, and subsequent commands will be passed as arguments to the first one. + +* Run multiple commands with arguments: +```bash +mill --all bridges[2.11.11].publish bridges[2.12.4].publish -- --credentials foo --gpgPassphrase bar +``` + +Here `--credentials foo --gpgPassphrase bar` arguments will be passed to both `bridges[2.11.11].publish` and `bridges[2.12.4].publish` command. + +**Note**: arguments list should be separated with `--` from command list. + + +Sometimes it is tedious to write multiple targets when you want to run same targets on multiple modules, or multiple targets on one module. +Here brace expansion from bash(or another shell that support brace expansion) comes to rescue. It allows you to make some "shortcuts" for multiple commands. + +* Run same targets in multiple modules with brace expansion: +```bash +mill --all {core,scalalib,scalajslib,integration}.test +``` + +will run `test` target in `core`, `scalalib`, `scalajslib` and `integration` modules. + +* Run multiple targets in one module with brace expansion: +```bash +mill --all scalalib.{compile,test} +``` + +will run `compile` and `test` targets in `scalalib` module. + +* Run multiple targets in multiple modules: +```bash +mill --show --all {core,scalalib}.{scalaVersion,scalaBinaryVersion} +``` + +will run `scalaVersion` and `scalaBinaryVersion` targets in both `core` and `scalalib` modules. + +* Run targets in different cross build modules +```bash +mill --all bridges[{2.11.11,2.12.4}].publish -- --credentials foo --gpgPassphrase bar +``` + +will run `publish` command in both `brides[2.11.11]` and `bridges[2.12.4]` modules + +**Note**: When you run multiple targets with `--all` flag, they are not guaranteed to run in that exact order. +Mill will build task evaluation graph and run targets in correct order. + ### REPL Mill provides a build REPL, which lets you explore the build interactively and -- cgit v1.2.3