Skip to content
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

feat(foundryup): allow multiple installed versions #9551

Merged
merged 9 commits into from
Dec 19, 2024

Conversation

grandizzy
Copy link
Collaborator

@grandizzy grandizzy commented Dec 13, 2024

Motivation

  • install option renamed from -v, --version to
    -i, --install   Install a specific version from built binaries
  • new options added
    -l, --list      List versions installed from built binaries
    -u, --use       Use a specific installed version from built binaries
  • install multiple versions (with foundryup -i) (last one becomes active)
$ foundryup -i nightly-f089dff1c6c24d1ddf43c7cbefee46ea0197c88f
$ foundryup -i nightly-e5dbb7a320c2b871c4a4a1006ad3c15a08fcf17b
  • versions are extracted in ~/.foundry/versions/ dir and can be listed with foundryup -l
$ foundryup -l
foundryup: nightly-e5dbb7a320c2b871c4a4a1006ad3c15a08fcf17b
foundryup: - forge 0.2.0 (e5dbb7a 2024-12-03T00:24:42.577356416Z)
foundryup: - cast 0.2.0 (e5dbb7a 2024-12-03T00:24:42.537035487Z)
foundryup: - anvil 0.2.0 (e5dbb7a 2024-12-03T00:24:42.571016376Z)
foundryup: - chisel 0.2.0 (e5dbb7a 2024-12-03T00:24:42.529565979Z)

foundryup: nightly-f089dff1c6c24d1ddf43c7cbefee46ea0197c88f
foundryup: - forge 0.2.0 (f089dff 2024-10-06T00:22:11.758232611Z)
foundryup: - cast 0.2.0 (f089dff 2024-10-06T00:22:11.750238669Z)
foundryup: - anvil 0.2.0 (f089dff 2024-10-06T00:22:11.752640285Z)
foundryup: - chisel 0.2.0 (f089dff 2024-10-06T00:22:11.701654109Z)
  • use a different installed version
$ foundryup -u nightly-f089dff1c6c24d1ddf43c7cbefee46ea0197c88f
foundryup: use - forge 0.2.0 (f089dff 2024-10-06T00:22:11.758232611Z)
foundryup: use - cast 0.2.0 (f089dff 2024-10-06T00:22:11.750238669Z)
foundryup: use - anvil 0.2.0 (f089dff 2024-10-06T00:22:11.752640285Z)
foundryup: use - chisel 0.2.0 (f089dff 2024-10-06T00:22:11.701654109Z)

Solution

foundryup/foundryup Outdated Show resolved Hide resolved
@zerosnacks zerosnacks self-requested a review December 13, 2024 13:32
zerosnacks
zerosnacks previously approved these changes Dec 13, 2024
Copy link
Member

@zerosnacks zerosnacks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested, works well

if [ "$PLATFORM" = "win32" ]; then
tmp="$(mktemp -d 2>/dev/null || echo ".")/foundry.zip"
ensure download "$BIN_ARCHIVE_URL" "$tmp"
ensure unzip "$tmp" -d "$FOUNDRY_BIN_DIR"
ensure unzip "$tmp" -d "$FOUNDRY_VERSIONS_DIR/$FOUNDRYUP_TAG"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

have to test this works OK on Win

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tested and files properly inflated / unzipped, plus also asking to confirm if you want to replace / skip file for already installed versions

@grandizzy grandizzy marked this pull request as ready for review December 17, 2024 15:34
@zerosnacks zerosnacks self-requested a review December 18, 2024 08:04
@@ -240,7 +251,9 @@ USAGE:

OPTIONS:
-h, --help Print help information
-v, --version Install a specific version from built binaries
-i, --install Install a specific version from built binaries
Copy link
Member

@zerosnacks zerosnacks Dec 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nits:

not a regression but running --install without comments silently fails (this is expected but ideally should raise an error):

foundryup --install

ideally --use without an argument should display foundryup: version not installed, right now it panics with cp: cannot stat '/home/zerosnacks/.foundry/versions//forge': No such file or directory

foundryup --use

Copy link
Member

@zerosnacks zerosnacks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested on MacOS + Linux, works well

Tiny find: --install accepts 0.2.0 as a tag (will turn into v0.2.0 whereas --use does not accept 0.2.0, only v0.2.0. Definitely not a blocker as v0.2.0 is correct.

@grandizzy grandizzy merged commit af52b80 into foundry-rs:master Dec 19, 2024
22 checks passed
@grandizzy grandizzy deleted the foundryup-up branch December 19, 2024 15:28
mkysel added a commit to xmtp/xmtpd that referenced this pull request Dec 19, 2024
For some reason foundryup changed from `-u` to `-i`...

foundry-rs/foundry#9551
geoknee added a commit to ethereum-optimism/optimism that referenced this pull request Dec 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

2 participants