Skip to content

Commit af08e2c

Browse files
committed
feat: Improve build directory creation and clean-up
1 parent f88b8b9 commit af08e2c

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Build.cmd

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,9 @@ FOR /F "usebackq tokens=1* delims==" %%A IN (`CALL GetVersion.cmd %Mode%`) DO SE
8383
REM Restore NuGet packages.
8484
nuget restore Source\ORTS.sln || GOTO :error
8585

86-
REM Recreate Program directory for output.
86+
REM Recreate Program directory for output and delete previous build files.
8787
CALL :recreate "Program" || GOTO :error
88+
CALL :delete "OpenRails-%Mode%*" || GOTO :error
8889

8990
REM Build main program.
9091
REM Disable warning CS1591 "Missing XML comment for publicly visible type or member".
@@ -126,8 +127,9 @@ IF NOT "%Mode%" == "Unstable" (
126127
NET stop ClickToRunSvc
127128
NET start ClickToRunSvc
128129

129-
REM Recreate Documentation folder for output.
130-
CALL :recreate "Program\Documentation" || GOTO :error
130+
REM Create the documentation folders for output.
131+
CALL :create "Program\Documentation" || GOTO :error
132+
CALL :create "Program\Documentation\es" || GOTO :error
131133

132134
REM Compile the documentation.
133135
FOR %%E IN (doc docx docm xls xlsx xlsm odt) DO FOR %%F IN ("Source\Documentation\*.%%E") DO ECHO %%~F && OfficeToPDF.exe /bookmarks /print "%%~F" "Program\Documentation\%%~nF.pdf" || GOTO :error
@@ -139,7 +141,6 @@ IF NOT "%Mode%" == "Unstable" (
139141
REM Copy the documentation.
140142
FOR %%F IN ("Source\Documentation\*.pdf") DO CALL :copy "%%~F" "Program\Documentation\%%~nF.pdf" || GOTO :error
141143
CALL :copy "Source\Documentation\Manual\_build\latex\Manual.pdf" "Program\Documentation\Manual.pdf" || GOTO :error
142-
CALL :create "Program\Documentation\es"
143144
CALL :copy "Source\Documentation\Manual\es\Manual.pdf" "Program\Documentation\es\Manual.pdf" || GOTO :error
144145
ROBOCOPY /MIR /NJH /NJS "Source\Documentation\SampleFiles" "Program\Documentation\SampleFiles"
145146
IF %ERRORLEVEL% GEQ 8 GOTO :error
@@ -161,7 +162,6 @@ IF "%Mode%" == "Stable" (
161162
)
162163

163164
REM Create binary and source zips.
164-
CALL :delete "OpenRails-%Mode%*.zip" || GOTO :error
165165
PUSHD "Program" && 7za.exe a -r -tzip -x^^!*.xml "..\OpenRails-%Mode%.zip" . && POPD || GOTO :error
166166
7za.exe a -r -tzip -x^^!.* -x^^!obj -x^^!lib -x^^!_build -x^^!*.bak "OpenRails-%Mode%-Source.zip" "Source" || GOTO :error
167167

0 commit comments

Comments
 (0)