diff options
author | Mariana Rios Flores <mariari@microsoft.com> | 2016-07-28 18:55:07 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-07-28 18:55:07 +0300 |
commit | 7e2bd07936179c192e682d979b2938b4a7e32030 (patch) | |
tree | 82f02ba880212b2bba0fdef0ed42e7f37b075aab /clean.sh | |
parent | a6e95d3db3e002b589176a107f7cc79520e37de4 (diff) |
Changing dev workflow scripts to use the Run Command Tool (#10231)
Changes to dev workflow scripts to use run command tool.
Diffstat (limited to 'clean.sh')
-rwxr-xr-x | clean.sh | 121 |
1 files changed, 13 insertions, 108 deletions
@@ -5,122 +5,27 @@ usage() echo "Usage: clean [options]" echo "Cleans the local dev environment." echo - echo " -b Delete the binary output directory" - echo " -p Delete the repo-local NuGet package directory" - echo " -c Delete the user-local NuGet package caches" - echo " -t Delete the tools directory" - echo " -s Remove all untracked files under the src directory" - echo " -a, --all Clean all of the above" + echo " -b Delete the binary output directory." + echo " -p Delete the repo-local NuGet package directory." + echo " -c Delete the user-local NuGet package caches." + echo " --all Cleans the root directory." echo echo "If no option is specified, then \"clean.sh -b\" is implied." exit 1 } -check_exit_status() -{ - ExitStatus=$? - if [ $ExitStatus -ne 0 ] - then - echo "Command exited with exit status $ExitStatus" >> $CleanLog - CleanSuccessful=false - fi -} - -WorkingTreeRoot="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -CleanLog=$WorkingTreeRoot/clean.log +__working_tree_root="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -options="/nologo /v:minimal /clp:Summary /flp:v=detailed;Append;LogFile=$CleanLog" -unprocessedBuildArgs= -CleanSuccessful=true -CleanTargets= - -echo "Running clean.sh $*" > $CleanLog - -# Parse arguments -if [ $# == 0 ] +if [ $* == -all ] then - CleanTargets="Clean;" + echo "Removing all untracked files in the working tree" + git clean -xdf $__working_tree_root + exit $? fi -while [[ $# > 0 ]] -do - opt="$1" - case $opt in - -h|--help) - usage - ;; - -b) - CleanTargets="Clean;$CleanTargets" - ;; - -p) - CleanTargets="CleanPackages;$CleanTargets" - ;; - -c) - CleanTargets="CleanPackagesCache;$CleanTargets" - ;; - -t) - CleanToolsDir=true - ;; - -s) - CleanSrc=true - ;; - -a|--all) - CleanWorkingTree=true - CleanTargets="Clean;CleanPackages;CleanPackagesCache;" - ;; - *) - unprocessedBuildArgs="$unprocessedBuildArgs $1" - esac - shift -done - -if [ -n "$CleanTargets" ] -then - # Ensure that MSBuild is available - echo "Running init-tools.sh" - $WorkingTreeRoot/init-tools.sh - - # Trim the trailing semicolon from the targets string - CleanTargetsTrimmed=${CleanTargets:0:${#CleanTargets}-1} - - echo "Running MSBuild target(s): $CleanTargetsTrimmed" - echo -e "\n$WorkingTreeRoot/Tools/dotnetcli/dotnet $WorkingTreeRoot/Tools/MSBuild.exe $WorkingTreeRoot/build.proj /t:$CleanTargetsTrimmed $options $unprocessedBuildArgs" >> $CleanLog - $WorkingTreeRoot/Tools/dotnetcli/dotnet $WorkingTreeRoot/Tools/MSBuild.exe $WorkingTreeRoot/build.proj /t:$CleanTargetsTrimmed $options $unprocessedBuildArgs - check_exit_status +if [ $# == 0 ]; then + __args=-b fi -if [ "$CleanToolsDir" == true ] && [ "$CleanWorkingTree" != true ] -then - echo "Removing Tools directory" - # This directory cannot be removed in a build target because MSBuild is in the Tools directory - echo -e "\nrm -rf $WorkingTreeRoot/Tools" >> $CleanLog - rm -rf $WorkingTreeRoot/Tools >> $CleanLog - check_exit_status -fi - -if [ "$CleanSrc" == true ] && [ "$CleanWorkingTree" != true ] -then - echo "Removing all untracked files in the src directory" - echo -e "\ngit clean -xdf $WorkingTreeRoot/src" >> $CleanLog - git clean -xdf $WorkingTreeRoot/src >> $CleanLog - check_exit_status -fi - -if [ "$CleanWorkingTree" == true ] -then - echo "Removing all untracked files in the working tree" - echo -e "\ngit clean -xdf -e clean.log $WorkingTreeRoot" >> $CleanLog - git clean -xdf -e clean.log $WorkingTreeRoot >> $CleanLog - check_exit_status -fi - -if [ "$CleanSuccessful" == true ] -then - echo "Clean completed successfully." - echo -e "\nClean completed successfully." >> $CleanLog - exit 0 -else - echo "An error occured while cleaning; see $CleanLog for more details." - echo -e "\nClean completed with errors." >> $CleanLog - exit 1 -fi +$__working_tree_root/run.sh clean $__args $* +exit $? |