-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·44 lines (35 loc) · 1.26 KB
/
setup.sh
File metadata and controls
executable file
·44 lines (35 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/sh
# expects this script to be at the root of the project:
export ROOT_DIR=$(dirname -- "$0")
# Use CARGO_TARGET_DIR if it is set, or the default ./target location otherwise
export TARGET_DIR=${CARGO_TARGET_DIR:-$ROOT_DIR/target}
# Only run the prebuild for integration tests unless explicitly forced.
# Set MPC_SETUP_SKIP=1 to skip running setup.sh
# Set MPC_SETUP_ALWAYS=1 to run setup.sh regardless of package
if [ "${MPC_SETUP_SKIP:-}" = "1" ]; then
exec "$@"
fi
if [ "${MPC_SETUP_ALWAYS:-}" != "1" ] && [ "${CARGO_PKG_NAME:-}" != "integration-tests" ]; then
exec "$@"
fi
CARGO_CMD_ARGS="$@"
CARGO_BUILD_INDENT=" "
echo "${CARGO_BUILD_INDENT} running MPC build script"
# Default feature set for building local binaries used by tests.
NODE_FEATURES="test-feature,debug-page"
CONTRACT_FEATURES=""
# Add additional features if we're benchmarking.
if echo "$CARGO_CMD_ARGS" | grep -q "bench"; then
CONTRACT_FEATURES="--features bench"
NODE_FEATURES="${NODE_FEATURES},bench"
fi
NODE_FEATURE_ARGS="--features ${NODE_FEATURES}"
set --
set -e
if [ -n "$CONTRACT_FEATURES" ]; then
. $ROOT_DIR/build-contract.sh $CONTRACT_FEATURES
else
. $ROOT_DIR/build-contract.sh
fi
cargo build -p mpc-node --release $NODE_FEATURE_ARGS
exec $CARGO_CMD_ARGS