[NUI] Add dali-atspi getState(), say(), say_callback() and pauseResume() as HiddenAPI...
[platform/core/csapi/tizenfx.git] / build.sh
1 #!/bin/bash -e
2
3 SCRIPT_FILE=$(readlink -f $0)
4 SCRIPT_DIR=$(dirname $SCRIPT_FILE)
5
6 OUTDIR=$SCRIPT_DIR/Artifacts
7
8 RUN_BUILD="dotnet msbuild $SCRIPT_DIR/build/build.proj /nologo"
9
10 VERSION_PREFIX=6.0.0
11
12 usage() {
13   echo "Usage: $0 [command] [args]"
14   echo "Commands:"
15   echo "    build [module]     Build a specific module"
16   echo "    full               Build all modules in src/ directory"
17   echo "    dummy              Generate dummy assemblies of all modules"
18   echo "    pack [version]     Make a NuGet package with build artifacts"
19   echo "    install [target]   Install assemblies to the target device"
20   echo "    clean              Clean all artifacts"
21 }
22
23 cmd_build() {
24   if [ -z "$1" ]; then
25     echo "No module specified."
26     exit 1
27   fi
28   if [ -d /nuget ]; then
29     NUGET_SOURCE_OPT="/p:RestoreSources=/nuget"
30   fi
31   PROJECT=$1; shift
32   $RUN_BUILD /t:restore /p:Project=$PROJECT $NUGET_SOURCE_OPT $@
33   $RUN_BUILD /t:build /p:Project=$PROJECT $@
34 }
35
36 cmd_full_build() {
37   if [ -d /nuget ]; then
38     NUGET_SOURCE_OPT="/p:RestoreSources=/nuget"
39   fi
40   rm -f msbuild.log
41   $RUN_BUILD /t:clean
42   $RUN_BUILD /t:restore $NUGET_SOURCE_OPT $@
43   $RUN_BUILD /t:build /fl $@
44   $RUN_BUILD /t:dummy
45 }
46
47 cmd_dummy_build() {
48   $RUN_BUILD /t:dummy
49 }
50
51 cmd_pack() {
52   VERSION=$1
53   if [ -z "$VERSION" ]; then
54     pushd $SCRIPT_DIR > /dev/null
55     VERSION=$VERSION_PREFIX.$((10000+$(git rev-list --count HEAD)))
56     popd > /dev/null
57   fi
58
59   $RUN_BUILD /t:pack /p:Version=$VERSION
60 }
61
62 cmd_install() {
63   DEVICE_ID=$1
64
65   RUNTIME_ASSEMBLIES="$OUTDIR/bin/public/*.dll $OUTDIR/bin/internal/*.dll"
66   TARGET_ASSEMBLY_PATH="/usr/share/dotnet.tizen/framework"
67
68   device_cnt=$(sdb devices | grep -v "List" | wc -l)
69   if [ $device_cnt -eq 0 ]; then
70     echo "No connected devices"
71     exit 1
72   fi
73
74   if [ $device_cnt -gt 1 ] && [ -z "$DEVICE_ID" ]; then
75     echo "Multiple devices are connected. Specify the device. (ex: ./build.sh install [device-id])"
76     sdb devices
77     exit 1
78   fi
79
80   SDB_OPTIONS=""
81   if [ -n "$DEVICE_ID" ]; then
82     SDB_OPTIONS="-s $DEVICE_ID"
83   fi
84
85   sdb $SDB_OPTIONS root on
86   sdb $SDB_OPTIONS shell mount -o remount,rw /
87   sdb $SDB_OPTIONS push $RUNTIME_ASSEMBLIES $TARGET_ASSEMBLY_PATH
88
89   nifile_cnt=$(sdb $SDB_OPTIONS shell find $TARGET_ASSEMBLY_PATH -name '*.ni.dll' | wc -l)
90   if [ $nifile_cnt -gt 0 ]; then
91     sdb $SDB_OPTIONS shell "rm -f $TARGET_ASSEMBLY_PATH/*.ni.dll"
92     sdb $SDB_OPTIONS shell nitool --system
93     sdb $SDB_OPTIONS shell nitool --regen-all-app
94   fi
95
96   sdb $SDB_OPTIONS shell chsmack -a '_' $TARGET_ASSEMBLY_PATH/*
97 }
98
99 cmd_clean() {
100   $RUN_BUILD /t:clean
101 }
102
103 cmd=$1; shift;
104 case "$cmd" in
105   build|--build|-b) cmd_build $@ ;;
106   full |--full |-f) cmd_full_build $@ ;;
107   dummy|--dummy|-d) cmd_dummy_build $@ ;;
108   pack |--pack |-p) cmd_pack $@ ;;
109   install |--install |-i) cmd_install $@ ;;
110   clean|--clean|-c) cmd_clean $@ ;;
111   *) usage ;;
112 esac