Skip to content

Commit

Permalink
Internal. Update release version generation scripts (accept build stage)
Browse files Browse the repository at this point in the history
  • Loading branch information
Maximus5 committed May 10, 2016
1 parent de97683 commit 854e09b
Show file tree
Hide file tree
Showing 5 changed files with 242 additions and 11 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ bin
help
x64

/CreateRelease.cmd

Release/**/*.iobj
Release/**/*.ipdb
Release/**/*.exp
Expand Down
162 changes: 162 additions & 0 deletions CreateRelease.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
@echo off

set ver_info="%~dp0PortableApps\App\AppInfo\appinfo.ini"
set ver_hdr="%~dp0src\ConEmu\version.h"


set ConEmuHooks=Enabled

rem set PATH=%PATH%
set MINGWRT=
if exist %~d0\MinGW\msys\1.0\bin\head.exe set MINGWRT=%~d0\MinGW\msys\1.0\bin
if exist %~d0\MinGW\msys32\bin\head.exe set MINGWRT=%~d0\MinGW\msys32\bin

set BUILD_NO=
set BUILD_STAGE=

if "%~1"=="" goto noparm
set BUILD_NO=%~1

if /I "%~2" == "ALPHA" (
set BUILD_STAGE=ALPHA
shift /2
) else if /I "%~2" == "PREVIEW" (
set BUILD_STAGE=PREVIEW
shift /2
) else if /I "%~2" == "STABLE" (
set BUILD_STAGE=STABLE
shift /2
)

:oneparm

rem check date, must not bee too late or future ;)
set curdt=%DATE%
set curdt=%curdt:~8,2%%curdt:~3,2%%curdt:~0,2%
set /A maxdt=%curdt%+1
set /A mindt=%curdt%-1
if "%BUILD_NO:~0,6%" == "%curdt%" goto buildok
if "%BUILD_NO:~0,6%" == "%maxdt%" goto buildok
if "%BUILD_NO:~0,6%" == "%mindt%" goto buildok
echo ------- Warning -------
echo Check your build number
echo  Build: %BUILD_NO% 
echo  Today: %curdt% 
echo ------- Warning -------
pause
:buildok


call "%~dp0\src\ConEmu\gen_version.cmd" %BUILD_NO% %BUILD_STAGE%
if errorlevel 1 goto err

if /I "%~2" == "-build" goto do_build
if /I "%~2" == "-deploy" goto do_deploy

echo on

rem Update versions in all release files (msi, portableapps, nuget, etc.)
powershell -noprofile -command "%~dp0Deploy\UpdateDeployVersions.ps1" %BUILD_NO%
if errorlevel 1 goto err


rem This will create ".daily.md"
call "%~dp0Deploy\git2log.cmd" -skip_upd
farrun -new_console:b -e5 "%~dp0..\..\ConEmu-GitHub-io\ConEmu.github.io\_posts\.daily.md"
farrun -new_console:b -e23 "%~dp0Release\ConEmu\WhatsNew-ConEmu.txt"


rem set ConEmuHooks=OFF

echo Version from WhatsNew-ConEmu.txt
%MINGWRT%\head -n 30 "%~dp0Release\ConEmu\WhatsNew-ConEmu.txt" | %windir%\system32\find "20%BUILD_NO:~0,2%.%BUILD_NO:~2,2%.%BUILD_NO:~4,2%"
if errorlevel 1 (
%MINGWRT%\head -n 30 "%~dp0Release\ConEmu\WhatsNew-ConEmu.txt" | %MINGWRT%\tail -n -16
echo .
echo Build number was not described in WhatsNew-ConEmu.txt!
echo .
)

echo Version from PortableApps
type %ver_info% | %MINGWRT%\grep -E "^(PackageVersion|DisplayVersion)"

echo Version from version.h
type %ver_hdr% | %MINGWRT%\grep -G "^#define MVV_"

rem Don't wait for confirmation - build number was already confirmed...
rem echo .
rem echo Press Enter to continue if version is OK: "%BUILD_NO%"
rem pause>nul

:do_build
cd /d "%~dp0src"

rem touch
call :tch common *.cpp *.hpp *.h
call :tch ConEmu *.cpp *.h
call :tch ConEmuBg *.cpp *.h
call :tch ConEmuC *.cpp *.h
call :tch ConEmuCD *.cpp *.h
call :tch ConEmuDW *.cpp *.h
call :tch ConEmuHk *.cpp *.h
call :tch ConEmuLn *.cpp *.h
call :tch ConEmuPlugin *.cpp *.h
call :tch ConEmuTh *.cpp *.h

rem Compile x86
call "%~dp0src\vc.build.release.cmd" 9 x86 nosign
if errorlevel 1 goto err
rem Compile x64
call "%~dp0src\vc.build.release.cmd" 14 x64 nosign noclean
if errorlevel 1 goto err
rem Sign code
call "%~dp0src\vc.build.release.cmd" dosign
if errorlevel 1 goto err

:do_deploy
cd /d "%~dp0"
call Deploy\Deploy.cmd %BUILD_NO%





goto fin


:tch
cd %1
%MINGWRT%\touch %2 %3 %4
cd ..
goto :EOF

:noparm
call "%~dp0Deploy\GetCurVer.cmd"
if "%CurVerBuild%" NEQ "" goto build_found
set curdt=%DATE%
set CurVerBuild=%curdt:~8,2%%curdt:~3,2%%curdt:~0,2%

