From 6b0f2567992068eaeb5d73910a635c1d94a2306f Mon Sep 17 00:00:00 2001 From: Andrei Drexler Date: Sat, 18 Nov 2023 09:58:40 +0100 Subject: [PATCH] Add build suffix to Windows CI --- .github/workflows/windows_ci.yml | 3 +++ Windows/VisualStudio/custom_build.props | 12 ++++++++++++ Windows/VisualStudio/print_build_suffix.bat | 10 ++++++++++ 3 files changed, 25 insertions(+) create mode 100644 Windows/VisualStudio/custom_build.props create mode 100644 Windows/VisualStudio/print_build_suffix.bat diff --git a/.github/workflows/windows_ci.yml b/.github/workflows/windows_ci.yml index ef35263d6..adcc15c0f 100644 --- a/.github/workflows/windows_ci.yml +++ b/.github/workflows/windows_ci.yml @@ -14,9 +14,12 @@ jobs: run: | $vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" $msbuild = & "$vswhere" -latest -requires Microsoft.Component.MSBuild -find MSBuild\**\Bin\MSBuild.exe | select-object -first 1 + $buildsuffix = & "Windows\VisualStudio\print_build_suffix.bat" $options = @( ` '-property:Configuration=Release', ` '-property:Platform=${{ matrix.platform }}', ` + '-property:ForceImportBeforeCppTargets=Windows\VisualStudio\custom_build.props', ` + '-property:VER_SUFFIX=$gitsuffix', ` '-maxcpucount', ` '-verbosity:minimal' ` ) diff --git a/Windows/VisualStudio/custom_build.props b/Windows/VisualStudio/custom_build.props new file mode 100644 index 000000000..c8632be23 --- /dev/null +++ b/Windows/VisualStudio/custom_build.props @@ -0,0 +1,12 @@ + + + + + /DIRONWAIL_VER_SUFFIX=\"$(VER_SUFFIX)\" %(AdditionalOptions) + + + + $(SolutionDir)$(BUILD_DIR)\ + $(BUILD_DIR)\Out\ + + diff --git a/Windows/VisualStudio/print_build_suffix.bat b/Windows/VisualStudio/print_build_suffix.bat new file mode 100644 index 000000000..84b053f38 --- /dev/null +++ b/Windows/VisualStudio/print_build_suffix.bat @@ -0,0 +1,10 @@ +@echo off +::Print build suffix (either -hash or -branch-hash) + +for /f %%f in ('git describe --always') do set gitrev=%%f +for /f %%f in ('git branch --show-current') do set gitbranch=%%f +if /i "%gitbranch%" == "master" ( + echo -%gitrev% +) else ( + echo -%gitbranch%-%gitrev% +)