From 23ea3ff6fa6319e1c38c8a5d517b81b7f9c5ab31 Mon Sep 17 00:00:00 2001 From: Alexandre Archambault Date: Tue, 14 Mar 2017 15:39:00 +0100 Subject: [PATCH 1/2] Add echo application Simply echoes its arguments - for testing purposes --- build.sbt | 6 +++++- echo/src/main/scala/coursier/echo/Echo.scala | 5 +++++ 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 echo/src/main/scala/coursier/echo/Echo.scala diff --git a/build.sbt b/build.sbt index 359195a98..63b408adb 100644 --- a/build.sbt +++ b/build.sbt @@ -479,6 +479,9 @@ lazy val okhttp = project ) ) +lazy val echo = project + .settings(commonSettings) + lazy val jvm = project .aggregate( coreJvm, @@ -491,7 +494,8 @@ lazy val jvm = project `sbt-launcher`, doc, `http-server`, - okhttp + okhttp, + echo ) .settings(commonSettings) .settings(noPublishSettings) diff --git a/echo/src/main/scala/coursier/echo/Echo.scala b/echo/src/main/scala/coursier/echo/Echo.scala new file mode 100644 index 000000000..60ab2894e --- /dev/null +++ b/echo/src/main/scala/coursier/echo/Echo.scala @@ -0,0 +1,5 @@ + +object Echo { + def main(args: Array[String]): Unit = + println(args.mkString(" ")) +} From 11a1e509b5d4d6ed23197074fbdea4ebdf579779 Mon Sep 17 00:00:00 2001 From: Alexandre Archambault Date: Tue, 14 Mar 2017 15:39:01 +0100 Subject: [PATCH 2/2] Allow proguarded jar to be launched straightaway With the right bash header --- build.sbt | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/build.sbt b/build.sbt index 63b408adb..c1098311f 100644 --- a/build.sbt +++ b/build.sbt @@ -230,6 +230,17 @@ lazy val cli = project }, packExcludeArtifactTypes += "pom", resourceGenerators in Compile += packageBin.in(bootstrap).in(Compile).map { jar => + import java.nio.file.Files + import java.nio.charset.StandardCharsets + + val content = Files.readAllBytes(jar.toPath) + val header = + """#!/usr/bin/env sh + |exec java $JAVA_OPTS -noverify -jar "$0" "$@" + """.stripMargin + + Files.write(jar.toPath, header.getBytes(StandardCharsets.UTF_8) ++ content) + Seq(jar) }.taskValue, ProguardKeys.proguardVersion in Proguard := "5.3",