Skip to content

Commit

Permalink
Update proguard settings, test proguarded JAR on CI (#811)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexarchambault committed Apr 23, 2018
1 parent 05049a2 commit ec15269
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 3 deletions.
4 changes: 3 additions & 1 deletion build.sbt
Expand Up @@ -472,9 +472,11 @@ lazy val proguardedCli = Seq(
proguardVersion.in(Proguard) := SharedVersions.proguard,
proguardOptions.in(Proguard) ++= Seq(
"-dontwarn",
"-dontoptimize", // required since the switch to scala 2.12
"-keep class coursier.cli.Coursier {\n public static void main(java.lang.String[]);\n}",
"-keep class coursier.cli.IsolatedClassLoader {\n public java.lang.String[] getIsolationTargets();\n}",
"-adaptresourcefilenames **.properties"
"-adaptresourcefilenames **.properties",
"""-keep class scala.Symbol { *; }"""
),
javaOptions.in(Proguard, proguard) := Seq("-Xmx3172M"),
artifactPath.in(Proguard) := proguardDirectory.in(Proguard).value / "coursier-standalone.jar",
Expand Down
8 changes: 6 additions & 2 deletions scripts/generate-launcher.sh
@@ -1,20 +1,24 @@
#!/bin/bash

# grepped and updated during releases
VERSION=1.1.0-M1
ACTUAL_VERSION="${ACTUAL_VERSION:-"$VERSION"}"
CACHE_VERSION=v1

OUTPUT="${OUTPUT:-"coursier"}"

SBTPACK_LAUNCHER="$(dirname "$0")/../cli/target/pack/bin/coursier"

if [ ! -f "$SBTPACK_LAUNCHER" ]; then
sbt ++2.12.4 "project cli" pack
fi

"$SBTPACK_LAUNCHER" bootstrap \
--intransitive io.get-coursier::coursier-cli:$VERSION \
--intransitive "io.get-coursier::coursier-cli:$ACTUAL_VERSION" \
--classifier standalone \
-J "-noverify" \
--no-default \
-r central \
-r sonatype:releases \
-f -o coursier \
-f -o "$OUTPUT" \
"$@"
17 changes: 17 additions & 0 deletions scripts/travis.sh
Expand Up @@ -116,6 +116,23 @@ testBootstrap() {
echo "Error: unexpected output from bootstrapped echo command." 1>&2
exit 1
fi


if echo "$OSTYPE" | grep -q darwin; then
GREP="ggrep"
else
GREP="grep"
fi

CURRENT_VERSION="$("$GREP" -oP '(?<=")[^"]*(?<!")' version.sbt)"

sbt scalaFromEnv cli/publishLocal
ACTUAL_VERSION="$CURRENT_VERSION" OUTPUT="coursier-test" scripts/generate-launcher.sh -r ivy2Local
./coursier-test bootstrap -o cs-echo-launcher io.get-coursier:echo:1.0.0
if [ "$(./cs-echo-launcher foo)" != foo ]; then
echo "Error: unexpected output from bootstrapped echo command (generated by proguarded launcher)." 1>&2
exit 1
fi
fi
}

Expand Down

0 comments on commit ec15269

Please sign in to comment.