From 208f18f518b00d31b8e36c050d266a3779097c38 Mon Sep 17 00:00:00 2001 From: Alexandre Archambault Date: Mon, 12 Jun 2017 01:54:24 +0200 Subject: [PATCH] More careful handling of the bootstrap.jar resource It seems that blindly putting it in resourceGenerators makes proguard... proguard it. --- build.sbt | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 9d060f5e0..42feae4f8 100644 --- a/build.sbt +++ b/build.sbt @@ -356,7 +356,21 @@ lazy val coursier = project lazy val addBootstrapJarAsResource = { - resourceGenerators.in(Compile) += packageBin.in(bootstrap).in(Compile).map(Seq(_)).taskValue + + import java.nio.file.Files + + packageBin.in(Compile) := { + val bootstrapJar = packageBin.in(bootstrap).in(Compile).value + val source = packageBin.in(Compile).value + + val dest = source.getParentFile / (source.getName.stripSuffix(".jar") + "-with-bootstrap.jar") + + ZipUtil.addToZip(source, dest, Seq( + "bootstrap.jar" -> Files.readAllBytes(bootstrapJar.toPath) + )) + + dest + } } lazy val addBootstrapInProguardedJar = {