diff --git a/coursier-standalone b/coursier-standalone new file mode 100755 index 000000000..97683abbc Binary files /dev/null and b/coursier-standalone differ diff --git a/project/generate-standalone-launcher.sh b/project/generate-standalone-launcher.sh new file mode 100755 index 000000000..791e9f2d6 --- /dev/null +++ b/project/generate-standalone-launcher.sh @@ -0,0 +1,46 @@ +#!/bin/bash +set -e + +cd "$(dirname "$0")/.." + +if [ ! -d cli/target/pack/lib ]; then + echo "Compiling coursier-cli..." 1>&2 + sbt cli/pack +fi + +echo -n > coursier.pro + +for i in cli/target/pack/lib/*.jar; do + echo "-injars $i" >> coursier.pro +done + +cat >> coursier.pro << EOF +-outjars coursier-standalone.jar +-libraryjars /lib/rt.jar + +-dontwarn + +-keep class coursier.cli.Coursier { + public static void main(java.lang.String[]); +} +EOF + +# -noverify added in launcher below because of errors like +# http://sourceforge.net/p/proguard/bugs/567/ + +# These options don't fix it: +# -dontshrink +# -dontoptimize +# -dontobfuscate + +./coursier launch \ + net.sf.proguard:proguard-base:5.2.1 -M proguard.ProGuard -- -- \ + @coursier.pro +cat > coursier-standalone << EOF +#!/bin/sh +exec java -noverify -cp "\$0" coursier.cli.Coursier "\$@" +EOF +cat coursier-standalone.jar >> coursier-standalone +chmod +x coursier-standalone +rm -f coursier-standalone.jar +rm -f coursier.pro