Revert "[ARM32/Linux] Copy tests.zip only for CI test and use x86 unittest"
[platform/upstream/coreclr.git] / clean.sh
1 #!/usr/bin/env bash
2
3 usage()
4 {
5     echo "Usage: clean [-b] [-t] [-p]"
6     echo "Repository cleaning script."
7     echo "  -b         Clean bin directory"
8     echo "  -t         Clean tools directory"
9     echo "  -p         Clean packages directory"
10     echo "  -all       Clean everything"
11     echo
12     echo "If no option is specified, then \"clean.sh -b -t -p\" is implied."
13     exit 1
14 }
15
16 # Obtain the location of the bash script to figure out where the root of the repo is.
17 __ProjectRoot="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
18
19 echo Cleaning previous output for the selected configuration
20
21 # Parse arguments
22 if [ $# == 0 ]; then
23     clean_bin=true
24     clean_tools=true
25     clean_packages=true
26 fi
27
28 while [[ $# -gt 0 ]]
29 do
30     opt="$1"
31     case $opt in
32         -h|--help)
33         usage
34         ;;
35         -b)
36         clean_bin=true
37         ;;
38         -t)
39         clean_tools=true
40         ;;
41         -p)
42         clean_packages=true
43         ;;
44         -all)
45         clean_bin=true
46         clean_tools=true
47         clean_packages=true
48         ;;
49         *)
50     esac
51     shift
52 done
53
54 if [ "$clean_bin" == true ]; then
55         echo "Deleting bin directory"
56         rm -rf "$__ProjectRoot/bin"
57         if [ $? -ne 0 ]; then
58         echo "Error while deleting bin directory - error code was $?"
59         exit 1
60     fi
61 fi
62
63 if [ "$clean_tools" == true ]; then
64         echo "Deleting tools directory"
65         rm -rf "$__ProjectRoot/Tools"
66         if [ $? -ne 0 ]; then
67         echo "Error while deleting tools directory - error code was $?"
68         exit 1
69     fi
70 fi
71
72 if [ "$clean_packages" == true ]; then
73         echo "Deleting packages directory"
74         rm -rf "$__ProjectRoot/packages"
75         if [ $? -ne 0 ]; then
76         echo "Error while deleting packages directory - error code was $?"
77         exit 1
78     fi
79 fi
80
81 echo "Clean was successful"
82
83 exit 0