summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorLi Haoyi <haoyi.sg@gmail.com>2018-11-05 03:00:04 +0800
committerLi Haoyi <haoyi.sg@gmail.com>2018-11-05 21:14:58 +0800
commitbc9dc386625021fec517f2dbf0644ccafe1e32c2 (patch)
tree12db6817470708c7aa274aa231ef35eb79f2123a /docs
parent8afe79afe33be68f59f89b8410984e508c3e8d08 (diff)
downloadmill-bc9dc386625021fec517f2dbf0644ccafe1e32c2.tar.gz
mill-bc9dc386625021fec517f2dbf0644ccafe1e32c2.tar.bz2
mill-bc9dc386625021fec517f2dbf0644ccafe1e32c2.zip
WIP migrating over from `ammonite.ops` to `os` module.
__.compile works, haven't run tests yet
Diffstat (limited to 'docs')
-rw-r--r--docs/build.sc20
-rw-r--r--docs/logo.sc2
-rw-r--r--docs/pages/2 - Configuring Mill.md4
-rw-r--r--docs/pages/4 - Tasks.md26
-rw-r--r--docs/pages/9 - Contrib Modules.md2
5 files changed, 27 insertions, 27 deletions
diff --git a/docs/build.sc b/docs/build.sc
index 42a4f141..661aa462 100644
--- a/docs/build.sc
+++ b/docs/build.sc
@@ -4,7 +4,7 @@ import $file.pageStyles, pageStyles._
import $file.pages, pages._
import scalatags.Text.all._
-import ammonite.ops._
+
import collection.JavaConverters._
import org.pegdown.{PegDownProcessor, ToHtmlSerializer, LinkRenderer, Extensions}
import org.pegdown.ast.{VerbatimNode, ExpImageNode, HeaderNode, TextNode, SimpleNode, TableNode}
@@ -134,18 +134,18 @@ def formatRssDate(date: java.time.LocalDate) = {
@main
def main(publish: Boolean = false) = {
- rm! targetFolder
+ os.remove.all! targetFolder
- mkdir! targetFolder/'page
+ os.makeDir.all! targetFolder/'page
for(otherFile <- otherFiles){
- cp(otherFile, targetFolder/'page/(otherFile relativeTo postsFolder))
+ os.copy(otherFile, targetFolder/'page/(otherFile relativeTo postsFolder))
}
- cp(pwd/"favicon.png", targetFolder/"favicon.ico")
- cp(pwd/"logo-white.svg", targetFolder/"logo-white.svg")
- cp(pwd/"VisualizeCompile.svg", targetFolder/"VisualizeCompile.svg")
- cp(pwd/"VisualizeCore.svg", targetFolder/"VisualizeCore.svg")
- cp(pwd/"VisualizePlan.svg", targetFolder/"VisualizePlan.svg")
+ os.copy(pwd/"favicon.png", targetFolder/"favicon.ico")
+ os.copy(pwd/"logo-white.svg", targetFolder/"logo-white.svg")
+ os.copy(pwd/"VisualizeCompile.svg", targetFolder/"VisualizeCompile.svg")
+ os.copy(pwd/"VisualizeCore.svg", targetFolder/"VisualizeCore.svg")
+ os.copy(pwd/"VisualizePlan.svg", targetFolder/"VisualizePlan.svg")
%('zip, "-r", targetFolder/"example-1.zip", "example-1")(pwd)
%('zip, "-r", targetFolder/"example-2.zip", "example-2")(pwd)
@@ -171,7 +171,7 @@ def main(publish: Boolean = false) = {
)
- write(
+ os.write(
if (i == 0) targetFolder / "index.html"
else targetFolder/'page/s"${sanitize(post.name)}.html",
postContent(
diff --git a/docs/logo.sc b/docs/logo.sc
index 5d8cee3b..3464f9a9 100644
--- a/docs/logo.sc
+++ b/docs/logo.sc
@@ -2,7 +2,7 @@ import $ivy.`com.lihaoyi::scalatags:0.6.7`
import scalatags.Text.implicits._
import scalatags.Text.svgTags._
import scalatags.Text.svgAttrs._
-import ammonite.ops._
+
val svgWidth = 24
val svgHeight = 24
diff --git a/docs/pages/2 - Configuring Mill.md b/docs/pages/2 - Configuring Mill.md
index 989272dd..f5a4a24e 100644
--- a/docs/pages/2 - Configuring Mill.md
+++ b/docs/pages/2 - Configuring Mill.md
@@ -291,8 +291,8 @@ object foo extends ScalaModule {
}
def lineCount = T {
- import ammonite.ops._
- foo.sources().flatMap(ref => ls.rec(ref.path)).filter(_.isFile).flatMap(read.lines).size
+
+ foo.sources().flatMap(ref => os.walk(ref.path)).filter(_.isFile).flatMap(read.lines).size
}
def printLineCount() = T.command {
diff --git a/docs/pages/4 - Tasks.md b/docs/pages/4 - Tasks.md
index e8a1c94c..e69ae662 100644
--- a/docs/pages/4 - Tasks.md
+++ b/docs/pages/4 - Tasks.md
@@ -5,22 +5,22 @@ for building Scala.
The following is a simple self-contained example using Mill to compile Java:
```scala
-import ammonite.ops._, mill._
+, mill._
// sourceRoot -> allSources -> classFiles
// |
// v
// resourceRoot ----> jar
-def sourceRoot = T.sources { pwd / 'src }
+def sourceRoot = T.sources { os.pwd / 'src }
-def resourceRoot = T.sources { pwd / 'resources }
+def resourceRoot = T.sources { os.pwd / 'resources }
-def allSources = T { sourceRoot().flatMap(p => ls.rec(p.path)).map(PathRef(_)) }
+def allSources = T { sourceRoot().flatMap(p => os.walk(p.path)).map(PathRef(_)) }
def classFiles = T {
- mkdir(T.ctx().dest)
- import ammonite.ops._
+ os.makeDir.all(T.ctx().dest)
+
%("javac", sources().map(_.path.toString()), "-d", T.ctx().dest)(wd = T.ctx().dest)
PathRef(T.ctx().dest)
}
@@ -28,7 +28,7 @@ def classFiles = T {
def jar = T { Jvm.createJar(Loose.Agg(classFiles().path) ++ resourceRoot().map(_.path)) }
def run(mainClsName: String) = T.command {
- %%('java, "-cp", classFiles().path, mainClsName)
+ os.proc('java, "-cp", classFiles().path, mainClsName).call()
}
```
@@ -78,7 +78,7 @@ There are three primary kinds of *Tasks* that you should care about:
### Targets
```scala
-def allSources = T { ls.rec(sourceRoot().path).map(PathRef(_)) }
+def allSources = T { os.walk(sourceRoot().path).map(PathRef(_)) }
```
`Target`s are defined using the `def foo = T {...}` syntax, and dependencies on
@@ -127,7 +127,7 @@ within a `Module` body.
### Sources
```scala
-def sourceRootPath = pwd / 'src
+def sourceRootPath = os.pwd / 'src
def sourceRoots = T.sources { sourceRootPath }
```
@@ -143,7 +143,7 @@ override-and-extend source lists the same way you would any other `T {...}`
definition:
```scala
-def additionalSources = T.sources { pwd / 'additionalSources }
+def additionalSources = T.sources { os.pwd / 'additionalSources }
def sourceRoots = T.sources { super.sourceRoots() ++ additionalSources() }
```
@@ -151,7 +151,7 @@ def sourceRoots = T.sources { super.sourceRoots() ++ additionalSources() }
```scala
def run(mainClsName: String) = T.command {
- %%('java, "-cp", classFiles().path, mainClsName)
+ os.proc('java, "-cp", classFiles().path, mainClsName).call()
}
```
@@ -288,7 +288,7 @@ affect your build. For example, if I have a [Target](#targets) `bar` that makes
use of the current git version:
```scala
-def bar = T { ... %%("git", "rev-parse", "HEAD").out.string ... }
+def bar = T { ... os.proc("git", "rev-parse", "HEAD").call().out.string ... }
```
`bar` will not know that `git rev-parse` can change, and will
@@ -299,7 +299,7 @@ be out of date!
To fix this, you can wrap your `git rev-parse HEAD` in a `T.input`:
```scala
-def foo = T.input { %%("git", "rev-parse", "HEAD").out.string }
+def foo = T.input { os.proc("git", "rev-parse", "HEAD").call().out.string }
def bar = T { ... foo() ... }
```
diff --git a/docs/pages/9 - Contrib Modules.md b/docs/pages/9 - Contrib Modules.md
index cd02f2c2..e071d59c 100644
--- a/docs/pages/9 - Contrib Modules.md
+++ b/docs/pages/9 - Contrib Modules.md
@@ -244,7 +244,7 @@ object app extends ScalaModule with TwirlModule {
def twirlVersion = "1.3.15"
override def generatedSources = T{
val classes = compileTwirl().classes
- Seq(classes.copy(path = classes.path / up)) // we just move one dir up
+ Seq(classes.copy(path = classes.path / os.up)) // we just move one dir up
}
}
```