forked from Samsung/TizenFX
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·75 lines (63 loc) · 1.72 KB
/
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/bin/bash
SCRIPT_FILE=$(readlink -f $0)
SCRIPT_DIR=$(dirname $SCRIPT_FILE)
OUTDIR=$SCRIPT_DIR/Artifacts
RETRY_CMD="$SCRIPT_DIR/tools/retry.sh"
TIMEOUT_CMD="$SCRIPT_DIR/tools/timeout.sh"
DOTNET_CMD="$RETRY_CMD $TIMEOUT_CMD 600 dotnet"
RUN_BUILD="$DOTNET_CMD msbuild $SCRIPT_DIR/build/build.proj /nologo"
usage() {
echo "Usage: %0 [command] [args]"
echo "Commands:"
echo " build [module] Build a specific module"
echo " full Build all modules in src/ directory"
echo " dummy Generate dummy assemblies of all modules"
echo " pack [version] Make a NuGet package with build artifacts"
echo " clean Clean all artifacts"
}
cmd_build() {
if [ -z "$1" ]; then
echo "No module specified."
exit 1
fi
if [ -d /nuget ]; then
NUGET_SOURCE_OPT="/p:RestoreSources=/nuget"
fi
$RUN_BUILD /t:restore /p:Project=$1 $NUGET_SOURCE_OPT
$RUN_BUILD /t:build /p:Project=$1
}
cmd_full_build() {
if [ -d /nuget ]; then
NUGET_SOURCE_OPT="/p:RestoreSources=/nuget"
fi
$RUN_BUILD /t:clean
$RUN_BUILD /t:restore $NUGET_SOURCE_OPT
$RUN_BUILD /t:build
}
cmd_dummy_build() {
if [ -d /nuget ]; then
NUGET_SOURCE_OPT="/p:RestoreSources=/nuget"
fi
$RUN_BUILD /t:dummy $NUGET_SOURCE_OPT
$RUN_BUILD /t:afterdummy
}
cmd_pack() {
VERSION=$1
if [ -z "$VERSION" ]; then
TIMESTAMP=$(date +"%s")
VERSION="5.0.0-local-$TIMESTAMP"
fi
$RUN_BUILD /t:pack /p:Version=$VERSION
}
cmd_clean() {
$RUN_BUILD /t:clean
}
cmd=$1; shift;
case "$cmd" in
build|--build|-b) cmd_build $@ ;;
full |--full |-f) cmd_full_build $@ ;;
dummy|--dummy|-d) cmd_dummy_build $@ ;;
pack |--pack |-p) cmd_pack $@ ;;
clean|--clean|-c) cmd_clean $@ ;;
*) usage ;;
esac