diff options
author | Li Haoyi <haoyi.sg@gmail.com> | 2018-04-10 12:11:33 -0700 |
---|---|---|
committer | Li Haoyi <haoyi.sg@gmail.com> | 2018-04-10 14:33:33 -0700 |
commit | b41a09426c03167a883cfb8a3ac3165d99aac056 (patch) | |
tree | a485038eb091c59a15c6e828521138ea9071b0de /docs/pages | |
parent | 0b11197c99caa61213ffccbc03b913b5a148d426 (diff) | |
download | mill-b41a09426c03167a883cfb8a3ac3165d99aac056.tar.gz mill-b41a09426c03167a883cfb8a3ac3165d99aac056.tar.bz2 mill-b41a09426c03167a883cfb8a3ac3165d99aac056.zip |
update changelog for 0.2.00.2.0
Diffstat (limited to 'docs/pages')
-rw-r--r-- | docs/pages/1 - Intro to Mill.md | 58 | ||||
-rw-r--r-- | docs/pages/3 - Common Project Layouts.md | 44 | ||||
-rw-r--r-- | docs/pages/4 - Tasks.md (renamed from docs/pages/3 - Tasks.md) | 0 | ||||
-rw-r--r-- | docs/pages/5 - Modules.md (renamed from docs/pages/4 - Modules.md) | 0 | ||||
-rw-r--r-- | docs/pages/6 - Cross Builds.md (renamed from docs/pages/5 - Cross Builds.md) | 0 | ||||
-rw-r--r-- | docs/pages/7 - Extending Mill.md (renamed from docs/pages/6 - Extending Mill.md) | 0 | ||||
-rw-r--r-- | docs/pages/8 - Mill Internals.md (renamed from docs/pages/7 - Mill Internals.md) | 0 |
7 files changed, 95 insertions, 7 deletions
diff --git a/docs/pages/1 - Intro to Mill.md b/docs/pages/1 - Intro to Mill.md index bfbb3d9a..c11d9de1 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 a0e3afbe..a53fb1b1 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 index 71974177..71974177 100644 --- a/docs/pages/3 - Tasks.md +++ b/docs/pages/4 - Tasks.md diff --git a/docs/pages/4 - Modules.md b/docs/pages/5 - Modules.md index c8d7378c..c8d7378c 100644 --- a/docs/pages/4 - Modules.md +++ b/docs/pages/5 - Modules.md diff --git a/docs/pages/5 - Cross Builds.md b/docs/pages/6 - Cross Builds.md index f92678d5..f92678d5 100644 --- a/docs/pages/5 - Cross Builds.md +++ b/docs/pages/6 - Cross Builds.md diff --git a/docs/pages/6 - Extending Mill.md b/docs/pages/7 - Extending Mill.md index 75b7643a..75b7643a 100644 --- a/docs/pages/6 - Extending Mill.md +++ b/docs/pages/7 - Extending Mill.md diff --git a/docs/pages/7 - Mill Internals.md b/docs/pages/8 - Mill Internals.md index 3700c9df..3700c9df 100644 --- a/docs/pages/7 - Mill Internals.md +++ b/docs/pages/8 - Mill Internals.md |