diff options
author | Li Haoyi <haoyi.sg@gmail.com> | 2018-01-01 01:25:00 -0800 |
---|---|---|
committer | Li Haoyi <haoyi.sg@gmail.com> | 2018-01-01 10:10:19 -0800 |
commit | 1b406f37c34382be56cb5e5018df744db270d902 (patch) | |
tree | 23537225507f86c8db7835a8e028b2988e6f9463 /scalalib | |
parent | cf5fb5fdfd477e0bb4ffa0e4fec3a8ec01bf5cf1 (diff) | |
download | mill-1b406f37c34382be56cb5e5018df744db270d902.tar.gz mill-1b406f37c34382be56cb5e5018df744db270d902.tar.bz2 mill-1b406f37c34382be56cb5e5018df744db270d902.zip |
Make `forkArgs` work with `run` and `runMain`
Diffstat (limited to 'scalalib')
-rw-r--r-- | scalalib/src/main/scala/mill/scalalib/Module.scala | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/scalalib/src/main/scala/mill/scalalib/Module.scala b/scalalib/src/main/scala/mill/scalalib/Module.scala index c444aeaa..453a25df 100644 --- a/scalalib/src/main/scala/mill/scalalib/Module.scala +++ b/scalalib/src/main/scala/mill/scalalib/Module.scala @@ -25,7 +25,7 @@ trait TestModule extends Module with TaskModule { def testFramework: T[String] def forkWorkingDir = ammonite.ops.pwd - def forkArgs = T{ Seq.empty[String] } + def forkTest(args: String*) = T.command{ mkdir(T.ctx().dest) val outputPath = T.ctx().dest/"out.json" @@ -253,13 +253,23 @@ trait Module extends mill.Module with TaskModule { outer => createJar(Seq(sources(), resources()).map(_.path).filter(exists))(T.ctx().dest / "sources.jar") } + def forkArgs = T{ Seq.empty[String] } + def run() = T.command{ - val main = mainClass().getOrElse(throw new RuntimeException("No mainClass provided!")) - subprocess(main, runDepClasspath().map(_.path) :+ compile().classes.path) + subprocess( + mainClass().getOrElse(throw new RuntimeException("No mainClass provided!")), + runDepClasspath().map(_.path) :+ compile().classes.path, + forkArgs(), + workingDir = ammonite.ops.pwd) } def runMain(mainClass: String) = T.command{ - subprocess(mainClass, runDepClasspath().map(_.path) :+ compile().classes.path) + subprocess( + mainClass, + runDepClasspath().map(_.path) :+ compile().classes.path, + forkArgs(), + workingDir = ammonite.ops.pwd + ) } def console() = T.command{ |