From f747228b08016723d1289bb09a278ff3cc25ed94 Mon Sep 17 00:00:00 2001 From: André Duarte Date: Sat, 25 Nov 2017 19:42:22 +0000 Subject: Allow the definition of a prependShellScript in a ScalaModule (#13) --- scalaplugin/src/main/scala/mill/scalaplugin/ScalaModule.scala | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'scalaplugin') 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) } -- cgit v1.2.3