-
Notifications
You must be signed in to change notification settings - Fork 3
/
mcip
76 lines (65 loc) · 2.12 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
dev=false
# Read the options
TEMP=`getopt -o hiw:t:cpd --long help,init,watch:,target:,clean,package-only,dev -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."
echo "[--dev | -d] -> The usual watch and target debug"
echo "-----------------------------------------------------------"
echo "Debugging: ./mcip --watch \"stable\" --target \"debug\" "
echo "Building: ./mcip --target \"release\" "
exit 0 ;;
-i|--init)
init=true ; shift ;;
-w|--watch)
watch=$2 ; shift 2 ;;
--target)
target=$2 ; shift 2 ;;
-c|--clean)
clean=true ; shift ;;
-p|--package-only)
package_only=true ; shift ;;
-d|--dev)
dev=true ; shift ;;
--) shift ; break ;;
*) echo "Internal error!" ; exit 1 ;;
esac
done
# Set default values for dev option
if $dev; then
watch="stable"
target="debug"
fi
# Build the command
command="python tools/build.py"
if $init; then
command+=" --init"
fi
if [[ ! -z "$watch" ]]; then
command+=" --watch $watch"
fi
command+=" --target $target"
if $clean; then
command+=" --clean"
fi
if $package_only; then
command+=" --package-only"
fi
# Execute the command
eval $command