Skip to content

Commit f2f062f

Browse files
committed
[TMP] Change the workaround used for replacing global solc
1 parent b5bc973 commit f2f062f

File tree

5 files changed

+16
-24
lines changed

5 files changed

+16
-24
lines changed

test/externalTests/colony.sh

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,6 @@ verify_input "$@"
2828
BINARY_TYPE="$1"
2929
BINARY_PATH="$2"
3030

31-
# Truffle can only be configured to use the global `solc` native binary.
32-
# Replace it with a function that runs our custom binary.
33-
function solc { "$(realpath "$__SOLC_BINARY_PATH")" "$@"; }
34-
export -f solc
35-
export __SOLC_BINARY_PATH="$BINARY_PATH"
36-
3731
function compile_fn { yarn run provision:token:contracts; }
3832
function test_fn { yarn run test:contracts; }
3933

@@ -51,6 +45,7 @@ function colony_test
5145

5246
setup_solc "$DIR" "$BINARY_TYPE" "$BINARY_PATH"
5347
download_project "$repo" "$branch" "$DIR"
48+
[[ $BINARY_TYPE == native ]] && replace_global_solc "$BINARY_PATH"
5449

5550
neutralize_package_json_hooks
5651
force_truffle_compiler_settings "$config_file" "$BINARY_TYPE" "${DIR}/solc" "$min_optimizer_level"

test/externalTests/common.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,18 @@ function optimizer_settings_for_level
256256
esac
257257
}
258258

259+
function replace_global_solc
260+
{
261+
local solc_path="$1"
262+
263+
[[ ! -e solc ]] || fail "A file named 'solc' already exists in '${PWD}'."
264+
265+
echo "#!/usr/bin/env bash" >> solc
266+
echo "$(realpath "$solc_path") \"\$@\"" >> solc
267+
chmod +x solc
268+
export PATH="$PWD:$PATH"
269+
}
270+
259271
function truffle_compiler_settings
260272
{
261273
local solc_path="$1"

test/externalTests/ens.sh

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,6 @@ verify_input "$@"
2828
BINARY_TYPE="$1"
2929
BINARY_PATH="$2"
3030

31-
# Truffle can only be configured to use the global `solc` native binary.
32-
# Replace it with a function that runs our custom binary.
33-
function solc { "$(realpath "$__SOLC_BINARY_PATH")" "$@"; }
34-
export -f solc
35-
export __SOLC_BINARY_PATH="$BINARY_PATH"
36-
3731
function compile_fn { npx truffle compile; }
3832
function test_fn { npm run test; }
3933

@@ -51,6 +45,7 @@ function ens_test
5145

5246
setup_solc "$DIR" "$BINARY_TYPE" "$BINARY_PATH"
5347
download_project "$repo" "$branch" "$DIR"
48+
[[ $BINARY_TYPE == native ]] && replace_global_solc "$BINARY_PATH"
5449

5550
# Use latest Truffle. Older versions crash on the output from 0.8.0.
5651
force_truffle_version ^5.1.55

test/externalTests/gnosis-v2.sh

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,6 @@ verify_input "$@"
2828
BINARY_TYPE="$1"
2929
BINARY_PATH="$2"
3030

31-
# Truffle can only be configured to use the global `solc` native binary.
32-
# Replace it with a function that runs our custom binary.
33-
function solc { "$(realpath "$__SOLC_BINARY_PATH")" "$@"; }
34-
export -f solc
35-
export __SOLC_BINARY_PATH="$BINARY_PATH"
36-
3731
function compile_fn { npx truffle compile; }
3832
function test_fn { npm test; }
3933

@@ -51,6 +45,7 @@ function gnosis_safe_test
5145

5246
setup_solc "$DIR" "$BINARY_TYPE" "$BINARY_PATH"
5347
download_project "$repo" "$branch" "$DIR"
48+
[[ $BINARY_TYPE == native ]] && replace_global_solc "$BINARY_PATH"
5449

5550
sed -i 's|github:gnosis/mock-contract#sol_0_5_0|github:solidity-external-tests/mock-contract#master_080|g' package.json
5651
sed -i -E 's|"@gnosis.pm/util-contracts": "[^"]+"|"@gnosis.pm/util-contracts": "github:solidity-external-tests/util-contracts#solc-7_080"|g' package.json

test/externalTests/gnosis.sh

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,6 @@ verify_input "$@"
2828
BINARY_TYPE="$1"
2929
BINARY_PATH="$2"
3030

31-
# Truffle can only be configured to use the global `solc` native binary.
32-
# Replace it with a function that runs our custom binary.
33-
function solc { "$(realpath "$__SOLC_BINARY_PATH")" "$@"; }
34-
export -f solc
35-
export __SOLC_BINARY_PATH="$BINARY_PATH"
36-
3731
function compile_fn { npx truffle compile; }
3832
function test_fn { npm test; }
3933

@@ -51,6 +45,7 @@ function gnosis_safe_test
5145

5246
setup_solc "$DIR" "$BINARY_TYPE" "$BINARY_PATH"
5347
download_project "$repo" "$branch" "$DIR"
48+
[[ $BINARY_TYPE == native ]] && replace_global_solc "$BINARY_PATH"
5449

5550
sed -i 's|github:gnosis/mock-contract#sol_0_5_0|github:solidity-external-tests/mock-contract#master_080|g' package.json
5651

0 commit comments

Comments
 (0)