0805543f8d0b2750fd9dd19497f80fa40e0db509
[platform/upstream/coreclr.git] / clean.cmd
1 @if not defined _echo @echo off
2 setlocal EnableDelayedExpansion
3
4 set NO_DASHES_ARG=%1
5 if /I [%NO_DASHES_ARG:-=%] == [?] goto Usage
6 if /I [%NO_DASHES_ARG:-=%] == [h] goto Usage
7
8 :: Check if VBCSCompiler.exe is running
9 tasklist /fi "imagename eq VBCSCompiler.exe" |find ":" > nul
10 :: Compiler is running if errorlevel == 1
11 if errorlevel 1 (
12         echo Stop VBCSCompiler.exe execution.
13         for /f "tokens=2 delims=," %%F in ('tasklist /nh /fi "imagename eq VBCSCompiler.exe" /fo csv') do taskkill /f /PID %%~F
14 )
15
16 :: Strip all dashes off the argument and use invariant
17 :: compare to match as many versions of "all" that we can
18 :: All other argument validation happens inside Run.exe
19 if not defined NO_DASHES_ARG goto no_args
20 if /I [%NO_DASHES_ARG:-=%] == [all] (
21   echo Cleaning entire working directory ...
22   call git clean -xdf
23   exit /b !ERRORLEVEL!
24 )
25
26 :no_args
27 if [%1]==[] set __args=-b
28 call %~dp0run.cmd clean %__args% %*
29 exit /b %ERRORLEVEL%
30
31 :Usage
32 echo.
33 echo Usage: clean [-b] [-p] [-c] [-all]
34 echo Repository cleaning script.
35 echo Options:
36 echo     -b     - Delete the binary output directory.
37 echo     -p     - Delete the repo-local NuGet package directory.
38 echo     -c     - Deletes the user-local NuGet package cache.
39 echo     -all   - Cleans repository and restores it to pristine state.
40 echo.
41 echo ^If no option is specified then "clean -b" is implied.
42 exit /b