diff --git a/packaging/assembly.xml b/packaging/assembly.xml index 70dfc7673..57f1d4724 100644 --- a/packaging/assembly.xml +++ b/packaging/assembly.xml @@ -20,18 +20,14 @@ 0777 - src/main/scripts/vscode.sh - vscode.sh + src/main/scripts/vsix.sh + vsix.sh 0777 src/main/scripts/README_VDMJ README_VDMJ - - src/main/scripts/README_VSCODE - README_VSCODE - diff --git a/packaging/src/main/scripts/vsix.sh b/packaging/src/main/scripts/vsix.sh new file mode 100755 index 000000000..3365f252c --- /dev/null +++ b/packaging/src/main/scripts/vsix.sh @@ -0,0 +1,56 @@ +#!/bin/bash +# +# Update a VDM VSCode VSIX, using the jars in this distribution. +# Download VSIX from https://marketplace.visualstudio.com/items?itemName=overturetool.vdm-vscode +# + +function usage() +{ + echo "Usage: $(basename $0) " + echo "e.g. $(basename $0) overturetool.vdm-vscode-1.3.7.vsix" + exit 1 +} + +if [ $# -ne 1 -o "$1" = "-help" ] +then + usage +fi + +VERSION="4.5.0-P-SNAPSHOT" +VDMJ="vdmj_hp" + +SELF=$(which "$0") +DISTRIBUTION=$(dirname "$SELF") +VSIX=$(realpath ${1}) + +if [ ! -e "$VSIX" ] +then + echo "Cannot find VDM VSCode VSIX at $VSIX" + usage +fi + +if [[ "$VSIX" != *.vsix ]] +then + echo "File passed is not a VSIX?" + usage +fi + +echo "**************************** Updating VSIX! ****************************" +( + cd "$DISTRIBUTION" + rm -rf extension + EXTRACT="extension/resources/jars" + unzip -q "$VSIX" "$EXTRACT/$VDMJ/*" "$EXTRACT/plugins/*" + + cp -vf vdmj-$VERSION.jar $EXTRACT/$VDMJ + cp -vf lsp-$VERSION.jar $EXTRACT/$VDMJ + cp -vf annotations-$VERSION.jar $EXTRACT/$VDMJ + cp -vf stdlib-$VERSION.jar $EXTRACT/$VDMJ/libs + cp -vf quickcheck-$VERSION.jar $EXTRACT/plugins + + zip -q "$VSIX" $(find $EXTRACT -type f) + rm -rf extension +) +echo "**************************** FINISHED **********************************" + +exit 0