Skip to content

Commit

Permalink
[move-ide] Publishing/packaging scripts fixes (#20361)
Browse files Browse the repository at this point in the history
## Description 

What the title says
  • Loading branch information
awelc authored Nov 21, 2024
1 parent ff12dbc commit 52dd51d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
set -e

usage() {
>&2 echo "Usage: $0 -pkg|-pub [-h]"
SCRIPT_NAME=$(basename "$1")
>&2 echo "Usage: $SCRIPT_NAME -pkg|-pub [-h]"
>&2 echo ""
>&2 echo "Options:"
>&2 echo " -pub Publish extensions for all targets"
Expand All @@ -21,14 +22,14 @@ clean_tmp_dir() {
}

if [[ "$@" == "" ]]; then
usage
usage $0
exit 1
fi

for cmd in "$@"
do
if [[ "$cmd" == "-h" ]]; then
usage
usage $0
exit 0
elif [[ "$cmd" == "-pkg" ]]; then
OP="package"
Expand All @@ -37,7 +38,7 @@ do
OP="publish"
OPTS=""
else
usage
usage $0
exit 1
fi
done
Expand All @@ -57,11 +58,6 @@ SUPPORTED_OS[windows-x86_64]=win32-x64
TMP_DIR=$( mktemp -d -t vscode-create )
trap "clean_tmp_dir $TMP_DIR" EXIT

LANG_SERVER_DIR="language-server"

rm -rf $LANG_SERVER_DIR
mkdir $LANG_SERVER_DIR

for DIST_OS VSCODE_OS in "${(@kv)SUPPORTED_OS}"; do
# Sui distribution identifier
SUI_DISTRO=$NETWORK"-v"$VERSION
Expand All @@ -85,14 +81,20 @@ for DIST_OS VSCODE_OS in "${(@kv)SUPPORTED_OS}"; do

# copy move-analyzer binary to the appropriate location where it's picked up when bundling the
# extension
LANG_SERVER_DIR="language-server"
rm -rf $LANG_SERVER_DIR
mkdir $LANG_SERVER_DIR

SRC_SERVER_BIN_LOC=$TMP_DIR"/external-crates/move/target/release/"$ARCHIVE_SERVER_BIN
DST_SERVER_BIN_LOC=$LANG_SERVER_DIR"/"$SERVER_BIN
cp $SRC_SERVER_BIN_LOC $DST_SERVER_BIN_LOC

vsce "$OP" ${OPTS//VSCODE_OS/$VSCODE_OS} --target "$VSCODE_OS"

rm -rf $LANG_SERVER_DIR

done

rm -rf $LANG_SERVER_DIR

# build a "generic" version of the extension that does not bundle the move-analyzer binary
vsce "$OP" ${OPTS//VSCODE_OS/generic}
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,6 @@ SUPPORTED_OS[windows-x86_64]=win32-x64
TMP_DIR=$( mktemp -d -t vscode-create )
trap "clean_tmp_dir $TMP_DIR" EXIT

LANG_SERVER_DIR="language-server"

rm -rf $LANG_SERVER_DIR
mkdir $LANG_SERVER_DIR


BIN_FILES=($BIN_DIR/*.tgz(.))

if (( ${#BIN_FILES[@]} != 4 )); then
Expand Down Expand Up @@ -127,11 +121,19 @@ for SUI_ARCHIVE_PATH in "${BIN_FILES[@]}"; do

# copy move-analyzer binary to the appropriate location where it's picked up when bundling the
# extension
LANG_SERVER_DIR="language-server"
rm -rf $LANG_SERVER_DIR
mkdir $LANG_SERVER_DIR

cp $TMP_DIR/$DIST_OS/$SERVER_BIN $LANG_SERVER_DIR

VSCODE_OS=${SUPPORTED_OS[$DIST_OS]}
vsce "$OP" ${OPTS//VSCODE_OS/$VSCODE_OS} --target "$VSCODE_OS"

rm -rf $LANG_SERVER_DIR

done

rm -rf $LANG_SERVER_DIR

# build a "generic" version of the extension that does not bundle the move-analyzer binary
vsce "$OP" ${OPTS//VSCODE_OS/generic}

0 comments on commit 52dd51d

Please sign in to comment.