summaryrefslogtreecommitdiff
path: root/scalaplugin/src/main
diff options
context:
space:
mode:
authorAndré Duarte <atduarte@users.noreply.github.com>2017-11-25 19:42:22 +0000
committerLi Haoyi <haoyi.sg@gmail.com>2017-11-25 11:42:22 -0800
commitf747228b08016723d1289bb09a278ff3cc25ed94 (patch)
treec59916f72931d0bb179f631c41f531017398f10d /scalaplugin/src/main
parentff852a7a7602030b57af6f7fa499742b5c76d771 (diff)
downloadmill-f747228b08016723d1289bb09a278ff3cc25ed94.tar.gz
mill-f747228b08016723d1289bb09a278ff3cc25ed94.tar.bz2
mill-f747228b08016723d1289bb09a278ff3cc25ed94.zip
Allow the definition of a prependShellScript in a ScalaModule (#13)
Diffstat (limited to 'scalaplugin/src/main')
-rw-r--r--scalaplugin/src/main/scala/mill/scalaplugin/ScalaModule.scala10
1 files changed, 9 insertions, 1 deletions
diff --git a/scalaplugin/src/main/scala/mill/scalaplugin/ScalaModule.scala b/scalaplugin/src/main/scala/mill/scalaplugin/ScalaModule.scala
index 5a1f261a..2e842a6e 100644
--- a/scalaplugin/src/main/scala/mill/scalaplugin/ScalaModule.scala
+++ b/scalaplugin/src/main/scala/mill/scalaplugin/ScalaModule.scala
@@ -159,6 +159,11 @@ object ScalaModule{
def scalaRuntimeIvyDeps(scalaVersion: String) = Seq[Dep](
Dep.Java("org.scala-lang", "scala-library", scalaVersion)
)
+
+ val DefaultShellScript: Seq[String] = Seq(
+ "#!/usr/bin/env sh",
+ "exec java -jar \"$0\" \"$@\""
+ )
}
import ScalaModule._
trait TestScalaModule extends ScalaModule with TaskModule{
@@ -247,6 +252,8 @@ trait ScalaModule extends Module{ outer =>
)
}
+ def prependShellScript: T[String] = T{ "" }
+
def sources = T.source{ basePath / 'src }
def resources = T.source{ basePath / 'resources }
def compile = T.persistent{
@@ -256,7 +263,8 @@ trait ScalaModule extends Module{ outer =>
val dest = T.ctx().dest
createAssembly(
dest,
- (runDepClasspath().filter(_.path.ext != "pom") ++ Seq(resources(), compile())).map(_.path).filter(exists)
+ (runDepClasspath().filter(_.path.ext != "pom") ++ Seq(resources(), compile())).map(_.path).filter(exists),
+ prependShellScript = prependShellScript()
)
PathRef(dest)
}