summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorLi Haoyi <haoyi.sg@gmail.com>2018-02-17 11:50:20 -0800
committerLi Haoyi <haoyi.sg@gmail.com>2018-02-17 11:53:07 -0800
commit92edcae5094e52783f825021e4172a6b072300e0 (patch)
tree8da5d9e01a9703601ef13c8ee5478501251b6836 /docs
parent650ab9c937159cd31721e576f7174c8167f19a70 (diff)
downloadmill-92edcae5094e52783f825021e4172a6b072300e0.tar.gz
mill-92edcae5094e52783f825021e4172a6b072300e0.tar.bz2
mill-92edcae5094e52783f825021e4172a6b072300e0.zip
Include example zips in docs
Diffstat (limited to 'docs')
-rw-r--r--docs/build.sc6
-rw-r--r--docs/example-1/build.sc6
-rw-r--r--docs/example-1/foo/src/foo/Example.scala6
-rw-r--r--docs/example-2/build.sc23
-rw-r--r--docs/example-2/foo/src/foo/Example.scala6
-rw-r--r--docs/pages/1 - Intro to Mill.md11
-rw-r--r--docs/pages/2 - Configuring Mill.md7
-rw-r--r--docs/pages/3 - Tasks.md4
-rw-r--r--docs/pages/6 - Extending Mill.md6
9 files changed, 71 insertions, 4 deletions
diff --git a/docs/build.sc b/docs/build.sc
index 7c5ff442..0d936d3c 100644
--- a/docs/build.sc
+++ b/docs/build.sc
@@ -141,9 +141,11 @@ def main(publish: Boolean = false) = {
cp(otherFile, targetFolder/'page/(otherFile relativeTo postsFolder))
}
- cp(cwd/"favicon.png", targetFolder/"favicon.ico")
- cp(cwd/"logo-white.svg", targetFolder/"logo-white.svg")
+ cp(pwd/"favicon.png", targetFolder/"favicon.ico")
+ cp(pwd/"logo-white.svg", targetFolder/"logo-white.svg")
+ %('zip, "-r", targetFolder/"example-1.zip", "example-1")(pwd)
+ %('zip, "-r", targetFolder/"example-2.zip", "example-2")(pwd)
for(i <- posts.indices){
val post = posts(i)
diff --git a/docs/example-1/build.sc b/docs/example-1/build.sc
new file mode 100644
index 00000000..fa3b5d29
--- /dev/null
+++ b/docs/example-1/build.sc
@@ -0,0 +1,6 @@
+// build.sc
+import mill._, scalalib._
+
+object foo extends ScalaModule{
+ def scalaVersion = "2.12.4"
+} \ No newline at end of file
diff --git a/docs/example-1/foo/src/foo/Example.scala b/docs/example-1/foo/src/foo/Example.scala
new file mode 100644
index 00000000..f84f91f9
--- /dev/null
+++ b/docs/example-1/foo/src/foo/Example.scala
@@ -0,0 +1,6 @@
+package foo
+object Example{
+ def main(args: Array[String]): Unit = {
+ println("Hello World")
+ }
+} \ No newline at end of file
diff --git a/docs/example-2/build.sc b/docs/example-2/build.sc
new file mode 100644
index 00000000..30e4be05
--- /dev/null
+++ b/docs/example-2/build.sc
@@ -0,0 +1,23 @@
+// build.sc
+import mill._, scalalib._, publish._
+
+object foo extends PublishModule{
+ def scalaVersion = "2.12.4"
+ def publishVersion = "0.0.1"
+
+ def pomSettings = PomSettings(
+ description = "Hello",
+ organization = "com.lihaoyi",
+ url = "https://github.com/lihaoyi/example",
+ licenses = Seq(
+ License("MIT license", "http://www.opensource.org/licenses/mit-license.php")
+ ),
+ scm = SCM(
+ "git://github.com/lihaoyi/example.git",
+ "scm:git://github.com/lihaoyi/example.git"
+ ),
+ developers = Seq(
+ Developer("lihaoyi", "Li Haoyi","https://github.com/lihaoyi")
+ )
+ )
+} \ No newline at end of file
diff --git a/docs/example-2/foo/src/foo/Example.scala b/docs/example-2/foo/src/foo/Example.scala
new file mode 100644
index 00000000..f84f91f9
--- /dev/null
+++ b/docs/example-2/foo/src/foo/Example.scala
@@ -0,0 +1,6 @@
+package foo
+object Example{
+ def main(args: Array[String]): Unit = {
+ println("Hello World")
+ }
+} \ No newline at end of file
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: