Add standalone proguarded launcher

This commit is contained in:
Alexandre Archambault 2016-01-23 15:45:17 +01:00
parent 520fad9b46
commit e501b32f86
2 changed files with 46 additions and 0 deletions

BIN
coursier-standalone Executable file

Binary file not shown.

View File

@ -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 <java.home>/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