From 92edcae5094e52783f825021e4172a6b072300e0 Mon Sep 17 00:00:00 2001 From: Li Haoyi Date: Sat, 17 Feb 2018 11:50:20 -0800 Subject: Include example zips in docs --- docs/pages/1 - Intro to Mill.md | 11 +++++++++++ docs/pages/2 - Configuring Mill.md | 7 +++++++ docs/pages/3 - Tasks.md | 4 ++-- docs/pages/6 - Extending Mill.md | 6 ++++++ 4 files changed, 26 insertions(+), 2 deletions(-) (limited to 'docs/pages') diff --git a/docs/pages/1 - Intro to Mill.md b/docs/pages/1 - Intro to Mill.md index 32fca7e8..74c12a2e 100644 --- a/docs/pages/1 - Intro to Mill.md +++ b/docs/pages/1 - Intro to Mill.md @@ -23,6 +23,7 @@ sudo curl -L -o /usr/local/bin/mill https://github.com/lihaoyi/mill/releases/dow The simplest Mill build for a Scala project looks as follows: ```scala +// build.sc import mill._ import mill.scalalib._ @@ -45,6 +46,10 @@ out/ ... ``` +You can download an example project with this layout here: + +- [Example 1](example-1.zip) + The source code for this module would live in the `foo/src/` folder, matching the name you assigned to the module. Output for this module (compiled files, resolved dependency lists, ...) would live in `out/foo/`. @@ -70,6 +75,7 @@ time. ## Multiple Modules ```scala +// build.sc import mill._ import mill.scalalib._ object foo extends ScalaModule { @@ -126,6 +132,7 @@ and re-compiled as necessary when source code in each module changes. Modules can also be nested: ```scala +// build.sc import mill._ import mill.scalalib._ object foo extends ScalaModule { @@ -418,6 +425,10 @@ object foo extends PublishModule{ } ``` +You can download an example project with this layout here: + +- [Example 2](example-2.zip) + Which you can then publish using the `mill foo.publish` command, which takes your sonatype credentials (e.g. `lihaoyi:foobarbaz`) and GPG password as inputs: diff --git a/docs/pages/2 - Configuring Mill.md b/docs/pages/2 - Configuring Mill.md index bfe7a8db..4755416c 100644 --- a/docs/pages/2 - Configuring Mill.md +++ b/docs/pages/2 - Configuring Mill.md @@ -114,6 +114,7 @@ To run tests in-process in an isolated classloader. You can define multiple test suites if you want, e.g.: ```scala +// build.sc import mill._ import mill.scalalib._ object foo extends ScalaModule { @@ -140,6 +141,7 @@ configuration options apply. ## Scala Compiler Plugins ```scala +// build.sc import mill._ import mill.scalalib._ object foo extends ScalaModule { @@ -158,6 +160,7 @@ is needed on the compilation classpath (though not at runtime). ## Common Configuration ```scala +// build.sc import mill._ import mill.scalalib._ trait CommonModule extends ScalaModule{ @@ -179,6 +182,7 @@ the same testing framework, etc. and all that can be extracted out into the ## Custom Tasks ```scala +// build.sc import mill._ import mill.scalalib._ object foo extends ScalaModule { @@ -218,6 +222,7 @@ to return nothing. ## Custom Modules ```scala +// build.sc import mill._ import mill.scalalib._ object qux extends Module{ @@ -244,6 +249,7 @@ You can also define your own module traits, with their own set of custom tasks, to represent other things e.g. Javascript bundles, docker image building,: ```scala +// build.sc trait MySpecialModule extends Module{ ... } @@ -254,6 +260,7 @@ object bar extends MySpecialModule ## Overriding Tasks ```scala +// build.sc import mill._ import mill.scalalib._ diff --git a/docs/pages/3 - Tasks.md b/docs/pages/3 - Tasks.md index 73695bb8..ca6def42 100644 --- a/docs/pages/3 - Tasks.md +++ b/docs/pages/3 - Tasks.md @@ -165,10 +165,10 @@ There are several APIs available to you within the body of a `T{...}` or `T.command{...}` block to help your write the code implementing your Target or Command: -### mill.util.Ctx.DefCtx +### mill.util.Ctx.DestCtx - `T.ctx().dest` -- `implicitly[mill.util.Ctx.DefCtx]` +- `implicitly[mill.util.Ctx.DestCtx]` This is the unique `out/classFiles/dest/` path or `out/run/dest/` path that is assigned to every Target or Command. It is cleared before your task runs, and diff --git a/docs/pages/6 - Extending Mill.md b/docs/pages/6 - Extending Mill.md index d5ec2dbc..cff03ff2 100644 --- a/docs/pages/6 - Extending Mill.md +++ b/docs/pages/6 - Extending Mill.md @@ -18,6 +18,12 @@ isn't covered by the built-in `ScalaModule`s/`ScalaJSModule`s, simply write a custom Target (for cached computations) or Command (for un-cached actions) and you're done. +For filesystem operations, you can use the +[Ammonite-Ops](http://ammonite.io/#Ammonite-Ops) library that comes bundled with +Mill, or even plain `java.nio`. Each target gets it's own +[T.ctx().dest](/page/tasks#millutilctxdestctx) folder that you can use to place +files without worrying about colliding with other targets + This covers use cases like: ### Compile some Javascript with Webpack and put it in your runtime classpath: -- cgit v1.2.3