Skip to content

Commit 2350f25

Browse files
dguidoclaude
andcommitted
Fix solc wrapper to check both nested and direct binary paths
The solc-select tool stores binaries differently on different systems: - MacOS/local: artifacts/solc-X.Y.Z/solc-X.Y.Z (nested structure) - Linux/CI: artifacts/solc-X.Y.Z (binary directly) Updated the wrapper to check both patterns in both VIRTUAL_ENV and HOME locations. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent f0c1990 commit 2350f25

File tree

1 file changed

+29
-2
lines changed

1 file changed

+29
-2
lines changed

scripts/ci_test_common.sh

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,38 @@ solc() {
6060
# Get the current solc version from solc-select
6161
# Use command to avoid calling our wrapper function
6262
SOLC_VERSION=$(command $RUN solc-select versions 2>/dev/null | grep "(current" | cut -d' ' -f1)
63-
# Use the specific solc binary from solc-select's artifacts
64-
if [ -f "$HOME/.solc-select/artifacts/solc-$SOLC_VERSION/solc-$SOLC_VERSION" ]; then
63+
64+
# When VIRTUAL_ENV is set, solc-select uses it as the base directory
65+
# Otherwise it uses HOME
66+
if [ -n "$VIRTUAL_ENV" ]; then
67+
SOLC_BASE="$VIRTUAL_ENV/.solc-select"
68+
else
69+
SOLC_BASE="$HOME/.solc-select"
70+
fi
71+
72+
# Try multiple possible locations for the solc binary
73+
# Different systems may have different structures
74+
if [ -f "$SOLC_BASE/artifacts/solc-$SOLC_VERSION/solc-$SOLC_VERSION" ]; then
75+
# MacOS/local structure: artifacts/solc-X.Y.Z/solc-X.Y.Z
76+
"$SOLC_BASE/artifacts/solc-$SOLC_VERSION/solc-$SOLC_VERSION" "$@"
77+
elif [ -f "$SOLC_BASE/artifacts/solc-$SOLC_VERSION" ]; then
78+
# Linux/CI structure: artifacts/solc-X.Y.Z (binary directly)
79+
"$SOLC_BASE/artifacts/solc-$SOLC_VERSION" "$@"
80+
elif [ -f "$HOME/.solc-select/artifacts/solc-$SOLC_VERSION/solc-$SOLC_VERSION" ]; then
81+
# Fallback to HOME directory - MacOS/local structure
6582
"$HOME/.solc-select/artifacts/solc-$SOLC_VERSION/solc-$SOLC_VERSION" "$@"
83+
elif [ -f "$HOME/.solc-select/artifacts/solc-$SOLC_VERSION" ]; then
84+
# Fallback to HOME directory - Linux/CI structure (binary directly)
85+
"$HOME/.solc-select/artifacts/solc-$SOLC_VERSION" "$@"
6686
else
6787
echo "Error: solc-$SOLC_VERSION not found in solc-select artifacts" >&2
88+
echo "VIRTUAL_ENV: ${VIRTUAL_ENV:-not set}" >&2
89+
echo "HOME: $HOME" >&2
90+
echo "Searched locations:" >&2
91+
echo " - $SOLC_BASE/artifacts/solc-$SOLC_VERSION/solc-$SOLC_VERSION" >&2
92+
echo " - $SOLC_BASE/artifacts/solc-$SOLC_VERSION" >&2
93+
echo " - $HOME/.solc-select/artifacts/solc-$SOLC_VERSION/solc-$SOLC_VERSION" >&2
94+
echo " - $HOME/.solc-select/artifacts/solc-$SOLC_VERSION" >&2
6895
return 1
6996
fi
7097
else

0 commit comments

Comments
 (0)