summaryrefslogtreecommitdiffhomepage
path: root/test/scripts/build-runner.sh
blob: ffdb2b861a26b6327071f90379c801cb842305dc (plain)
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
#!/usr/bin/env bash

set -eu

SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
REPO_DIR="$SCRIPT_DIR/../.."
cd "$SCRIPT_DIR"

# shellcheck disable=SC1091
source "$REPO_DIR/scripts/utils/log"

case ${1-:""} in
    linux)
        TARGET=x86_64-unknown-linux-gnu
        shift
    ;;
    windows)
        TARGET=x86_64-pc-windows-gnu
        shift
    ;;
    macos)
        # TODO: x86
        TARGET=aarch64-apple-darwin
        shift
    ;;
    *)
        log_error "Invalid platform. Specify a valid platform as first argument"
        exit 1
esac

cargo build \
    --bin test-runner \
    --bin connection-checker \
    --release --target "${TARGET}"

# Only build runner image for Windows
if [[ $TARGET == x86_64-pc-windows-gnu ]]; then
    TARGET="$TARGET" ./build-runner-image.sh
fi