Small script to automatically fetch and execute mill build tool.
millw
is a small wrapper script around mill and works almost identical to mill.
It automatically downloads the correct mill version (into ${XDG_CACHE_DIR}/mill/download
or ~/.cache/mill/download
).
I recommend to rename the tool to just mill
.
It is designed to be a drop-in replacement for the official mill binary.
The project name and also the script name was primarily choosen to be millw
to disambiguate references.
The mill version to be used will be determined by the following steps. The search ends, after the first step that results in a version.
-
If the first parameter is
--mill-version
, the second parameter will be used as the mill version.Examplesh $ mill --mill-version 0.9.9 --disable-ticker version 0.9.9
-
else if the environment variable
MILL_VERSION
is defined, it’s value will be used.Examplesh $ MILL_VERSION mill --disable-ticket version 0.9.9
-
else if there is a file
.mill-version
in the working directory, it’s content will be used as mill version. The file must have only a mill version as content, no additional content or comments are supported.Examplesh $ echo -n "0.9.9" > .mill-version sh $ mill --disable-ticker version 0.9.9
-
The latest mill release available from the Github release pages will be used.
-
The values of the
DEFAULT_MILL_VERSION
variable inside the script will be used.
Istead of installing mill, you can just place the script into you local $HOME/bin
directory and rename it to mill
.
If you need a special mill version in a project directory, just place a .mill-version
file with the best mill version.
sh $ echo -n "0.9.9" > .mill-version
To make the start for others easier or to always have the correct mill version in your CI environment[1],
you can just place a copy of the script as millw
(for Windows millw.bat
) in your project root directory.
You should change the DEFAULT_MILL_VERSION
variable in that script to the correct version you want to use
and add the file under version control.
/**
* Update the millw script.
*/
def millw() = T.command {
val target = mill.modules.Util.download("https://raw.githubusercontent.com/lefou/millw/main/millw")
val millw = build.millSourcePath / "millw"
os.copy.over(target.path, millw)
os.perms.set(millw, os.perms(millw) + java.nio.file.attribute.PosixFilePermission.OWNER_EXECUTE)
target
}
Published under the Apache Licencse, Version 2.0.
-
Added support for mill milestones (calculate correct download URL), fixes issues with mill 0.10.0-M2
-
Updated mill repository URLs (mill repo has moved)
-
millw.bat: script exit does not exit the command shell
-
millw.bat: use curl if present, otherwise fall back to bitsadmin
-
millw.bat: Fixed download URL to support snapshot versions of mill
-
millw: Support running/downloading when used with Git Bash under Windows 10
-
millw.bat: Fixed handling and stripping of
--mill-version
parameter before calling mill
-
Print info message before download
-
millw: If no version was given, millw tries to download the latest version
-
Support changed download filename scheme since mill 0.5.0
-
Respect set version from MILL_VERSION environment variable, if defined