-
-
Notifications
You must be signed in to change notification settings - Fork 42
Expand file tree
/
Copy pathbuild_utils.sh
More file actions
61 lines (56 loc) · 1.55 KB
/
Copy pathbuild_utils.sh
File metadata and controls
61 lines (56 loc) · 1.55 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/bash
set -e
# include this in other bash scripts with the following line:
#
# source "$(dirname "$0")/build_utils.sh"
#
# Prints a timestamp + title for a step/section
function checkpoint {
local delimiter="--------------------------------------------------------------------------------"
echo ""
echo ""
echo "$delimiter"
echo "--- $(date +'%T') --- $1 "
echo "$delimiter"
echo ""
}
# Shared --spm-mode argument parsing for build_npm_ios.sh / build_npm_vision.sh.
# Sets SPM_MODE (embedded|remote, default embedded). The calling script must
# define usage(); accepts both "--spm-mode <mode>" and "--spm-mode=<mode>".
function parse_spm_mode_args {
SPM_MODE="embedded"
while [ $# -gt 0 ]; do
case "$1" in
--spm-mode)
if [ $# -lt 2 ]; then
echo "--spm-mode requires a value" >&2
usage >&2
exit 1
fi
SPM_MODE="$2"
shift 2
;;
--spm-mode=*)
SPM_MODE="${1#*=}"
shift
;;
-h|--help)
usage
exit 0
;;
*)
echo "Unknown argument: $1" >&2
usage >&2
exit 1
;;
esac
done
case "$SPM_MODE" in
embedded|remote) ;;
*)
echo "Invalid --spm-mode '$SPM_MODE' (expected embedded or remote)" >&2
usage >&2
exit 1
;;
esac
}