#!/usr/bin/env bash # Compile the patched tree. Any extra arguments are passed straight to cargo, # e.g. ./scripts/build.sh --release # # Set CARGO_CMD to run something other than `build` (check, test, clippy, run). source "$(dirname "${BASH_SOURCE[0]}")/lib.sh" setup_path assert_work_ready require_cmd cargo "Run 'make setup' first." CARGO_CMD="${CARGO_CMD:-build}" PKG="${PKG:-$BIN_PKG}" cd "$WORK_DIR" # bin/protoc is a DotSlash wrapper; it needs dotslash on PATH to self-resolve. # If that is unavailable, hand the build script a system protoc instead so it # does not silently skip codegen. if ! ./bin/protoc --version >/dev/null 2>&1; then if command -v protoc >/dev/null 2>&1 && [[ -z "${PROTOC:-}" ]]; then export PROTOC="$(command -v protoc)" warn "bin/protoc unusable (dotslash missing?) -- using PROTOC=$PROTOC" else die "no working protoc. Run 'make setup'." fi fi info "cargo $CARGO_CMD -p $PKG ${*:-}" exec cargo "$CARGO_CMD" -p "$PKG" "$@"