Skip to content

Commit

Permalink
Modify Build To Support Production Release
Browse files Browse the repository at this point in the history
- Update batch files and WiX to dynamically query build version from version.h.
- Update batch files and WiX to differentiate production versus beta versions.
- Removed build number from About box.
  • Loading branch information
NoMoreFood committed Oct 15, 2024
1 parent 93745d0 commit 3624cb8
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 7 deletions.
12 changes: 11 additions & 1 deletion build.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@
TITLE Building WinDirStat
SETLOCAL

:: solicit whether this is production or beta build
ECHO Please choose a release type:
ECHO 1. Beta
ECHO 2. Production
SET /p CHOICE=Enter Choice (1 or 2):
SET RELTYPE=
IF "%CHOICE%" EQU "1" SET RELTYPE=PRODUCTION
IF "%CHOICE%" EQU "2" SET RELTYPE=BETA
IF "%RELTYPE%" EQU "" EXIT /B 1

:: setup environment variables based on location of this script
SET THISDIR=%~dp0
SET THISDIR=%THISDIR:~0,-1%
Expand Down Expand Up @@ -47,7 +57,7 @@ IF %ERRORLEVEL% EQU 0 FOR %%A IN (arm arm64 x86 x64) DO (
signtool sign /fd sha256 /tr %TSAURL% /td sha256 /d %LIBNAME% /du %LIBURL% "%BLDDIR%\*.exe"

:: build the msi
CALL "%THISDIR%\setup\build.cmd"
CALL "%THISDIR%\setup\build.cmd" "%RELTYPE%"

:: sign the msi
signtool sign /fd sha256 /tr %TSAURL% /td sha256 /d %LIBNAME% /du %LIBURL% "%BLDDIR%\*.msi"
Expand Down
10 changes: 8 additions & 2 deletions setup/Defines.wxi
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<Include>
<!-- Product GUIDs & Version Number -->
<?define ProductVersion = "2.0.0.$(var.BUILD)"?>
<?define UpgradeCode = "E211CCFB-D706-4919-B2FF-0F7F426EA27B"?>
<?define ProductID = "*"?>
<?if $(var.RELTYPE) = PRODUCTION ?>
<?define ProductVersion = "$(var.MAJVER).$(var.MINVER).$(var.PATCH)"?>
<?define UpgradeCode = "46F106C9-090C-43D0-8815-D03BA9FA55A9"?>
<?else ?>
<?define ProductVersion = "$(var.MAJVER).$(var.MINVER).$(var.PATCH).$(var.BUILD)"?>
<?define UpgradeCode = "E211CCFB-D706-4919-B2FF-0F7F426EA27B"?>
<?endif ?>

<!-- Product and Company information -->
<?define ProductName = "WinDirStat"?>
<?define ProductFolder = "WinDirStat"?>
Expand Down
14 changes: 12 additions & 2 deletions setup/build.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
TITLE Building WinDirStat Installer
SETLOCAL

:: setup release type
SET RELTYPE=BETA
IF "%~1" EQU "PRODUCTION" SET RELTYPE=PRODUCTION

:: setup environment variables based on location of this script
CD /D "%~dp0"
SET PX86=%PROGRAMFILES(X86)%
Expand All @@ -15,12 +19,18 @@ IF %ERRORLEVEL% NEQ 0 (
EXIT /B 0
)

:: grab current version information from source
FOR /F "TOKENS=2,3 DELIMS= " %%A IN ('FINDSTR "#define.PRD_" ..\windirstat\version.h') DO SET %%A=%%B

:: grab current data for installer build version
FOR /F %%X in ('git -C .. rev-list --count --all') DO SET BUILD=%%X
FOR /F %%X in ('git -C .. rev-list --count --all') DO SET PRD_BUILD=%%X

:: create version string based on git and source
SET VERSTRING=-dMAJVER=%PRD_MAJVER% -dMINVER=%PRD_MINVER% -dPATCH=%PRD_PATCH% -dBUILD=%PRD_BUILD%

:: create the installers
FOR %%A IN (arm arm64 x86 x64) DO (
candle -arch %%A "WinDirStat.wxs" -o "WinDirStat-%%A.wixobj" -dBUILD=%BUILD%
candle -arch %%A "WinDirStat.wxs" -o "WinDirStat-%%A.wixobj" -dRELTYPE=%RELTYPE% %VERSTRING%
light -ext WixUIExtension -ext WixUtilExtension -sval "WinDirStat-%%A.wixobj" -o "%BLDDIR%\WinDirStat-%%A.msi"
)
DEL /F "*.wixobj"
Expand Down
3 changes: 1 addition & 2 deletions windirstat/Dialogs/AboutDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,11 +261,10 @@ std::wstring CAboutDlg::GetAppVersion()
if (GetFileVersionInfo(file.c_str(), 0, iVersionSize, tVersionInfo.data()) != 0 &&
VerQueryValue(tVersionInfo.data(), L"\\", reinterpret_cast<LPVOID*>(&pVersion), &iQueriedSize) != 0)
{
return std::format(L"WinDirStat {}.{}.{}.{} ({})\nGit Commit: {}",
return std::format(L"WinDirStat {}.{}.{} ({})\nGit Commit: {}",
std::to_wstring(HIWORD(pVersion->dwFileVersionMS)),
std::to_wstring(LOWORD(pVersion->dwFileVersionMS)),
std::to_wstring(HIWORD(pVersion->dwFileVersionLS)),
std::to_wstring(LOWORD(pVersion->dwFileVersionLS)),
_CRT_WIDE(GIT_DATE), _CRT_WIDE(GIT_COMMIT));
}

Expand Down

0 comments on commit 3624cb8

Please sign in to comment.