Skip to content

Commit

Permalink
Merge pull request #166 from codacy/feat/compress-native-binary
Browse files Browse the repository at this point in the history
feature: Compress native image binary using UPX
  • Loading branch information
josemiguelmelo authored Mar 2, 2020
2 parents 693b5be + 7822c4c commit 6b927aa
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion scripts/publish-native.sh
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@ BUILD_CMD+="cd "$PWD" && $(build_cmd ${BINARY_NAME} ${APP_MAIN_CLASS} "$(app_cla

echo "Going to run ${BUILD_CMD}"

INSTALL_UPX="cd $PWD && yum install -y wget && yum install -y xz && curl -s https://api.github.com/repos/upx/upx/releases/latest | grep \"browser_download_url.*amd64_linux.tar.xz\" | cut -d '\"' -f 4 | wget -qi - -O upx-linux.tar.xz && tar xf upx-linux.tar.xz && ls && cp *amd64_linux/upx ."
COMPRESS_USING_UPX="./upx --lzma ${BINARY_NAME} && rm -rf upx*"

case "$TARGET" in
native)
${BUILD_CMD}
Expand All @@ -112,7 +115,7 @@ case "$TARGET" in
-v $HOME:$HOME:ro \
-v $PWD:$PWD \
oracle/graalvm-ce:19.3.0-java8 \
-c "yum install -y libstdc++-static && gu install native-image && ${BUILD_CMD}"
-c "yum install -y libstdc++-static && ${INSTALL_UPX} && gu install native-image && ${BUILD_CMD} && ${COMPRESS_USING_UPX}"
;;
*)
echo >&2 "Could not find command for target $TARGET"
Expand Down

0 comments on commit 6b927aa

Please sign in to comment.