Patch #3303 2012-07-09 14:42

hl2gordon

Enhance the provided batch build scripts
Download
3303-Enhance_the_pr.patch (13.2 KB)
Category
Application::Refinement
Status
Accepted
Close date
2013-03-20 14:22
Assigned to
biplab
Index: src/batch_rebuild_plugins.bat
===================================================================
--- src/batch_rebuild_plugins.bat    (revision 8096)
+++ src/batch_rebuild_plugins.bat    (working copy)
@@ -2,35 +2,39 @@
 rem ----------------------------------------
 rem Setup C::B root folder of *binaries* (!)
 rem ----------------------------------------
-set CB_ROOT=C:\Devel\CodeBlocks
+if not defined CB_ROOT set CB_ROOT=C:\Devel\CodeBlocks
 rem ------------------------------------------
 rem Setup GCC root folder with "bin" subfolder
 rem ------------------------------------------
-set GCC_ROOT=C:\Devel\GCC46TDM
+if not defined GCC_ROOT set GCC_ROOT=C:\Devel\GCC46TDM
+rem change this name to suit your needs
+if not defined CB_RUN_UPDATE_BAT set CB_RUN_UPDATE_BAT=0
 
 rem -------------------------------------------
 rem Usually below here no changes are required.
 rem -------------------------------------------
 if not exist "%CB_ROOT%"  goto ErrNoCB
 if not exist "%GCC_ROOT%" goto ErrNoGCC
-set PATH=%CB_ROOT%;%GCC_ROOT%;%PATH%
+rem quotes are here to prevent problems with spaces in paths
+set "PATH=%CB_ROOT%;%GCC_ROOT%;%PATH%"
 
-set START_CMD=start "Code::Blocks Build" /D%~dp0 /min /b
+if not defined START_CMD set "START_CMD=start "Code::Blocks Build" /D%~dp0 /min /b"
 set CB_EXE="%CB_ROOT%\codeblocks.exe"
-set CB_PARAMS=--batch-build-notify --no-batch-window-close
+if not defined CB_PARAMS set CB_PARAMS=--batch-build-notify --no-batch-window-close
 set CB_CMD=--rebuild "%~dp0ContribPlugins.workspace"
 
-set CB_TARGET=--target=All
+if not defined CB_TARGET set CB_TARGET=--target=All
 %START_CMD% %CB_EXE% %CB_PARAMS% %CB_TARGET% %CB_CMD%
-echo Do not forget to run "update.bat" after successful build!
+echo.
+if %CB_RUN_UPDATE_BAT% NEQ 0 call "%~dp0update.bat" else echo Do not forget to run "update.bat" after successful build!
 goto TheEnd
 
 :ErrNoCB
-echo Error: C::B root folder not found. Adjust batch file accordingly
+echo Error: C::B root folder not found. Adjust batch file or supply parameter accordingly
 goto TheEnd
 
 :ErrNoGCC
-echo Error: GCC root folder not found. Adjust batch file accordingly
+echo Error: GCC root folder not found. Adjust batch file or supply parameter accordingly
 goto TheEnd
 
 :TheEnd
Index: src/batch_build_all.bat
===================================================================
--- src/batch_build_all.bat    (revision 8096)
+++ src/batch_build_all.bat    (working copy)
@@ -2,35 +2,39 @@
 rem ----------------------------------------
 rem Setup C::B root folder of *binaries* (!)
 rem ----------------------------------------
-set CB_ROOT=C:\Devel\CodeBlocks
+if not defined CB_ROOT set CB_ROOT=C:\Devel\CodeBlocks
 rem ------------------------------------------
 rem Setup GCC root folder with "bin" subfolder
 rem ------------------------------------------
-set GCC_ROOT=C:\Devel\GCC46TDM
+if not defined GCC_ROOT set GCC_ROOT=C:\Devel\GCC46TDM
+rem change this name to suit your needs
+if not defined CB_RUN_UPDATE_BAT set CB_RUN_UPDATE_BAT=0
 
 rem -------------------------------------------
 rem Usually below here no changes are required.
 rem -------------------------------------------
 if not exist "%CB_ROOT%"  goto ErrNoCB
 if not exist "%GCC_ROOT%" goto ErrNoGCC
-set PATH=%CB_ROOT%;%GCC_ROOT%;%PATH%
+rem quotes are here to prevent problems with spaces in paths
+set "PATH=%CB_ROOT%;%GCC_ROOT%;%PATH%"
 
-set START_CMD=start "Code::Blocks Build" /D%~dp0 /min /b
+if not defined START_CMD set "START_CMD=start "Code::Blocks Build" /D%~dp0 /min /b"
 set CB_EXE="%CB_ROOT%\codeblocks.exe"
-set CB_PARAMS=--batch-build-notify --no-batch-window-close
+if not defined CB_PARAMS set CB_PARAMS=--batch-build-notify --no-batch-window-close
 set CB_CMD=--build "%~dp0CodeBlocks.workspace"
 
-set CB_TARGET=--target=All
+if not defined CB_TARGET set CB_TARGET=--target=All
 %START_CMD% %CB_EXE% %CB_PARAMS% %CB_TARGET% %CB_CMD%
-echo Do not forget to run "update.bat" after successful build!
+echo.
+if %CB_RUN_UPDATE_BAT% NEQ 0 call "%~dp0update.bat" else echo Do not forget to run "update.bat" after successful build!
 goto TheEnd
 
 :ErrNoCB
-echo Error: C::B root folder not found. Adjust batch file accordingly
+echo Error: C::B root folder not found. Adjust batch file or supply parameter accordingly
 goto TheEnd
 
 :ErrNoGCC
-echo Error: GCC root folder not found. Adjust batch file accordingly
+echo Error: GCC root folder not found. Adjust batch file or supply parameter accordingly
 goto TheEnd
 
 :TheEnd
Index: src/batch_build_core.bat
===================================================================
--- src/batch_build_core.bat    (revision 8096)
+++ src/batch_build_core.bat    (working copy)
@@ -2,35 +2,39 @@
 rem ----------------------------------------
 rem Setup C::B root folder of *binaries* (!)
 rem ----------------------------------------
-set CB_ROOT=C:\Devel\CodeBlocks
+if not defined CB_ROOT set CB_ROOT=C:\Devel\CodeBlocks
 rem ------------------------------------------
 rem
download for full patch...