[Connection] Remove deprecated API (#358)
[platform/core/csapi/tizenfx.git] / build.sh
1 #!/bin/bash
2
3 SCRIPT_FILE=$(readlink -f $0)
4 SCRIPT_DIR=$(dirname $SCRIPT_FILE)
5
6 OUTDIR=$SCRIPT_DIR/Artifacts
7
8 RETRY_CMD="$SCRIPT_DIR/tools/scripts/retry.sh"
9 TIMEOUT_CMD="$SCRIPT_DIR/tools/scripts/timeout.sh"
10 DOTNET_CMD="$RETRY_CMD $TIMEOUT_CMD 600 dotnet"
11
12 RUN_BUILD="$DOTNET_CMD msbuild $SCRIPT_DIR/build/build.proj /nologo"
13
14 usage() {
15   echo "Usage: %0 [command] [args]"
16   echo "Commands:"
17   echo "    build [module]     Build a specific module"
18   echo "    full               Build all modules in src/ directory"
19   echo "    dummy              Generate dummy assemblies of all modules"
20   echo "    pack [version]     Make a NuGet package with build artifacts"
21   echo "    clean              Clean all artifacts"
22 }
23
24 cmd_build() {
25   if [ -z "$1" ]; then
26     echo "No module specified."
27     exit 1
28   fi
29   if [ -d /nuget ]; then
30     NUGET_SOURCE_OPT="/p:RestoreSources=/nuget"
31   fi
32   $RUN_BUILD /t:restore /p:Project=$1 $NUGET_SOURCE_OPT
33   $RUN_BUILD /t:build /p:Project=$1
34 }
35
36 cmd_full_build() {
37   if [ -d /nuget ]; then
38     NUGET_SOURCE_OPT="/p:RestoreSources=/nuget"
39   fi
40   $RUN_BUILD /t:clean
41   $RUN_BUILD /t:restore $NUGET_SOURCE_OPT
42   $RUN_BUILD /t:build
43 }
44
45 cmd_dummy_build() {
46   if [ -d /nuget ]; then
47     NUGET_SOURCE_OPT="/p:RestoreSources=/nuget"
48   fi
49   $RUN_BUILD /t:restore $NUGET_SOURCE_OPT
50   $RUN_BUILD /t:dummy $NUGET_SOURCE_OPT
51 }
52
53 cmd_pack() {
54   VERSION=$1
55   if [ -z "$VERSION" ]; then
56     TIMESTAMP=$(date +"%s")
57     VERSION="5.0.0-local-$TIMESTAMP"
58   fi
59
60   $RUN_BUILD /t:pack /p:Version=$VERSION
61 }
62
63 cmd_clean() {
64   $RUN_BUILD /t:clean
65 }
66
67 cmd=$1; shift;
68 case "$cmd" in
69   build|--build|-b) cmd_build $@ ;;
70   full |--full |-f) cmd_full_build $@ ;;
71   dummy|--dummy|-d) cmd_dummy_build $@ ;;
72   pack |--pack |-p) cmd_pack $@ ;;
73   clean|--clean|-c) cmd_clean $@ ;;
74   *) usage ;;
75 esac