-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcleanup.bat
51 lines (38 loc) · 1.2 KB
/
cleanup.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
@echo off
setlocal enabledelayedexpansion
set _DEBUG=0
@rem #########################################################################
@rem ## Environment setup
set _EXITCODE=0
call :env
if not %_EXITCODE%==0 goto end
@rem #########################################################################
@rem ## Main
for %%i in (effective-kotlin examples how-to-kotlin kotlin-cookbook learn-kotlin) do (
call :clean_projects "%_ROOT_DIR%%%i"
if not !_EXITCODE!==0 goto end
)
goto end
@rem #########################################################################
@rem ## Subroutines
:env
set _BASENAME=%~n0
set "_ROOT_DIR=%~dp0"
set _DEBUG_LABEL=[%_BASENAME%]
set _ERROR_LABEL=Error:
goto :eof
:clean_projects
set "__EXAMPLES_DIR=%~1"
for /f "delims=" %%f in ('dir /b /s "%__EXAMPLES_DIR%\build.bat"') do (
set "__BATCH_FILE=%%f"
if %_DEBUG%==1 ( echo %_DEBUG_LABEL% "%__BATCH_FILE%" clean 1>&2
) else ( echo Execute command "!__BATCH_FILE:%_ROOT_DIR%=!" clean 1>&2
)
call "!__BATCH_FILE!" clean
)
goto :eof
@rem #########################################################################
@rem ## Cleanups
:end
if %_DEBUG%==1 echo %_DEBUG_LABEL% _EXITCODE=%_EXITCODE% 1>&2
exit /b %_EXITCODE%