-
Notifications
You must be signed in to change notification settings - Fork 19
/
build.sh
executable file
·52 lines (43 loc) · 957 Bytes
/
build.sh
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
#!/bin/bash
SCRIPT_FILE=$(readlink -f $0)
SCRIPT_DIR=$(dirname $SCRIPT_FILE)
EXAMPLES=$(ls $SCRIPT_DIR)
BUILD_COMMAND="build -warnaserror"
CLEAN_COMMAND="clean"
ERROR=0
Run()
{
DOTNET_COMMAND=$1
for example in $EXAMPLES
do
if [[ -d $example ]]
then
cd $example
echo "********************************************************"
echo "Building $example"
echo "********************************************************"
command="dotnet $DOTNET_COMMAND"
echo $command
eval $command || ERROR=$?
cd ..
fi
done
}
Usage() {
echo "Usage: $0 [command]"
echo "Commands:"
echo " full Build all examples (default if no option)"
echo " clean Clean all examples"
}
if [[ $1 = "" ]]
then
Run $BUILD_COMMAND
else
CMD=$1; shift;
case "$CMD" in
full |--full |-f) Run $BUILD_COMMAND ;;
clean|--clean|-c) Run $CLEAN_COMMAND ;;
*) Usage ;;
esac
fi
exit $ERROR