Merge branch 'master' into master-mere
[platform/upstream/coreclr.git] / clean.sh
1 #!/usr/bin/env bash
2
3 usage()
4 {
5     echo "Usage: clean [-b] [-p] [-c] [-all]"
6     echo "Repository cleaning script."
7     echo "  -b         Delete the binary output directory."
8     echo "  -p         Delete the repo-local NuGet package directory."
9     echo "  -c         Delete the user-local NuGet package caches."
10     echo "  -all       Cleans repository and restores it to pristine state."
11     echo
12     echo "If no option is specified, then \"clean.sh -b\" is implied."
13     exit 1
14 }
15
16 if [ "$1" == "-?" ] || [ "$1" == "-h" ]; then
17     usage
18 fi
19
20 # Implement VBCSCompiler.exe kill logic once VBCSCompiler.exe is ported to unixes
21
22 __working_tree_root="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
23
24 if [ "$*" == "-all" ]
25 then
26    echo "Removing all untracked files in the working tree"
27    git clean -xdf $__working_tree_root
28    exit $?
29 fi
30
31 if [ $# == 0 ]; then
32     __args=-b
33 fi
34
35 $__working_tree_root/run.sh clean $__args $*
36 exit $?