@@ -10,7 +10,11 @@ source "${SCRIPT_DIR}/lib.sh"
10
10
11
11
GOOS=" $( go env GOOS) "
12
12
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} "
14
18
15
19
# To preserve the CWD when running the binary, we need to use pushd and popd to
16
20
# get absolute paths to everything.
@@ -20,10 +24,26 @@ CODER_DEV_BIN="$(realpath "$RELATIVE_BINARY_PATH")"
20
24
CODER_DEV_DIR=" $( realpath ./.coderv2) "
21
25
popd
22
26
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 "
26
45
exit 1
27
- fi
46
+ ;;
47
+ esac
28
48
29
49
exec " ${CODER_DEV_BIN} " --global-config " ${CODER_DEV_DIR} " " $@ "
0 commit comments