From eadab13d1c8e8e13a554d1af604a9dd39fa28f2a Mon Sep 17 00:00:00 2001 From: Clint Rutkas Date: Wed, 23 Sep 2020 08:10:42 -0700 Subject: [PATCH] added in version.prop update and the ps script --- src/Version.props | 5 +++-- tools/build/versionSetting.ps1 | 41 ++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 tools/build/versionSetting.ps1 diff --git a/src/Version.props b/src/Version.props index 3349cbf03f..637a7c3609 100644 --- a/src/Version.props +++ b/src/Version.props @@ -1,6 +1,7 @@ - + - 0.21.2 + 0.0.1 + Local \ No newline at end of file diff --git a/tools/build/versionSetting.ps1 b/tools/build/versionSetting.ps1 new file mode 100644 index 0000000000..f8991cc718 --- /dev/null +++ b/tools/build/versionSetting.ps1 @@ -0,0 +1,41 @@ +[CmdletBinding()] +Param( + [Parameter(Mandatory=$True,Position=1)] + [string]$versionNumber = "0.0.1", + + [Parameter(Mandatory=$True,Position=2)] + [AllowEmptyString()] + [string]$DevEnvironment = "Local" +) + +Write-Host $PSScriptRoot +$versionRegex = "(\d+)\.(\d+)\.(\d+)" + +if($versionNumber -match $versionRegEx) +{ + $buildDayOfYear = (Get-Date).DayofYear; + $buildTime = Get-Date -Format HH; + # $buildTime = Get-Date -Format HHmmss; + # $buildYear = Get-Date -Format yy; + # $revision = [string]::Format("{0}{1}{2}", $buildYear, $buildDayOfYear, $buildTime ) + + # max UInt16, 65535 + #$revision = [string]::Format("{0}{1}", $buildDayOfYear, $buildTime ) + #Write-Host "Revision" $revision + + $versionNumber = [int]::Parse($matches[1]).ToString() + "." + [int]::Parse($matches[2]).ToString() + "." + [int]::Parse($matches[3]).ToString() # + "." + $revision + Write-Host "Version Number" $versionNumber +} +else{ + throw "Build format does not match the expected pattern (buildName_w.x.y.z)" +} + +$verPropWriteFileLocation = $PSScriptRoot + '/../../src/Version.props'; +$verPropReadFileLocation = $verPropWriteFileLocation; + +[XML]$verProps = Get-Content $verPropReadFileLocation +$verProps.Project.PropertyGroup.Version = $versionNumber; +$verProps.Project.PropertyGroup.DevEnvironment = $DevEnvironment; + +Write-Host "xml" $verProps.Project.PropertyGroup.Version +$verProps.Save($verPropWriteFileLocation); \ No newline at end of file