Skip to content

Commit 70047ff

Browse files
authored
chore(scripts): use slim and always run make in coder-dev.sh (#8418)
1 parent f21541c commit 70047ff

File tree

1 file changed

+25
-5
lines changed

1 file changed

+25
-5
lines changed

scripts/coder-dev.sh

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@ source "${SCRIPT_DIR}/lib.sh"
1010

1111
GOOS="$(go env GOOS)"
1212
GOARCH="$(go env GOARCH)"
13-
RELATIVE_BINARY_PATH="build/coder_${GOOS}_${GOARCH}"
13+
BINARY_TYPE=coder-slim
14+
if [[ $1 == server ]]; then
15+
BINARY_TYPE=coder
16+
fi
17+
RELATIVE_BINARY_PATH="build/${BINARY_TYPE}_${GOOS}_${GOARCH}"
1418

1519
# To preserve the CWD when running the binary, we need to use pushd and popd to
1620
# get absolute paths to everything.
@@ -20,10 +24,26 @@ CODER_DEV_BIN="$(realpath "$RELATIVE_BINARY_PATH")"
2024
CODER_DEV_DIR="$(realpath ./.coderv2)"
2125
popd
2226

23-
if [[ ! -x "${CODER_DEV_BIN}" ]]; then
24-
echo "Run this command first:"
25-
echo " make $RELATIVE_BINARY_PATH"
27+
case $BINARY_TYPE in
28+
coder-slim)
29+
# Ensure the coder slim binary is always up-to-date with local
30+
# changes, this simplifies usage of this script for development.
31+
make -j "${RELATIVE_BINARY_PATH}"
32+
;;
33+
coder)
34+
if [[ ! -x "${CODER_DEV_BIN}" ]]; then
35+
# A feature requiring the full binary was requested and the
36+
# binary is missing, normally it's built by `develop.sh`, but
37+
# it's an expensive operation, so we require manual action here.
38+
echo "Running \"coder $1\" requires the full binary, please run \"develop.sh\" first or build the binary manually:" 1>&2
39+
echo " make $RELATIVE_BINARY_PATH" 1>&2
40+
exit 1
41+
fi
42+
;;
43+
*)
44+
echo "Unknown binary type: $BINARY_TYPE"
2645
exit 1
27-
fi
46+
;;
47+
esac
2848

2949
exec "${CODER_DEV_BIN}" --global-config "${CODER_DEV_DIR}" "$@"

0 commit comments

Comments
 (0)