mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-15 19:27:56 +01:00
This pull request adopts the unified versioning scheme used by Windows Terminal, Notepad, and hundreds of other internal and public projects that relied on "XES" or "PackageES".
It only does so for the command palette.
All command palette assets will be versioned according to the Major and Minor number in `src/modules/cmdpal/custom.props`. This includes DLLs, EXEs, NuGet packages and MSIX bundles.
This will ensure that all artifacts that we produce are versioned
properly:
| thing | version (ex.) |
|---------|-----------------|
| dll/exe | 0.2.2505.08001 |
| nupkg | 0.2.250508001 |
| appx | 0.2.3269.0 |
For reference, here's the version format:
### EXE, DLL, .NET Assembly
0.2.2505.08001
^ ^ ^ ^ ^ ^
| | | | | `-Build # on that date
| | | | `-Day
| | | `-Month
| | `-Year
| `-Minor
`-Major
### NuGet Package
0.2.250508001
^ ^ ^ ^ ^ ^
| | | | | `-Build # on that date
| | | | `-Day
| | | `-Month
| | `-Year
| `-Minor
`-Major
### AppX Package
0.2.01281.0 (the leading 0 will be removed)
^ ^ ^ ^^ ^
| | | || `-Contractually always zero (a waste)
| | | |`-Build # on that date
| | | `-Number of days in [base year]
| | `-Number of years since [base year]
| `-Minor
`-Major
[base year] = $(XesBaseYearForStoreVersion)
It is expected that the base year is changed every time the version
number is changed.
111 lines
3.1 KiB
PowerShell
111 lines
3.1 KiB
PowerShell
Param(
|
|
[string]$Configuration = "release",
|
|
[string]$VersionOfSDK = "",
|
|
[string]$BuildStep = "all",
|
|
[switch]$IsAzurePipelineBuild = $false,
|
|
[switch]$Help = $false
|
|
)
|
|
|
|
If ([String]::IsNullOrEmpty($VersionOfSDK)) {
|
|
$VersionOfSDK = $Env:XES_PACKAGEVERSIONNUMBER
|
|
}
|
|
|
|
If ([String]::IsNullOrEmpty($VersionOfSDK)) {
|
|
$VersionOfSDK = "0.0.0"
|
|
}
|
|
|
|
$StartTime = Get-Date
|
|
|
|
if ($Help) {
|
|
Write-Host @"
|
|
Copyright (c) Microsoft Corporation.
|
|
Licensed under the MIT License.
|
|
|
|
Syntax:
|
|
Build.cmd [options]
|
|
|
|
Description:
|
|
Builds the Command Palette SDK
|
|
|
|
Options:
|
|
|
|
-Configuration <configuration>
|
|
Only build the selected configuration(s)
|
|
Example: -Configuration Release
|
|
Example: -Configuration "Debug,Release"
|
|
|
|
-VersionOfSDK <version>
|
|
Set the version number of the build sdk nuget package
|
|
Example: -VersionOfSDK "1.0.0"
|
|
|
|
-Help
|
|
Display this usage message.
|
|
"@
|
|
Exit
|
|
}
|
|
|
|
$ErrorActionPreference = "Stop"
|
|
|
|
$buildPlatforms = "x64","arm64"
|
|
|
|
$msbuildPath = &"${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -prerelease -products * -requires Microsoft.Component.MSBuild -find MSBuild\**\Bin\MSBuild.exe
|
|
if ($IsAzurePipelineBuild) {
|
|
$nugetPath = "nuget.exe";
|
|
} else {
|
|
$nugetPath = (Join-Path $PSScriptRoot "NugetWrapper.cmd")
|
|
}
|
|
|
|
if (($BuildStep -ieq "all") -Or ($BuildStep -ieq "build")) {
|
|
& $nugetPath restore (Join-Path $PSScriptRoot "..\..\..\..\..\PowerToys.sln")
|
|
|
|
Try {
|
|
foreach ($config in $Configuration.Split(",")) {
|
|
foreach ($platform in $buildPlatforms) {
|
|
$msbuildArgs = @(
|
|
("$PSScriptRoot\..\Microsoft.CommandPalette.Extensions.Toolkit\Microsoft.CommandPalette.Extensions.Toolkit.csproj"),
|
|
("/p:Platform="+$platform),
|
|
("/p:Configuration="+$config),
|
|
("/binaryLogger:CmdPal.Extensions.$platform.$config.binlog"),
|
|
("/p:VersionNumber="+$VersionOfSDK)
|
|
)
|
|
|
|
& $msbuildPath $msbuildArgs
|
|
}
|
|
}
|
|
} Catch {
|
|
$formatString = "`n{0}`n`n{1}`n`n"
|
|
$fields = $_, $_.ScriptStackTrace
|
|
Write-Host ($formatString -f $fields) -ForegroundColor RED
|
|
Exit 1
|
|
}
|
|
}
|
|
|
|
if (($BuildStep -ieq "all") -Or ($BuildStep -ieq "pack")) {
|
|
foreach ($config in $Configuration.Split(",")) {
|
|
if ($config -eq "release")
|
|
{
|
|
New-Item -ItemType Directory -Force -Path "$PSScriptRoot\..\_build"
|
|
& $nugetPath pack (Join-Path $PSScriptRoot "Microsoft.CommandPalette.Extensions.SDK.nuspec") -Version $VersionOfSDK -OutputDirectory "$PSScriptRoot\..\_build"
|
|
} else {
|
|
Write-Host @"
|
|
WARNING: You are currently building as '$config' configuration.
|
|
CmdPalSDK nuget creation only supports 'release' configuration right now.
|
|
"@ -ForegroundColor YELLOW
|
|
}
|
|
}
|
|
}
|
|
|
|
if ($IsAzurePipelineBuild) {
|
|
Write-Host "##vso[task.setvariable variable=VersionOfSDK;]$VersionOfSDK"
|
|
Write-Host "##vso[task.setvariable variable=VersionOfSDK;isOutput=true;]$VersionOfSDK"
|
|
}
|
|
|
|
$TotalTime = (Get-Date)-$StartTime
|
|
$TotalMinutes = [math]::Floor($TotalTime.TotalMinutes)
|
|
$TotalSeconds = [math]::Ceiling($TotalTime.TotalSeconds)
|
|
|
|
Write-Host @"
|
|
Total Running Time:
|
|
$TotalMinutes minutes and $TotalSeconds seconds
|
|
"@ -ForegroundColor CYAN
|