diff options
-rwxr-xr-x | build.sc | 15 | ||||
-rw-r--r-- | docs/pages/1 - Intro to Mill.md | 6 | ||||
-rw-r--r-- | readme.md | 21 | ||||
-rw-r--r-- | scalalib/src/mill/scalalib/ScalaModule.scala | 13 |
4 files changed, 46 insertions, 9 deletions
@@ -212,8 +212,21 @@ def devAssembly = T{ ) } +def dev(args: String*) = T.command{ + mill.modules.Jvm.interactiveSubprocess( + "mill.Main", + Agg.from(assemblyClasspath().flatten.map(_.path)), + jvmArgs = scalalib.testArgs() ++ scalajslib.testArgs() ++ scalaworker.testArgs(), + mainArgs = args, + workingDir = pwd + ) +} + def releaseAssembly = T{ - assemblyBase(Agg.from(assemblyClasspath().flatten.map(_.path)), "-DMILL_VERSION=" + publishVersion()._2) + assemblyBase( + Agg.from(assemblyClasspath().flatten.map(_.path)), + "-DMILL_VERSION=" + publishVersion()._2 + ) } val isMasterCommit = { diff --git a/docs/pages/1 - Intro to Mill.md b/docs/pages/1 - Intro to Mill.md index 237c7cad..27c58740 100644 --- a/docs/pages/1 - Intro to Mill.md +++ b/docs/pages/1 - Intro to Mill.md @@ -71,7 +71,11 @@ $ mill foo.run # run the main method, if any $ mill foo.jar # bundle the classfiles into a jar -$ mill foo.assembly # bundle classfiles and all dependencies into a jar +$ mill foo.assembly # bundle classfiles and all dependencies into a jar + +$ mill foo.console # start a Scala console within your project + +$ mill foo.repl # start an Ammonite REPL within your project ``` You can run `mill resolve __` to see a full list of the different tasks that are @@ -24,12 +24,14 @@ Run unit test suite: ```bash sbt main/test +mill main.test ``` Build a standalone executable jar: ```bash sbt bin/test:assembly +mill devAssembly ``` Now you can re-build this very same project using the build.sc file, e.g. re-run @@ -38,25 +40,28 @@ core unit tests e.g.: ```bash ./target/bin/mill core.compile -./target/bin/mill main.test.compile -./target/bin/mill main.test -./target/bin/mill scalalib.assembly + +./out/devAssembly/dest/mill core.compile +./out/devAssembly/dest/mill main.test.compile +./out/devAssembly/dest/mill main.test +./out/devAssembly/dest/mill scalalib.assembly ``` There is already a `watch` option that looks for changes on files, e.g.: ```bash ./target/bin/mill --watch core.compile +./out/devAssembly/dest/mill --watch core.compile ``` You can get Mill to show the JSON-structured output for a particular `Target` or `Command` using the `show` flag: ```bash -./target/bin/mill show core.scalaVersion -./target/bin/mill show core.compile -./target/bin/mill show core.assemblyClasspath -./target/bin/mill show main.test +./out/devAssembly/dest/mill show core.scalaVersion +./out/devAssembly/dest/mill show core.compile +./out/devAssembly/dest/mill show core.assemblyClasspath +./out/devAssembly/dest/mill show main.test ``` Output will be generated into a the `./out` folder. @@ -68,6 +73,8 @@ it via: ```bash sbt "~bin/test:run main.test" sbt "~bin/test:run" +mill --watch dev main.test +mill --watch dev ``` Lastly, you can generate IntelliJ Scala project files using Mill via diff --git a/scalalib/src/mill/scalalib/ScalaModule.scala b/scalalib/src/mill/scalalib/ScalaModule.scala index b031aa74..f1910103 100644 --- a/scalalib/src/mill/scalalib/ScalaModule.scala +++ b/scalalib/src/mill/scalalib/ScalaModule.scala @@ -251,6 +251,19 @@ trait ScalaModule extends mill.Module with TaskModule { outer => ) } + def ammoniteReplClasspath = T{ + resolveDeps(T.task{Agg(ivy"com.lihaoyi:::ammonite:1.0.3")})() + } + def repl() = T.command{ + + Jvm.interactiveSubprocess( + mainClass = "ammonite.Main", + classPath = runClasspath().map(_.path) ++ ammoniteReplClasspath().map(_.path), + mainArgs = Nil, + workingDir = pwd + ) + } + // publish artifact with name "mill_2.12.4" instead of "mill_2.12" def crossFullScalaVersion: T[Boolean] = false |