mirror of
https://github.com/coder/coder.git
synced 2025-07-15 22:20:27 +00:00
chore(scripts): use slim and always run make in coder-dev.sh
(#8418)
This commit is contained in:
committed by
GitHub
parent
f21541c0e4
commit
70047ffd15
@ -10,7 +10,11 @@ source "${SCRIPT_DIR}/lib.sh"
|
|||||||
|
|
||||||
GOOS="$(go env GOOS)"
|
GOOS="$(go env GOOS)"
|
||||||
GOARCH="$(go env GOARCH)"
|
GOARCH="$(go env GOARCH)"
|
||||||
RELATIVE_BINARY_PATH="build/coder_${GOOS}_${GOARCH}"
|
BINARY_TYPE=coder-slim
|
||||||
|
if [[ $1 == server ]]; then
|
||||||
|
BINARY_TYPE=coder
|
||||||
|
fi
|
||||||
|
RELATIVE_BINARY_PATH="build/${BINARY_TYPE}_${GOOS}_${GOARCH}"
|
||||||
|
|
||||||
# To preserve the CWD when running the binary, we need to use pushd and popd to
|
# To preserve the CWD when running the binary, we need to use pushd and popd to
|
||||||
# get absolute paths to everything.
|
# get absolute paths to everything.
|
||||||
@ -20,10 +24,26 @@ CODER_DEV_BIN="$(realpath "$RELATIVE_BINARY_PATH")"
|
|||||||
CODER_DEV_DIR="$(realpath ./.coderv2)"
|
CODER_DEV_DIR="$(realpath ./.coderv2)"
|
||||||
popd
|
popd
|
||||||
|
|
||||||
if [[ ! -x "${CODER_DEV_BIN}" ]]; then
|
case $BINARY_TYPE in
|
||||||
echo "Run this command first:"
|
coder-slim)
|
||||||
echo " make $RELATIVE_BINARY_PATH"
|
# Ensure the coder slim binary is always up-to-date with local
|
||||||
|
# changes, this simplifies usage of this script for development.
|
||||||
|
make -j "${RELATIVE_BINARY_PATH}"
|
||||||
|
;;
|
||||||
|
coder)
|
||||||
|
if [[ ! -x "${CODER_DEV_BIN}" ]]; then
|
||||||
|
# A feature requiring the full binary was requested and the
|
||||||
|
# binary is missing, normally it's built by `develop.sh`, but
|
||||||
|
# it's an expensive operation, so we require manual action here.
|
||||||
|
echo "Running \"coder $1\" requires the full binary, please run \"develop.sh\" first or build the binary manually:" 1>&2
|
||||||
|
echo " make $RELATIVE_BINARY_PATH" 1>&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Unknown binary type: $BINARY_TYPE"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
exec "${CODER_DEV_BIN}" --global-config "${CODER_DEV_DIR}" "$@"
|
exec "${CODER_DEV_BIN}" --global-config "${CODER_DEV_DIR}" "$@"
|
||||||
|
Reference in New Issue
Block a user