From 0fac1ef7b39264796e22328be6ecb428c87339ed Mon Sep 17 00:00:00 2001 From: Zero Fanker Date: Wed, 19 Jun 2024 22:33:50 -0400 Subject: [PATCH] implemented version helper script . --- scripts/update_product_version.ps1 | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 scripts/update_product_version.ps1 diff --git a/scripts/update_product_version.ps1 b/scripts/update_product_version.ps1 new file mode 100644 index 0000000..68a63c5 --- /dev/null +++ b/scripts/update_product_version.ps1 @@ -0,0 +1,28 @@ +[CmdletBinding()] +param( + [Parameter(Mandatory=$false, ParameterSetName='Version')] + [int]$major, + [Parameter(Mandatory=$false, ParameterSetName='Version')] + [int]$minor, + [Parameter(Mandatory=$true, ParameterSetName='Version')] + [int]$revision +) + +$scriptPath = Split-Path -Parent $MyInvocation.MyCommand.Definition +$headerFile = Join-Path $scriptPath "../MissionEditor/Version.h" + +$content = Get-Content -Path $headerFile -Raw + +if ($PSBoundParameters.ContainsKey('major')) { + $content = $content -replace 'PRODUCT_VERSION_MAJOR\s+\d+', "PRODUCT_VERSION_MAJOR $major" +} + +if ($PSBoundParameters.ContainsKey('minor')) { + $content = $content -replace 'PRODUCT_VERSION_MINOR\s+\d+', "PRODUCT_VERSION_MINOR $minor" +} + +if ($PSBoundParameters.ContainsKey('revision')) { + $content = $content -replace 'PRODUCT_VERSION_REVISION\s+\d+', "PRODUCT_VERSION_REVISION $revision" +} + +$content | Set-Content -Path $headerFile \ No newline at end of file