-
Notifications
You must be signed in to change notification settings - Fork 1
/
mcip
76 lines (64 loc) · 1.96 KB
/
mcip
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/bin/bash
# Initialize our own variables:
init=false
watch=""
target="debug"
clean=false
package_only=false
# Read the options
TEMP=`getopt -o hiw:t:cp --long help,init,watch:,target:,clean,package-only -n 'build_script' -- "$@"`
eval set -- "$TEMP"
# Extract options and their arguments into variables
while true ; do
case "$1" in
-h|--help)
echo "Build and package the addon."
echo "Options:"
echo "[--init | -i] -> Initialize 'BP/scripts' folder if it does not exist."
echo "[--watch | -w] <opt: stable, preview, server> -> Whether to continually build and where to sync the project while editing it."
echo -e "[--target] <opt: release, debug, server> -> Whether to build the addon in debug or release mode. Default is 'debug'. \nCan Generate Config out of settings.json"
echo "[--clean | -c] -> Clean 'BP/scripts' folder before building."
echo "[--package-only | -p] -> Only package what's already there."
exit 0 ;;
-i|--init)
init=true ; shift ;;
-w|--watch)
watch=$2 ; shift 2 ;;
--target)
if ! $init ; then
target=$2
fi
shift 2 ;;
-c|--clean)
clean=true ; shift ;;
-p|--package-only)
package_only=true ; shift ;;
--) shift ; break ;;
*) echo "Internal error!" ; exit 1 ;;
esac
done
# Build the command
command="python tools/build.py"
command2="python tools/process_config.py --generateConfigTS"
if $init; then
command+=" --init"
fi
if [[ ! -z "$watch" ]]; then
command+=" --watch $watch"
fi
if ! $init; then
command+=" --target $target"
fi
if $clean; then
command+=" --clean"
fi
if $package_only; then
command+=" --package-only"
fi
# Execute the command
eval $command
# Execute command2 if --init was called
if $init; then
command="python tools/process_manifest.py --init"
eval $command2
fi