summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLi Haoyi <haoyi.sg@gmail.com>2019-06-29 22:28:16 -0700
committerLi Haoyi <haoyi.sg@gmail.com>2019-06-30 02:54:39 -0700
commit4896f5150ff0f7386a573b7191cfb652ed42a047 (patch)
tree3611d90bfb0e918c0c5e10f3dc1eab11fe09d07c
parent29fc3b6c8f74ece3b6e6cf354f0e342bbf8511ac (diff)
downloadcask-4896f5150ff0f7386a573b7191cfb652ed42a047.tar.gz
cask-4896f5150ff0f7386a573b7191cfb652ed42a047.tar.bz2
cask-4896f5150ff0f7386a573b7191cfb652ed42a047.zip
upgrade Mill to latest version
-rw-r--r--.travis.yml5
-rw-r--r--build.sc43
-rwxr-xr-xci/release.sh4
-rwxr-xr-xci/test.sh2
-rw-r--r--docs/pages/1 - Cask: a Scala HTTP micro-framework.md14
-rw-r--r--example/compress/build.sc3
-rw-r--r--example/compress2/build.sc3
-rw-r--r--example/compress3/build.sc3
-rw-r--r--example/cookies/build.sc3
-rw-r--r--example/decorated/build.sc3
-rw-r--r--example/decorated2/build.sc3
-rw-r--r--example/endpoints/build.sc3
-rw-r--r--example/formJsonPost/build.sc3
-rw-r--r--example/httpMethods/build.sc3
-rw-r--r--example/minimalApplication/build.sc3
-rw-r--r--example/minimalApplication2/build.sc3
-rw-r--r--example/redirectAbort/build.sc3
-rw-r--r--example/scalatags/build.sc2
-rw-r--r--example/staticFiles/build.sc3
-rw-r--r--example/todo/build.sc2
-rw-r--r--example/todoApi/build.sc3
-rw-r--r--example/todoDb/build.sc2
-rw-r--r--example/twirl/build.sc2
-rw-r--r--example/variableRoutes/build.sc3
-rw-r--r--example/websockets/build.sc3
-rwxr-xr-xmill31
26 files changed, 64 insertions, 91 deletions
diff --git a/.travis.yml b/.travis.yml
index 1d6651c..491dded 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -19,11 +19,6 @@ matrix:
env: CI_SCRIPT="ci/on-master.py ci/publish-docs.sh"
jdk: oraclejdk8
-script:
- - curl -L -o ~/bin/mill https://github.com/lihaoyi/mill/releases/download/0.4.1/0.4.1-4-158d11 && chmod +x ~/bin/mill
- - export PATH=~/bin/mill:$PATH
- - "$CI_SCRIPT"
-
cache:
directories:
- $HOME/.coursier
diff --git a/build.sc b/build.sc
index b7f3ed1..3535ba9 100644
--- a/build.sc
+++ b/build.sc
@@ -1,5 +1,5 @@
import mill._, scalalib._, publish._
-import ammonite.ops._, ujson.Js
+
import $file.ci.upload, $file.ci.version
import $file.example.compress.build
import $file.example.compress2.build
@@ -59,7 +59,7 @@ object cask extends ScalaModule with PublishModule {
}
object example extends Module{
trait LocalModule extends ScalaModule{
- def ivyDeps = super.ivyDeps().filter(_ != ivy"com.lihaoyi::cask:0.1.9")
+ def ivyDeps = super.ivyDeps().filter(_ != ivy"com.lihaoyi::cask:0.2.1")
override def millSourcePath = super.millSourcePath / "app"
def moduleDeps = Seq(cask)
@@ -96,7 +96,7 @@ def uploadToGithub(authKey: String) = T.command{
requests.post(
"https://api.github.com/repos/lihaoyi/cask/releases",
data = ujson.write(
- Js.Obj(
+ ujson.Obj(
"tag_name" -> releaseTag,
"name" -> releaseTag
)
@@ -130,30 +130,25 @@ def uploadToGithub(authKey: String) = T.command{
for(example <- examples){
val f = T.ctx().dest
val last = example.last + "-" + label
- cp(example, f/last)
- write.over(
- f/last/"cask",
- """#!/usr/bin/env bash
- |
- |if [ ! -f out/mill-cask ]; then
- | echo "Initializing Cask/Mill build tool for the first time"
- | mkdir -p out &&
- | (echo "#!/usr/bin/env sh" && curl -L https://github.com/lihaoyi/mill/releases/download/0.4.1/0.4.1-4-158d11) > out/mill-cask
- |fi
- |
- |chmod +x out/mill-cask
- |"$(pwd)"/out/mill-cask "$@"
- """.stripMargin
+ os.copy(example, f / last)
+ os.write.over(
+ f / last / "mill",
+ os.read(os.pwd / "mill")
)
- %%("chmod", "+x", f/last/"cask")(f/last)
- write.over(
- f/last/"build.sc",
- read(f/last/"build.sc").replace("trait AppModule ", "object app ")
+ os.proc("chmod", "+x", f/last/"mill").call(f/last)
+ os.write.over(
+ f / last / "build.sc",
+ os.read(f / last / "build.sc")
+ .replace("trait AppModule ", "object app ")
+ .replace(
+ "object test",
+ "def ivyDeps = Agg(ivy\"com.lihaoyi::cask:" + releaseTag + "\")\n object test"
+ )
)
- rm(f/"out.zip")
- %%("zip", "-r", f/"out.zip", last)(f)
- upload.apply(f/"out.zip", releaseTag, last + ".zip", authKey)
+ os.remove(f / "out.zip")
+ os.proc("zip", "-r", f / "out.zip", last).call(f)
+ upload.apply(f / "out.zip", releaseTag, last + ".zip", authKey)
}
}
diff --git a/ci/release.sh b/ci/release.sh
index 7adbcbb..f6e5641 100755
--- a/ci/release.sh
+++ b/ci/release.sh
@@ -8,7 +8,7 @@ gpg --import gpg_key
rm gpg_key
-mill -i mill.scalalib.PublishModule/publishAll \
+./mill -i mill.scalalib.PublishModule/publishAll \
lihaoyi:$SONATYPE_PASSWORD \
$GPG_PASSWORD \
--signed true \
@@ -16,4 +16,4 @@ mill -i mill.scalalib.PublishModule/publishAll \
--release true
-mill uploadToGithub $GITHUB_ACCESS_TOKEN
+./mill uploadToGithub $GITHUB_ACCESS_TOKEN
diff --git a/ci/test.sh b/ci/test.sh
index 3c955b9..3b25542 100755
--- a/ci/test.sh
+++ b/ci/test.sh
@@ -2,4 +2,4 @@
set -eux
-mill -i --disable-ticker __.testLocal \ No newline at end of file
+./mill -i --disable-ticker __.testLocal \ No newline at end of file
diff --git a/docs/pages/1 - Cask: a Scala HTTP micro-framework.md b/docs/pages/1 - Cask: a Scala HTTP micro-framework.md
index e7e72b5..093c8c3 100644
--- a/docs/pages/1 - Cask: a Scala HTTP micro-framework.md
+++ b/docs/pages/1 - Cask: a Scala HTTP micro-framework.md
@@ -37,7 +37,7 @@ app/test/src/ExampleTests.scala
- `cd` into the folder, and run
```bash
-./cask -w app.runBackground
+./mill -w app.runBackground
```
This will server up the Cask application on `http://localhost:8080`. You can
@@ -64,13 +64,13 @@ These HTTP calls are part of the test suite for the example project, which you
can run using:
```bash
-./cask -w app.test
+./mill -w app.test
```
To configure your Cask application to work with IntelliJ, you can use:
```bash
-./cask mill.scalalib.GenIdea/idea
+./mill mill.scalalib.GenIdea/idea
```
This will need to be re-run when you re-configure your `build.sc` file, e.g.
@@ -87,16 +87,16 @@ ivy"com.lihaoyi::cask:0.1.9"
"com.lihaoyi" %% "cask" % "0.1.9"
```
-The `./cask` command is just a wrapper around the
+The `./mill` command is just a wrapper around the
[Mill build tool](http://www.lihaoyi.com/mill/); the `build.sc` files you see in
all examples are Mill build files, and you can use your own installation of Mill
-instead of `./cask` if you wish. All normal Mill commands and functionality
-works for `./cask`.
+instead of `./mill` if you wish. All normal Mill commands and functionality
+works for `./mill`.
The following examples will walk you through how to use Cask to accomplish tasks
common to anyone writing a web application. Each example comes with a
downloadable example project with code and unit tests, which you can use via the
-same `./cask -w app.runBackground` or `./cask -w app.test` workflows we saw above.
+same `./mill -w app.runBackground` or `./mill -w app.test` workflows we saw above.
## Minimal Example
diff --git a/example/compress/build.sc b/example/compress/build.sc
index 699b94f..e6167a8 100644
--- a/example/compress/build.sc
+++ b/example/compress/build.sc
@@ -3,9 +3,6 @@ import mill._, scalalib._
trait AppModule extends ScalaModule{
def scalaVersion = "2.13.0"
- def ivyDeps = Agg(
- ivy"com.lihaoyi::cask:0.1.9",
- )
object test extends Tests{
def testFrameworks = Seq("utest.runner.Framework")
diff --git a/example/compress2/build.sc b/example/compress2/build.sc
index 699b94f..e6167a8 100644
--- a/example/compress2/build.sc
+++ b/example/compress2/build.sc
@@ -3,9 +3,6 @@ import mill._, scalalib._
trait AppModule extends ScalaModule{
def scalaVersion = "2.13.0"
- def ivyDeps = Agg(
- ivy"com.lihaoyi::cask:0.1.9",
- )
object test extends Tests{
def testFrameworks = Seq("utest.runner.Framework")
diff --git a/example/compress3/build.sc b/example/compress3/build.sc
index 699b94f..e6167a8 100644
--- a/example/compress3/build.sc
+++ b/example/compress3/build.sc
@@ -3,9 +3,6 @@ import mill._, scalalib._
trait AppModule extends ScalaModule{
def scalaVersion = "2.13.0"
- def ivyDeps = Agg(
- ivy"com.lihaoyi::cask:0.1.9",
- )
object test extends Tests{
def testFrameworks = Seq("utest.runner.Framework")
diff --git a/example/cookies/build.sc b/example/cookies/build.sc
index 699b94f..e6167a8 100644
--- a/example/cookies/build.sc
+++ b/example/cookies/build.sc
@@ -3,9 +3,6 @@ import mill._, scalalib._
trait AppModule extends ScalaModule{
def scalaVersion = "2.13.0"
- def ivyDeps = Agg(
- ivy"com.lihaoyi::cask:0.1.9",
- )
object test extends Tests{
def testFrameworks = Seq("utest.runner.Framework")
diff --git a/example/decorated/build.sc b/example/decorated/build.sc
index 699b94f..e6167a8 100644
--- a/example/decorated/build.sc
+++ b/example/decorated/build.sc
@@ -3,9 +3,6 @@ import mill._, scalalib._
trait AppModule extends ScalaModule{
def scalaVersion = "2.13.0"
- def ivyDeps = Agg(
- ivy"com.lihaoyi::cask:0.1.9",
- )
object test extends Tests{
def testFrameworks = Seq("utest.runner.Framework")
diff --git a/example/decorated2/build.sc b/example/decorated2/build.sc
index 699b94f..e6167a8 100644
--- a/example/decorated2/build.sc
+++ b/example/decorated2/build.sc
@@ -3,9 +3,6 @@ import mill._, scalalib._
trait AppModule extends ScalaModule{
def scalaVersion = "2.13.0"
- def ivyDeps = Agg(
- ivy"com.lihaoyi::cask:0.1.9",
- )
object test extends Tests{
def testFrameworks = Seq("utest.runner.Framework")
diff --git a/example/endpoints/build.sc b/example/endpoints/build.sc
index 699b94f..e6167a8 100644
--- a/example/endpoints/build.sc
+++ b/example/endpoints/build.sc
@@ -3,9 +3,6 @@ import mill._, scalalib._
trait AppModule extends ScalaModule{
def scalaVersion = "2.13.0"
- def ivyDeps = Agg(
- ivy"com.lihaoyi::cask:0.1.9",
- )
object test extends Tests{
def testFrameworks = Seq("utest.runner.Framework")
diff --git a/example/formJsonPost/build.sc b/example/formJsonPost/build.sc
index 699b94f..e6167a8 100644
--- a/example/formJsonPost/build.sc
+++ b/example/formJsonPost/build.sc
@@ -3,9 +3,6 @@ import mill._, scalalib._
trait AppModule extends ScalaModule{
def scalaVersion = "2.13.0"
- def ivyDeps = Agg(
- ivy"com.lihaoyi::cask:0.1.9",
- )
object test extends Tests{
def testFrameworks = Seq("utest.runner.Framework")
diff --git a/example/httpMethods/build.sc b/example/httpMethods/build.sc
index 699b94f..e6167a8 100644
--- a/example/httpMethods/build.sc
+++ b/example/httpMethods/build.sc
@@ -3,9 +3,6 @@ import mill._, scalalib._
trait AppModule extends ScalaModule{
def scalaVersion = "2.13.0"
- def ivyDeps = Agg(
- ivy"com.lihaoyi::cask:0.1.9",
- )
object test extends Tests{
def testFrameworks = Seq("utest.runner.Framework")
diff --git a/example/minimalApplication/build.sc b/example/minimalApplication/build.sc
index 699b94f..e6167a8 100644
--- a/example/minimalApplication/build.sc
+++ b/example/minimalApplication/build.sc
@@ -3,9 +3,6 @@ import mill._, scalalib._
trait AppModule extends ScalaModule{
def scalaVersion = "2.13.0"
- def ivyDeps = Agg(
- ivy"com.lihaoyi::cask:0.1.9",
- )
object test extends Tests{
def testFrameworks = Seq("utest.runner.Framework")
diff --git a/example/minimalApplication2/build.sc b/example/minimalApplication2/build.sc
index 699b94f..e6167a8 100644
--- a/example/minimalApplication2/build.sc
+++ b/example/minimalApplication2/build.sc
@@ -3,9 +3,6 @@ import mill._, scalalib._
trait AppModule extends ScalaModule{
def scalaVersion = "2.13.0"
- def ivyDeps = Agg(
- ivy"com.lihaoyi::cask:0.1.9",
- )
object test extends Tests{
def testFrameworks = Seq("utest.runner.Framework")
diff --git a/example/redirectAbort/build.sc b/example/redirectAbort/build.sc
index 699b94f..e6167a8 100644
--- a/example/redirectAbort/build.sc
+++ b/example/redirectAbort/build.sc
@@ -3,9 +3,6 @@ import mill._, scalalib._
trait AppModule extends ScalaModule{
def scalaVersion = "2.13.0"
- def ivyDeps = Agg(
- ivy"com.lihaoyi::cask:0.1.9",
- )
object test extends Tests{
def testFrameworks = Seq("utest.runner.Framework")
diff --git a/example/scalatags/build.sc b/example/scalatags/build.sc
index c89d9cc..23fea76 100644
--- a/example/scalatags/build.sc
+++ b/example/scalatags/build.sc
@@ -4,7 +4,7 @@ import mill._, scalalib._
trait AppModule extends ScalaModule{
def scalaVersion = "2.13.0"
def ivyDeps = Agg(
- ivy"com.lihaoyi::cask:0.1.9",
+ ivy"com.lihaoyi::cask:0.2.1",
ivy"com.lihaoyi::scalatags:0.7.0",
)
diff --git a/example/staticFiles/build.sc b/example/staticFiles/build.sc
index 911f989..6f84dac 100644
--- a/example/staticFiles/build.sc
+++ b/example/staticFiles/build.sc
@@ -3,9 +3,6 @@ import mill._, scalalib._
trait AppModule extends ScalaModule{
def scalaVersion = "2.13.0"
- def ivyDeps = Agg(
- ivy"com.lihaoyi::cask:0.1.9",
- )
def forkWorkingDir = build.millSourcePath
diff --git a/example/todo/build.sc b/example/todo/build.sc
index 782aaef..2491af7 100644
--- a/example/todo/build.sc
+++ b/example/todo/build.sc
@@ -4,7 +4,7 @@ import mill._, scalalib._
trait AppModule extends ScalaModule{
def scalaVersion = "2.13.0"
def ivyDeps = Agg(
- ivy"com.lihaoyi::cask:0.1.9",
+ ivy"com.lihaoyi::cask:0.2.1",
ivy"org.xerial:sqlite-jdbc:3.18.0",
ivy"io.getquill::quill-jdbc:2.5.4",
ivy"com.lihaoyi::scalatags:0.7.0",
diff --git a/example/todoApi/build.sc b/example/todoApi/build.sc
index 699b94f..e6167a8 100644
--- a/example/todoApi/build.sc
+++ b/example/todoApi/build.sc
@@ -3,9 +3,6 @@ import mill._, scalalib._
trait AppModule extends ScalaModule{
def scalaVersion = "2.13.0"
- def ivyDeps = Agg(
- ivy"com.lihaoyi::cask:0.1.9",
- )
object test extends Tests{
def testFrameworks = Seq("utest.runner.Framework")
diff --git a/example/todoDb/build.sc b/example/todoDb/build.sc
index ab1181e..f9b3692 100644
--- a/example/todoDb/build.sc
+++ b/example/todoDb/build.sc
@@ -4,7 +4,7 @@ import mill._, scalalib._
trait AppModule extends ScalaModule{
def scalaVersion = "2.13.0"
def ivyDeps = Agg(
- ivy"com.lihaoyi::cask:0.1.9",
+ ivy"com.lihaoyi::cask:0.2.1",
ivy"org.xerial:sqlite-jdbc:3.18.0",
ivy"io.getquill::quill-jdbc:2.5.4"
)
diff --git a/example/twirl/build.sc b/example/twirl/build.sc
index b8e1746..f88bfc6 100644
--- a/example/twirl/build.sc
+++ b/example/twirl/build.sc
@@ -7,7 +7,7 @@ trait AppModule extends ScalaModule with mill.twirllib.TwirlModule{
def generatedSources = T{ Seq(compileTwirl().classes) }
def ivyDeps = Agg(
- ivy"com.lihaoyi::cask:0.1.9",
+ ivy"com.lihaoyi::cask:0.2.1",
ivy"com.lihaoyi::scalatags:0.7.0",
ivy"com.typesafe.play::twirl-api:${twirlVersion()}",
)
diff --git a/example/variableRoutes/build.sc b/example/variableRoutes/build.sc
index 699b94f..e6167a8 100644
--- a/example/variableRoutes/build.sc
+++ b/example/variableRoutes/build.sc
@@ -3,9 +3,6 @@ import mill._, scalalib._
trait AppModule extends ScalaModule{
def scalaVersion = "2.13.0"
- def ivyDeps = Agg(
- ivy"com.lihaoyi::cask:0.1.9",
- )
object test extends Tests{
def testFrameworks = Seq("utest.runner.Framework")
diff --git a/example/websockets/build.sc b/example/websockets/build.sc
index 31f75f5..e36e1b7 100644
--- a/example/websockets/build.sc
+++ b/example/websockets/build.sc
@@ -3,9 +3,6 @@ import mill._, scalalib._
trait AppModule extends ScalaModule{
def scalaVersion = "2.13.0"
- def ivyDeps = Agg(
- ivy"com.lihaoyi::cask:0.1.9",
- )
object test extends Tests{
def testFrameworks = Seq("utest.runner.Framework")
diff --git a/mill b/mill
new file mode 100755
index 0000000..874c26e
--- /dev/null
+++ b/mill
@@ -0,0 +1,31 @@
+#!/usr/bin/env sh
+
+# This is a wrapper script, that automatically download mill from GitHub release pages
+# You can give the required mill version with MILL_VERSION env variable
+# If no version is given, it falls back to the value of DEFAULT_MILL_VERSION
+DEFAULT_MILL_VERSION=0.4.2
+
+set -e
+
+if [ -z "$MILL_VERSION" ] ; then
+ MILL_VERSION=$DEFAULT_MILL_VERSION
+fi
+
+MILL_DOWNLOAD_PATH="$HOME/.mill/download"
+MILL_EXEC_PATH="${MILL_DOWNLOAD_PATH}/$MILL_VERSION"
+
+if [ ! -x "$MILL_EXEC_PATH" ] ; then
+ mkdir -p $MILL_DOWNLOAD_PATH
+ DOWNLOAD_FILE=$MILL_EXEC_PATH-tmp-download
+ MILL_DOWNLOAD_URL="https://github.com/lihaoyi/mill/releases/download/${MILL_VERSION%%-*}/$MILL_VERSION"
+ curl --fail -L -o "$DOWNLOAD_FILE" "$MILL_DOWNLOAD_URL"
+ chmod +x "$DOWNLOAD_FILE"
+ mv "$DOWNLOAD_FILE" "$MILL_EXEC_PATH"
+ unset DOWNLOAD_FILE
+ unset MILL_DOWNLOAD_URL
+fi
+
+unset MILL_DOWNLOAD_PATH
+unset MILL_VERSION
+
+exec $MILL_EXEC_PATH "$@"