forked from cockroachdb/cockroach
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dev
executable file
·31 lines (24 loc) · 840 Bytes
/
dev
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
#!/usr/bin/env bash
if [[ $EUID -eq 0 ]]; then
echo "dev cannot be run as root or with sudo"
exit 1
fi
set -euo pipefail
# Bump this counter to force rebuilding `dev` on all machines.
DEV_VERSION=51
THIS_DIR=$(cd "$(dirname "$0")" && pwd)
BINARY_DIR=$THIS_DIR/bin/dev-versions
BINARY_PATH=$BINARY_DIR/dev.$DEV_VERSION
if [[ -f "$BINARY_PATH" && ! -z "${DEV_FORCE_REBUILD-}" ]]; then
rm "$BINARY_PATH"
fi
if [[ ! -f "$BINARY_PATH" ]]; then
echo "$BINARY_PATH not found, building..."
mkdir -p $BINARY_DIR
bazel build //pkg/cmd/dev --//build/toolchains:nogo_disable_flag --remote_cache=
cp $(bazel info bazel-bin --//build/toolchains:nogo_disable_flag)/pkg/cmd/dev/dev_/dev $BINARY_PATH
# The Bazel-built binary won't have write permissions.
chmod a+w $BINARY_PATH
fi
cd $THIS_DIR
exec $BINARY_PATH "$@"