File tree Expand file tree Collapse file tree 5 files changed +16
-24
lines changed Expand file tree Collapse file tree 5 files changed +16
-24
lines changed Original file line number Diff line number Diff line change @@ -28,12 +28,6 @@ verify_input "$@"
2828BINARY_TYPE=" $1 "
2929BINARY_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-
3731function compile_fn { yarn run provision:token:contracts; }
3832function 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 "
Original file line number Diff line number Diff 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+
259271function truffle_compiler_settings
260272{
261273 local solc_path=" $1 "
Original file line number Diff line number Diff line change @@ -28,12 +28,6 @@ verify_input "$@"
2828BINARY_TYPE=" $1 "
2929BINARY_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-
3731function compile_fn { npx truffle compile; }
3832function 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
Original file line number Diff line number Diff line change @@ -28,12 +28,6 @@ verify_input "$@"
2828BINARY_TYPE=" $1 "
2929BINARY_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-
3731function compile_fn { npx truffle compile; }
3832function 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
Original file line number Diff line number Diff line change @@ -28,12 +28,6 @@ verify_input "$@"
2828BINARY_TYPE=" $1 "
2929BINARY_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-
3731function compile_fn { npx truffle compile; }
3832function 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
You can’t perform that action at this time.
0 commit comments