Before anything, we need the code from other repositories. Use git submodule
to get it:
git submodule update --init --recursive
Coursier is built with Mill.
The Mill build is defined in build.sc
, and .sc
scripts under project/
.
The ./mill
script runs Mill, and can be used to run Mill tasks and commands.
We list below commands that are useful when developing on coursier. Note that
most commands also accept a -w
option (to be passed right after ./mill
, like
./mill -w …
), to watch the sources for changes, and re-run a task or command upon change.
The build sources (build.sc
, scripts under project/
) are also watched
for changes.
These commands sometimes rely on the -i
option of mill. This option runs tasks
or commands in the current terminal, rather than in a Mill server running in the
background. Some commands or tasks using the terminal (querying its size, …)
require this option to run well.
$ ./mill __.compile
While watching sources:
$ ./mill -w __.compile
Metals is the recommended IDE to develop on coursier.
Using the default import functionality of Metals is not recommended. Instead, generate bloop configuration files with
$ ./mill clean
$ ./mill mill.contrib.bloop.Bloop/install
Then run the "Metals: Connect to build server" command.
Repeat these steps to re-import the project if you change the build configuration.
Coursier relies on macro annotations (via data-class), which are not supported by IntelliJ. As a consequence, editing the coursier sources in IntelliJ shows many spurious errors. It is recommended to use Metals rather than IntelliJ to develop on coursier.
If you still want to open the coursier sources in IntelliJ, generate IntelliJ configuration files with the following command rather than using the import project functionality of IntelliJ:
$ ./mill mill.scalalib.GenIdea/idea
IntelliJ should automatically pick up changes in the generated config files.
Run this command again to re-import the project if you change the build configuration.
$ ./mill -i cli[2.12.18].run …args…
$ ./mill show cli[2.12.18].standaloneLauncher
This should print the path to the generated launcher, that can be copied, or run on other machines.
$ ./mill -i show cli[2.12.18].nativeImage
This should print the path to the generated native image.
$ ./mill nativeTests
Use the command in the previous section to print the path to the generated native image.
$ ./mill jsTests
$ ./mill jsTests 2.13.3
$ ./mill jvmTests
$ ./mill jvmTests 2.13.3
$ ./mill -i doc.generate
$ ./mill -i doc.generate --npm-install --yarn-run-build
$ npx http-server doc/website/build/coursier
In watch mode (only watches markdown files):
$ ./mill -i doc.generate --npm-install --yarn-run-build --watch
$ ./mill __.mimaReportBinaryIssues