mirror of
https://github.com/placeholder-soft/asdf-foundry-zksync.git
synced 2026-01-12 07:04:07 +08:00
feat: integrate forge zksync setting
This commit is contained in:
@@ -15,10 +15,7 @@
|
|||||||
|
|
||||||
# Dependencies
|
# Dependencies
|
||||||
|
|
||||||
**TODO: adapt this section**
|
|
||||||
|
|
||||||
- `bash`, `curl`, `tar`, and [POSIX utilities](https://pubs.opengroup.org/onlinepubs/9699919799/idx/utilities.html).
|
- `bash`, `curl`, `tar`, and [POSIX utilities](https://pubs.opengroup.org/onlinepubs/9699919799/idx/utilities.html).
|
||||||
- `SOME_ENV_VAR`: set this environment variable in your shell config to load the correct version of tool x.
|
|
||||||
|
|
||||||
# Install
|
# Install
|
||||||
|
|
||||||
|
|||||||
@@ -10,14 +10,13 @@ source "${plugin_dir}/lib/utils.bash"
|
|||||||
|
|
||||||
mkdir -p "$ASDF_DOWNLOAD_PATH"
|
mkdir -p "$ASDF_DOWNLOAD_PATH"
|
||||||
|
|
||||||
# TODO: Adapt this to proper extension and adapt extracting strategy.
|
|
||||||
release_file="$ASDF_DOWNLOAD_PATH/$TOOL_NAME-$ASDF_INSTALL_VERSION.tar.gz"
|
release_file="$ASDF_DOWNLOAD_PATH/$TOOL_NAME-$ASDF_INSTALL_VERSION.tar.gz"
|
||||||
|
|
||||||
# Download tar.gz file to the download directory
|
# Download tar.gz file to the download directory
|
||||||
download_release "$ASDF_INSTALL_VERSION" "$release_file"
|
download_release "$ASDF_INSTALL_VERSION" "$release_file"
|
||||||
|
|
||||||
# Extract contents of tar.gz file into the download directory
|
# Extract contents of tar.gz file into the download directory
|
||||||
tar -xzf "$release_file" -C "$ASDF_DOWNLOAD_PATH" --strip-components=1 || fail "Could not extract $release_file"
|
tar -xzf "$release_file" -C "$ASDF_DOWNLOAD_PATH" || fail "Could not extract $release_file"
|
||||||
|
|
||||||
# Remove the tar.gz file since we don't need to keep it
|
# Remove the tar.gz file since we don't need to keep it
|
||||||
rm "$release_file"
|
rm "$release_file"
|
||||||
|
|||||||
@@ -5,8 +5,7 @@ Testing Locally:
|
|||||||
```shell
|
```shell
|
||||||
asdf plugin test <plugin-name> <plugin-url> [--asdf-tool-version <version>] [--asdf-plugin-gitref <git-ref>] [test-command*]
|
asdf plugin test <plugin-name> <plugin-url> [--asdf-tool-version <version>] [--asdf-plugin-gitref <git-ref>] [test-command*]
|
||||||
|
|
||||||
# TODO: adapt this
|
asdf plugin test foundry-zksync https://github.com/placeholder-soft/foundry-zksync.git "forge --version"
|
||||||
asdf plugin test foundry-zksync https://github.com/caoer/asdf-foundry-zksync.git "forge --version"
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Tests are automatically run in GitHub Actions on push and PR.
|
Tests are automatically run in GitHub Actions on push and PR.
|
||||||
|
|||||||
@@ -2,8 +2,7 @@
|
|||||||
|
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
# TODO: Ensure this is the correct GitHub homepage where releases can be downloaded for foundry-zksync.
|
GH_REPO="https://github.com/matter-labs/foundry-zksync"
|
||||||
GH_REPO="https://github.com/placeholder-soft/foundry-zksync"
|
|
||||||
TOOL_NAME="foundry-zksync"
|
TOOL_NAME="foundry-zksync"
|
||||||
TOOL_TEST="forge --version"
|
TOOL_TEST="forge --version"
|
||||||
|
|
||||||
@@ -31,8 +30,6 @@ list_github_tags() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
list_all_versions() {
|
list_all_versions() {
|
||||||
# TODO: Adapt this. By default we simply list the tag names from GitHub releases.
|
|
||||||
# Change this function if foundry-zksync has other means of determining installable versions.
|
|
||||||
list_github_tags
|
list_github_tags
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -40,9 +37,36 @@ download_release() {
|
|||||||
local version filename url
|
local version filename url
|
||||||
version="$1"
|
version="$1"
|
||||||
filename="$2"
|
filename="$2"
|
||||||
|
# Determine platform and architecture
|
||||||
|
local platform
|
||||||
|
local arch
|
||||||
|
case "$(uname -s)" in
|
||||||
|
"Darwin")
|
||||||
|
platform="darwin"
|
||||||
|
;;
|
||||||
|
"Linux")
|
||||||
|
platform="linux"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
fail "Unsupported platform: $(uname -s)"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
# TODO: Adapt the release URL convention for foundry-zksync
|
case "$(uname -m)" in
|
||||||
url="$GH_REPO/archive/v${version}.tar.gz"
|
"x86_64")
|
||||||
|
arch="amd64"
|
||||||
|
;;
|
||||||
|
"arm64"|"aarch64")
|
||||||
|
arch="arm64"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
fail "Unsupported architecture: $(uname -m)"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# Construct download URL using platform and arch
|
||||||
|
local archive_name="foundry_nightly_${platform}_${arch}.tar.gz"
|
||||||
|
url="$GH_REPO/releases/download/$version/$archive_name"
|
||||||
|
|
||||||
echo "* Downloading $TOOL_NAME release $version..."
|
echo "* Downloading $TOOL_NAME release $version..."
|
||||||
curl "${curl_opts[@]}" -o "$filename" -C - "$url" || fail "Could not download $url"
|
curl "${curl_opts[@]}" -o "$filename" -C - "$url" || fail "Could not download $url"
|
||||||
@@ -61,7 +85,6 @@ install_version() {
|
|||||||
mkdir -p "$install_path"
|
mkdir -p "$install_path"
|
||||||
cp -r "$ASDF_DOWNLOAD_PATH"/* "$install_path"
|
cp -r "$ASDF_DOWNLOAD_PATH"/* "$install_path"
|
||||||
|
|
||||||
# TODO: Assert foundry-zksync executable exists.
|
|
||||||
local tool_cmd
|
local tool_cmd
|
||||||
tool_cmd="$(echo "$TOOL_TEST" | cut -d' ' -f1)"
|
tool_cmd="$(echo "$TOOL_TEST" | cut -d' ' -f1)"
|
||||||
test -x "$install_path/$tool_cmd" || fail "Expected $install_path/$tool_cmd to be executable."
|
test -x "$install_path/$tool_cmd" || fail "Expected $install_path/$tool_cmd to be executable."
|
||||||
|
|||||||
Reference in New Issue
Block a user