-
Notifications
You must be signed in to change notification settings - Fork 11.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[trace-debug] Marketplace release prep #20341
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
137 changes: 137 additions & 0 deletions
137
external-crates/move/crates/move-analyzer/editors/code/scripts/create_from_local.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
#!/bin/zsh | ||
# Copyright (c) Mysten Labs, Inc. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
# This script is meant to be executed on MacOS (hence zsh use - to get associative arrays otherwise | ||
# unavailable in the bundled bash version). | ||
# | ||
# Before running the script, you need to download Sui binaries to a freshly created directory | ||
# (make sure that there are no other files in this directory). Sui binary must be a compressed | ||
# tarball (with tgz extension) and its name has to have the following format: | ||
# sui-VERSION-SHA-PLATFORM.tgz | ||
# | ||
# where: | ||
# - VERSION is the Sui binary version (e.g., "v.1.37.0) | ||
# - SHA is first 10 characgers of commit sha for the version of Sui repo's main branch | ||
# that this binary was build from | ||
# - PLATFORM is on of the supported platforms (macos-arm64, macos-x86_64, ubuntu-x86_64, windows-x86_64) | ||
set -e | ||
|
||
usage() { | ||
SCRIPT_NAME=$(basename "$1") | ||
>&2 echo "Usage: $SCRIPT_NAME -pkg|-pub [-h] BINDIR" | ||
>&2 echo "" | ||
>&2 echo "Options:" | ||
>&2 echo " -pub Publish extensions for all targets" | ||
>&2 echo " -pkg Package extensions for all targets" | ||
>&2 echo " -h Print this message" | ||
>&2 echo " BINDIR Directory containing pre-built Sui binaries" | ||
} | ||
|
||
clean_tmp_dir() { | ||
test -d "$TMP_DIR" && rm -fr "$TMP_DIR" | ||
} | ||
|
||
if [[ "$@" == "" ]]; then | ||
usage $0 | ||
exit 1 | ||
fi | ||
|
||
BIN_DIR="" | ||
for cmd in "$@" | ||
do | ||
if [[ "$cmd" == "-h" ]]; then | ||
usage $0 | ||
exit 0 | ||
elif [[ "$cmd" == "-pkg" ]]; then | ||
OP="package" | ||
OPTS="-omove-VSCODE_OS.vsix" | ||
elif [[ "$cmd" == "-pub" ]]; then | ||
OP="publish" | ||
OPTS="" | ||
else | ||
BIN_DIR=$cmd | ||
|
||
if [[ ! -d "$BIN_DIR" ]]; then | ||
echo Sui binary directory $BIN_DIR does not exist | ||
usage $0 | ||
exit 1 | ||
fi | ||
fi | ||
done | ||
|
||
if [[ $BIN_DIR == "" ]]; then | ||
# directory storing Sui binaries have not been defined | ||
usage $0 | ||
exit 1 | ||
fi | ||
|
||
# a map from os version identifiers in Sui's binary distribution to os version identifiers | ||
# representing VSCode's target platforms used for creating platform-specific plugin distributions | ||
declare -A SUPPORTED_OS | ||
SUPPORTED_OS[macos-arm64]=darwin-arm64 | ||
SUPPORTED_OS[macos-x86_64]=darwin-x64 | ||
SUPPORTED_OS[ubuntu-x86_64]=linux-x64 | ||
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 | ||
echo "Sui binary directory $BIN_DIR should only contain binaries for the four supported platforms" | ||
exit 1 | ||
fi | ||
|
||
|
||
for SUI_ARCHIVE_PATH in "${BIN_FILES[@]}"; do | ||
# Extract just the file name | ||
FILE_NAME=${SUI_ARCHIVE_PATH##*/} | ||
# Remove the .tgz extension | ||
BASE_NAME=${FILE_NAME%.tgz} | ||
# Extract everything untl last `-` | ||
OS_NAME_PREFIX=${BASE_NAME%-*} | ||
# Extract everything after the last `-` | ||
OS_NAME=${OS_NAME_PREFIX##*-} | ||
# Extract everything after the last `-` | ||
OS_VARIANT=${BASE_NAME##*-} | ||
|
||
DIST_OS=$OS_NAME-$OS_VARIANT | ||
|
||
if [[ ! -v SUPPORTED_OS[$DIST_OS] ]]; then | ||
echo "Found Sui binary archive for a platform that is not supported: $SUI_ARCHIVE_PATH" | ||
echo "Supported platforms:" | ||
for PLATFORM in ${(k)SUPPORTED_OS}; do | ||
echo "\t$PLATFORM" | ||
done | ||
exit 1 | ||
fi | ||
|
||
rm -rf $TMP_DIR/$DIST_OS | ||
mkdir $TMP_DIR/$DIST_OS | ||
tar -xf $SUI_ARCHIVE_PATH --directory $TMP_DIR/$DIST_OS | ||
|
||
# name of the move-analyzer binary | ||
SERVER_BIN="move-analyzer" | ||
ARCHIVE_SERVER_BIN=$SERVER_BIN"-"$DIST_OS | ||
if [[ "$DIST_OS" == *"windows"* ]]; then | ||
SERVER_BIN="$SERVER_BIN".exe | ||
fi | ||
|
||
# copy move-analyzer binary to the appropriate location where it's picked up when bundling the | ||
# extension | ||
VSCODE_OS=${SUPPORTED_OS[$DIST_OS]} | ||
vsce "$OP" ${OPTS//VSCODE_OS/$VSCODE_OS} --target "$VSCODE_OS" | ||
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} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But this isn't actually true, right? It lets you run the tracing command, it requires another extension to do trace debugging.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For all intents and purposes it's true. When someone installs Move extension (after the next update of course), the Move Trace Debugging extension is installed automatically so from developer's perspective it's this extension that provides it (much like syntax highlighting is provided by a different extension and yet we list this feature in this README) The debugging instructions comment in the "Features" section clarifies this by saying that "This functionality is provided by automatically including Move Trace Debugging extension" (I did not think we need this particular piece of info right in at the top of this README page)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, could we say "The dependent extension,
${fully qualified extension name}
, also provides..." just to be explicit?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do say that later in the README where we describe how to actually trace-debug Move code:
"If the opened Move source file is located within a buildable project, and you have the
sui
binary installed, you can trace-debug execution of Move unit tests within this project. This functionality is provided by this (Move) extension automatically including the Move Trace Debugging extension"Not sure why we should throw this particular piece of information at the user right at the start, particularly that we don't at all mention that syntax highlighting is provided the same way (through a separate extension), unless you think we should do it as well. That being said, if you think it's crucial, I am not that strongly opposed to adding this info at the beginning, but still wanted to cast my vote here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am going to land it as is but happy to change it (or stamp a change) if need be