summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLi Haoyi <haoyi.sg@gmail.com>2018-01-01 01:25:00 -0800
committerLi Haoyi <haoyi.sg@gmail.com>2018-01-01 10:10:19 -0800
commit1b406f37c34382be56cb5e5018df744db270d902 (patch)
tree23537225507f86c8db7835a8e028b2988e6f9463
parentcf5fb5fdfd477e0bb4ffa0e4fec3a8ec01bf5cf1 (diff)
downloadmill-1b406f37c34382be56cb5e5018df744db270d902.tar.gz
mill-1b406f37c34382be56cb5e5018df744db270d902.tar.bz2
mill-1b406f37c34382be56cb5e5018df744db270d902.zip
Make `forkArgs` work with `run` and `runMain`
-rwxr-xr-xbuild.sc1
-rw-r--r--scalalib/src/main/scala/mill/scalalib/Module.scala18
2 files changed, 15 insertions, 4 deletions
diff --git a/build.sc b/build.sc
index 1528cf10..4b8b8282 100755
--- a/build.sc
+++ b/build.sc
@@ -192,6 +192,7 @@ object integration extends MillModule{
def testArgs = T{
for((k, v) <- testRepos()) yield s"-D$k=$v"
}
+ def forkArgs() = testArgs()
}
val assemblyProjects = Seq(scalalib, scalajslib)
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{