Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 17 additions & 4 deletions foundryup/foundryup
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ set -eo pipefail

# NOTE: if you make modifications to this script, please increment the version number.
# WARNING: the SemVer pattern: major.minor.patch must be followed as we use it to determine if the script is up to date.
FOUNDRYUP_INSTALLER_VERSION="1.8.0"
FOUNDRYUP_INSTALLER_VERSION="1.8.1"

BASE_DIR=${XDG_CONFIG_HOME:-$HOME}
FOUNDRY_DIR=${FOUNDRY_DIR:-"$BASE_DIR/.foundry"}
Expand Down Expand Up @@ -585,14 +585,27 @@ use() {
# anvil), so `base-forge test` / `base-anvil` just work with no
# foundry.toml changes. The real binary stays in the versioned dir.
real_bin="$FOUNDRY_VERSION_DIR/$bin"
anvil_flag=""
[ "$bin" = "anvil" ] && anvil_flag=" --base"
cat > "$bin_path" <<WRAP
if [ "$bin" = "forge" ]; then
# forge is the only Base build with a `test` subcommand; have its
# wrapper announce on `base-forge test` so it is obvious the run used
# the Base precompiles rather than stock Foundry.
cat > "$bin_path" <<WRAP
#!/usr/bin/env bash
# Auto-generated by 'foundryup --network base'. Runs the Base build of $bin with
# Base precompiles enabled by default. Your stock '$bin' is left untouched.
[ "\$1" = test ] && echo "$dest_bin: Base precompiles enabled for this test run (Base build, not stock Foundry)" >&2
exec env FOUNDRY_BASE=true "$real_bin" "\$@"
WRAP
else
anvil_flag=""
[ "$bin" = "anvil" ] && anvil_flag=" --base"
cat > "$bin_path" <<WRAP
#!/usr/bin/env bash
# Auto-generated by 'foundryup --network base'. Runs the Base build of $bin with
# Base precompiles enabled by default. Your stock '$bin' is left untouched.
exec env FOUNDRY_BASE=true "$real_bin"$anvil_flag "\$@"
WRAP
fi
ensure chmod +x "$bin_path"
say "use - $dest_bin (Base enabled) -> $real_bin"
continue
Expand Down
Loading