Index: scripts/internal/detect_internal_version.bat =================================================================== diff -u -N --- scripts/internal/detect_internal_version.bat (revision 0) +++ scripts/internal/detect_internal_version.bat (revision 6ee1dfea13b6871982655b160a571b78ff2e924e) @@ -0,0 +1,63 @@ +@echo off + +rem setlocal ENABLEDELAYEDEXPANSION + +rem Validate input parameters +if [%1] == [] ( + echo Usage: detect_version_internal.bat path + goto end +) + +echo * Scanning directory for version number +rem Get SVN version +SET _ver_cmd=svnversion -n "%1" +for /f %%a in ('%_ver_cmd%') do set SVNVersion=%%a +if errorlevel 1 ( + echo Problem with scanning svn WC for current version. + goto error +) +if "%SVNVersion%" == "" ( + echo Can't get the major version. + goto error +) + +echo * Detecting version numbers +set _ver_cmd=type "%1\src\common\version.h" +for /f "tokens=3 delims= " %%a in ('%_ver_cmd% ^|find "define PRODUCT_VERSION1 "') do set MajorVersion=%%a +if errorlevel 1 ( + echo Problem with retrieving MajorVersion. + goto error +) +if "%MajorVersion%" == "" ( + echo Can't get the major version. + goto error +) + +set _ver_cmd=type "%1\src\common\version.h" +for /f "tokens=3 delims= " %%a in ('%_ver_cmd% ^|find "define PRODUCT_VERSION2 "') do set MinorVersion=%%a +if errorlevel 1 ( + echo Problem with retrieving MinorVersion. + goto error +) +if "%MinorVersion%" == "" ( + echo Can't get the major version. + goto error +) + +SET CustomVersion=1 + +SET TextVersion=%MajorVersion%.%MinorVersion%internal-svn%SVNVersion% +if "%TextVersion%" == "" ( + echo Cannot calculate the text version. + goto error +) + +echo * Detected current trunk at %MajorVersion%.%MinorVersion%.%SVNVersion%.%CustomVersion% +goto end + +:error +rem Get outside of the temp directory to be able to delete it +exit /b 1 + +:end +exit /b 0 Index: scripts/make_existing_release.bat =================================================================== diff -u -N -r2bcf2d927fb2138f152beab66f1e3f98d62c3fd5 -r6ee1dfea13b6871982655b160a571b78ff2e924e --- scripts/make_existing_release.bat (.../make_existing_release.bat) (revision 2bcf2d927fb2138f152beab66f1e3f98d62c3fd5) +++ scripts/make_existing_release.bat (.../make_existing_release.bat) (revision 6ee1dfea13b6871982655b160a571b78ff2e924e) @@ -1,7 +1,7 @@ @echo off rem Mark the changes as local ones -setlocal +setlocal ENABLEDELAYEDEXPANSION rem Check input parameter if [%1] == [] ( @@ -35,10 +35,11 @@ if NOT "%ProgramFiles(x86)%" == "" SET VSInst=%ProgramFiles(x86)% echo --- Preparing source package ---------------------------------------- -echo * Retrieving tagged source code... if "%TextVersion%" == "trunk" ( + echo * Retrieving source code from trunk... svn co "%ReposCH%/trunk" "%MainProjectDir%" >"%TmpDir%\command.log" 2>"%TmpDir%\command-err.log" ) else ( + echo * Retrieving tagged source code... svn co "%ReposCH%/tags/%TextVersion%" "%MainProjectDir%" >"%TmpDir%\command.log" 2>"%TmpDir%\command-err.log" ) if errorlevel 1 ( @@ -55,9 +56,26 @@ goto error ) -echo * Create source package... +rem Update the version string in the version.h for trunk +if "%TextVersion%" == "trunk" ( + echo * Detecting internal version information... + call internal\detect_internal_version.bat "%MainProjectDir%" + if errorlevel 1 ( + goto error + ) + + echo * Updating version information... + cscript //NoLogo internal\replace_version.vbs "%MainProjectDir%\src\common\version.h.template" "%MainProjectDir%\src\common\version.h" !MajorVersion! !MinorVersion! !SVNVersion! !CustomVersion! !TextVersion! >"%TmpDir%\command.log" + if errorlevel 1 ( + echo ERROR: encountered a problem while checking out copyhandler project. See the log below: + type "%TmpDir%\command.log" + goto error + ) +) + +echo * Create source package for version %TextVersion%... cd %MainProjectDir% -7z a "%OutputDir%\chsrc-%TextVersion%.zip" -tzip -x!"scripts\*.bat" -xr!".svn" . >"%TmpDir%\command.log" +7z a "%OutputDir%\chsrc-%TextVersion%.zip" -tzip -x^^!"scripts\*.bat" -xr^^!".svn" . >"%TmpDir%\command.log" if errorlevel 1 ( echo ERROR: Preparation of the sources failed. See the log below: type "%TmpDir%\command.log"