diff --git a/docs/pages/1 - Intro to Mill.md b/docs/pages/1 - Intro to Mill.md index bfbb3d9aa99..c11d9de157a 100644 --- a/docs/pages/1 - Intro to Mill.md +++ b/docs/pages/1 - Intro to Mill.md @@ -1,4 +1,4 @@ -[Mill](https://github.com/lihaoyi/mill) is your shiny new Scala build tool! +[Mill](https://github.com/lihaoyi/mill) is your shiny new Java/Scala build tool! [Scared of SBT](http://www.lihaoyi.com/post/SowhatswrongwithSBT.html)? Melancholy over Maven? Grumbling about Gradle? Baffled by Bazel? Give Mill a try! @@ -33,6 +33,28 @@ Arch Linux has an [AUR package for mill](https://aur.archlinux.org/packages/mill pacaur -S mill ``` +### Windows + +To get started, download Mill from: https://github.com/lihaoyi/mill/releases/download/0.1.8/0.1.8, +and save it as `mill.bat`. + +Mill also works on a sh environment on Windows (e.g., +[MSYS2](https://www.msys2.org), +[Cygwin](https://www.cygwin.com), +[Git-Bash](https://gitforwindows.org), +[WSL](https://docs.microsoft.com/en-us/windows/wsl); +to get started, follow the instructions in the [manual](#manual) section below. Note that: + +* In some environments (such as WSL), mill has be run using interactive mode (`-i`) + +* Git-Bash: run the instruciton in administrator mode instead of `sudo` + +* Cygwin: run the following after downloading mill: + + ```bash + sed -i '0,/-cp "\$0"/{s/-cp "\$0"/-cp `cygpath -w "\$0"`/}; 0,/-cp "\$0"/{s/-cp "\$0"/-cp `cygpath -w "\$0"`/}' /usr/local/bin/mill + ``` + ### Manual To get started, download Mill and install it into your system via the following @@ -54,6 +76,17 @@ questions or say hi! ## Getting Started +The simplest Mill build for a Java project looks as follows: + +```scala +// build.sc +import mill._, mill.scalalib._ + +object foo extends JavaModule { + +} +``` + The simplest Mill build for a Scala project looks as follows: ```scala @@ -66,13 +99,14 @@ object foo extends ScalaModule { } ``` -This would build a project laid out as follows: +Both of these would build a project laid out as follows: ``` build.sc foo/ src/ - Main.scala + FileA.java + FileB.scala resources/ ... out/ @@ -100,7 +134,7 @@ $ mill foo.launcher # prepares a foo/launcher/dest/run you can ru $ mill foo.jar # bundle the classfiles into a jar $ mill foo.assembly # bundle classfiles and all dependencies into a jar - + $ mill -i foo.console # start a Scala console within your project (in interactive mode: "-i") $ mill -i foo.repl # start an Ammonite REPL within your project (in interactive mode: "-i") @@ -141,10 +175,20 @@ respective `out/foo/bar/` folder. ## Multiple Modules +### Java Example ```scala // build.sc -import mill._ -import mill.scalalib._ +import mill._, mill.scalalib._ +object foo extends ScalaModule +object bar extends ScalaModule { + def moduleDeps = Seq(foo) +} +``` + +### Scala Example +```scala +// build.sc +import mill._, mill.scalalib._ object foo extends ScalaModule { def scalaVersion = "2.12.4" } @@ -155,7 +199,7 @@ object bar extends ScalaModule { ``` You can define multiple modules the same way you define a single module, using -`def moduleDeps` to define the relationship between them. The above build +`def moduleDeps` to define the relationship between them. The above builds expects the following project layout: ``` diff --git a/docs/pages/3 - Common Project Layouts.md b/docs/pages/3 - Common Project Layouts.md index a0e3afbe9fd..a53fb1b17de 100644 --- a/docs/pages/3 - Common Project Layouts.md +++ b/docs/pages/3 - Common Project Layouts.md @@ -4,6 +4,50 @@ Earlier, we have shown how to work with the Mill default Scala module layout. Here we will explore some other common project layouts that you may want in your Scala build: +### Java Project with Test Suite + +```scala +trait JUnitTests extends TestModule{ + def testFrameworks = Seq("com.novocode.junit.JUnitFramework") + def ivyDeps = Agg(ivy"com.novocode:junit-interface:0.11") +} + +object core extends JavaModule{ + object test extends Tests with JUnitTests +} +object app extends JavaModule{ + def moduleDeps = Seq(core) + object test extends Tests with JUnitTests +} +``` + +This build is a two-module Java project with junit test suites. It expects the +following filesystem layout: + +```text +build.sc +app/ + src/hello/ + Main.java + test/src/hello/ + MyAppTests.java +core/ + src/hello/ + Core.java + test/src/hello/ + MyCoreTests.java +``` + +You can then run the junit tests using `mill app.test` or `mill core.test`, and +configure which exact tests you want to run using the flags defined on the +[JUnit Test Interface](https://github.com/sbt/junit-interface#junit-interface). + +For a more more complex, real-world example of a Java build, check out our +example build for the popular [Caffeine](https://github.com/ben-manes/caffeine) +project: + +- [Example Build](https://github.com/lihaoyi/mill/blob/master/integration/test/resources/caffeine/build.sc) + ### Cross Scala-Version Modules ```scala diff --git a/docs/pages/3 - Tasks.md b/docs/pages/4 - Tasks.md similarity index 100% rename from docs/pages/3 - Tasks.md rename to docs/pages/4 - Tasks.md diff --git a/docs/pages/4 - Modules.md b/docs/pages/5 - Modules.md similarity index 100% rename from docs/pages/4 - Modules.md rename to docs/pages/5 - Modules.md diff --git a/docs/pages/5 - Cross Builds.md b/docs/pages/6 - Cross Builds.md similarity index 100% rename from docs/pages/5 - Cross Builds.md rename to docs/pages/6 - Cross Builds.md diff --git a/docs/pages/6 - Extending Mill.md b/docs/pages/7 - Extending Mill.md similarity index 100% rename from docs/pages/6 - Extending Mill.md rename to docs/pages/7 - Extending Mill.md diff --git a/docs/pages/7 - Mill Internals.md b/docs/pages/8 - Mill Internals.md similarity index 100% rename from docs/pages/7 - Mill Internals.md rename to docs/pages/8 - Mill Internals.md diff --git a/readme.md b/readme.md index 1eec0e66bfb..e0f34278904 100644 --- a/readme.md +++ b/readme.md @@ -328,30 +328,44 @@ rm -rf out/ ## Changelog -### Master +### 0.2.0 -- Universal (combined batch/sh) script generation for launcher, assembly, and release +- Universal (combined batch/sh) script generation for launcher, assembly, and + release - For some shell (e.g., `ksh` or `fish`), a shebang line should be added, e.g., using GNU sed: - - ```bash - sed -i '1s;^;#!/usr/bin/env sh\n;' - ``` - - Or download directly with shebang added as follows: - - ```bash - sudo sh -c '(echo "#!/usr/bin/env sh" && curl -L ) > /usr/local/bin/mill && chmod +x /usr/local/bin/mill' - ``` - - On Windows, save `` as `mill.bat` - - Windows client/server improvements -- Windows repl support (note: MSYS2 subsystem/shell will be supported when jline3 v3.6.3 is released) +- Windows repl support (note: MSYS2 subsystem/shell will be supported when jline3 + v3.6.3 is released) - Fixed Java 9 support +- Remove need for running `publishAll` using `--interactive` when on OSX and + your GPG key has a passphrase + +- First-class support for `JavaModule`s + +- Properly pass compiler plugins to Scaladoc ([#282](https://github.com/lihaoyi/mill/issues/282)) + +- Support for ivy version-pinning via `ivy"...".forceVersion()` + +- Support for ivy excludes via `ivy"...".exclude()` ([#254](https://github.com/lihaoyi/mill/pull/254)) + +- Make `ivyDepsTree` properly handle transitive dependencies ([#226](https://github.com/lihaoyi/mill/issues/226)) + +- Fix handling of `runtime`-scoped ivy dependencies ([#173](https://github.com/lihaoyi/mill/issues/173)) + +- Make environment variables available to Mill builds ([#257](https://github.com/lihaoyi/mill/issues/257)) + +- Support ScalaCheck test runner ([#286](https://github.com/lihaoyi/mill/issues/286)) + +- Support for using Typelevel Scala ([#275](https://github.com/lihaoyi/mill/issues/275)) + +- If a module depends on multiple submodules with different versions of an + ivy dependency, only one version is resolved ([#273](https://github.com/lihaoyi/mill/issues/273)) + + + ### 0.1.7 - Windows batch (.bat) generation for launcher, assembly, and release