mirror of
https://github.com/microsoft/PowerToys.git
synced 2024-11-27 14:59:16 +08:00
added in version.prop update and the ps script
This commit is contained in:
parent
75ace74d37
commit
eadab13d1c
@ -1,6 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Version>0.21.2</Version>
|
||||
<Version>0.0.1</Version>
|
||||
<DevEnvironment>Local</DevEnvironment>
|
||||
</PropertyGroup>
|
||||
</Project>
|
41
tools/build/versionSetting.ps1
Normal file
41
tools/build/versionSetting.ps1
Normal file
@ -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);
|
Loading…
Reference in New Issue
Block a user