:build_found
echo Usage: CreateRelease.cmd ^<Version^> [^<Stage^>]
echo Example: CreateRelease.cmd %CurVerBuild% %CurVerStage%
echo .
set curdt=%DATE%
set CurVerBuild=%curdt:~8,2%%curdt:~3,2%%curdt:~0,2%
set BUILD_NO=
set BUILD_STAGE=
rem Version
set /P BUILD_NO="Deploy build number [%CurVerBuild%]: "
if "%BUILD_NO%" == "" set "BUILD_NO=%CurVerBuild%"
rem Version stage
set /P BUILD_STAGE="Build stage [%CurVerStage%]: "
if "%BUILD_STAGE%" == "" set "BUILD_STAGE=%CurVerStage%"
echo.

if NOT "%BUILD_NO%"=="" goto oneparm
goto fin

:err
Echo Deploy FAILED!!!

:fin
pause
29 changes: 25 additions & 4 deletions Deploy/GetCurVer.cmd
Original file line number Diff line number Diff line change
@@ -1,4 +1,25 @@
set /P CurVerBuild=<"%~dp0..\src\ConEmu\version.h"
set CurVerBuild=%CurVerBuild%
set CurVerBuild=%CurVerBuild:~3%
rem echo `%CurVerBuild%`
@set /P CurVerBuild=<"%~dp0..\src\ConEmu\version.h"
@set CurVerBuild=%CurVerBuild%
@set CurVerBuild=%CurVerBuild:~3%

:stable
@%windir%\system32\find /C "ConEmuVersionStage CEVS_STABLE" "%~dp0..\src\ConEmu\version_stage.h" > nul
@if errorlevel 1 goto preview
@set CurVerStage=STABLE
@goto done
:preview
@%windir%\system32\find /C "ConEmuVersionStage CEVS_PREVIEW" "%~dp0..\src\ConEmu\version_stage.h" > nul
@if errorlevel 1 goto alpha
@set CurVerStage=PREVIEW
@goto done
:alpha
@rem %windir%\system32\find /C "ConEmuVersionStage CEVS_ALPHA" "%~dp0..\src\ConEmu\version_stage.h" > nul
@set CurVerStage=ALPHA


:done

@if "%~1" == "-v" (
echo CurVerBuild = `%CurVerBuild%`
echo CurVerStage = `%CurVerStage%`
)
27 changes: 23 additions & 4 deletions Deploy/git2log.cmd
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
@echo off

rem Usage: git2log [<commit-sha>]
rem If <commit-sha> is specified, script will process range: HEAD...<commit>
rem Usage: git2log [<commit-sha>] [-force] [-skip_upd]
rem If <commit-sha> is specified, script will process range: HEAD...<commit>
rem -force - force overwrite .daily.md
rem -skip_upd - Do not call UpdateDeployVersions.ps1

rem === Far menu ===
rem git2log.cmd
Expand All @@ -10,6 +12,23 @@ rem edit:...\Release\ConEmu\WhatsNew-ConEmu.txt

setlocal

set FORCE_MD=NO
set SKIP_UPD=NO
set COMMIT_SHA=

:parm_loop
if "%~1" == "" goto parm_done
if /I "%~1" == "-force" (
set FORCE_MD=YES
) else if /I "%~1" == "-skip_upd" (
set SKIP_UPD=YES
) else (
set "COMMIT_SHA=%~1"
)
shift /1
goto parm_loop
:parm_done

set git=%~d0\gitsdk\cmd\git.exe
rem set git=%~d0\Utils\Lans\GIT\cmd\git.exe
if NOT EXIST "%git%" set git=git.exe
Expand All @@ -25,15 +44,15 @@ rem May be file was already created and prepared?
if exist "%daily_md%" (
type "%daily_md%" | %windir%\system32\find "build: %CurVerBuild%"
if errorlevel 1 goto yaml
if "%~2" == "-force" goto yaml
if "%FORCE_MD%" == "YES" goto yaml
call cecho "### Changelog .daily.md was already created for build %CurVerBuild%"
goto done
)
rem Create YAML header
:yaml
call :out_build > %daily_md%
rem Dump git commits into ".daily.md"
call :do_log %1 >> %daily_md%
call :do_log %COMMIT_SHA% >> %daily_md%
call cecho /green "%daily_md%"
rem Done
:done
Expand Down
33 changes: 32 additions & 1 deletion src/ConEmu/gen_version.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,23 @@ if /I %MVV_3% GTR 31 goto err_parm
set MVV_4=0
set MVV_4a=%VR:~6,1%
set MVV_git_def=#undef MVV_git

if /I "%~2" == "ALPHA" (
call :gen_stage ALPHA
goto check_4
)
if /I "%~2" == "PREVIEW" (
call :gen_stage PREVIEW
goto check_4
)
if /I "%~2" == "STABLE" (
call :gen_stage STABLE
goto check_4
)

if NOT "%~2"=="" goto git_ci

:check_4
if "%MVV_4a%"=="" goto run
rem translate letter in build no into 4-d number
set Found=N
Expand Down Expand Up @@ -95,11 +111,26 @@ goto :EOF
@echo #define MVV_4 %MVV_4%
@echo #define MVV_4a "%MVV_4a%"
@echo %MVV_git_def%
@echo //
@echo.
@echo #include "version_stage.h"
@echo #include "version_macro.h"
@goto :EOF

:gen_stage
set verh="%~dp0version_stage.h"
call :printstage %1 > %verh%
goto :EOF

:printstage
@echo #pragma once
@echo.
@echo #define CEVS_STABLE 0
@echo #define CEVS_PREVIEW 1
@echo #define CEVS_ALPHA 2
@echo.
@echo #define ConEmuVersionStage CEVS_%1
@goto :EOF

:usage
echo Usage: "%~nx0" ^<BuildNo^> [minor_for_git git_commit]
echo Example: "%~nx0" 131113c
Expand Down

0 comments on commit 854e09b

Please sign in to comment.