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