Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Commit

Permalink
Create new jar file only if original file has changed
Browse files Browse the repository at this point in the history
  • Loading branch information
dangmai committed Feb 4, 2020
1 parent e5eeeef commit 07de795
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
16 changes: 12 additions & 4 deletions tools/create-jorje-jar.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ set -euxo pipefail
URL=https://github.com/forcedotcom/salesforcedx-vscode/blob/develop/packages/salesforcedx-vscode-apex/out/apex-jorje-lsp.jar?raw=true
FILENAME=apex-jorje-lsp-original.jar
FILENAME_MINIMIZED=apex-jorje-lsp.jar
CURRENT_MD5_FILENAME=current-jorje-md5.txt

CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
CURRENT_MD5="$(cat "${CURRENT_DIR}/${CURRENT_MD5_FILENAME}")"

function install() {
mv ${FILENAME_MINIMIZED} "${CURRENT_DIR}/../libs/"
Expand All @@ -16,7 +18,6 @@ function download() {
curl -L -o ${FILENAME} ${URL}
}


function minimize() {
unzip -d temp ${FILENAME}
pushd temp
Expand Down Expand Up @@ -44,6 +45,13 @@ function cleanup() {
}

download
minimize
install
cleanup
NEW_MD5="$(md5sum ${FILENAME} | awk '{ print $1 }')"
if [[ "${NEW_MD5}" == "${CURRENT_MD5}" ]]; then
cleanup
else
minimize
install
cleanup
echo "${NEW_MD5}" > "${CURRENT_DIR}/${CURRENT_MD5_FILENAME}"
fi

1 change: 1 addition & 0 deletions tools/current-jorje-md5.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
5896501d3376de9d4fee6d69db631d16

0 comments on commit 07de795

Please sign in to comment.