Skip to content

Commit

Permalink
Try to use M.W.T.V for versioning
Browse files Browse the repository at this point in the history
  • Loading branch information
DHowett committed Sep 18, 2024
1 parent d7a07dc commit 3d6b78e
Show file tree
Hide file tree
Showing 10 changed files with 156 additions and 162 deletions.
9 changes: 3 additions & 6 deletions .pipelines/installer-steps.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
parameters:
- name: versionNumber
type: string
default: "0.0.1"
- name: perUserArg
type: string
default: "false"
Expand Down Expand Up @@ -53,7 +50,7 @@ steps:
displayName: "Extracting MSI to verify contents"
inputs:
script: |
"C:\Program Files (x86)\WiX Toolset v3.14\bin\dark.exe" -x $(build.sourcesdirectory)\extractedMsi installer\PowerToysSetup\$(BuildPlatform)\$(BuildConfiguration)\${{parameters.buildSubDir}}\${{parameters.installerPrefix}}-${{ parameters.versionNumber }}-$(BuildPlatform).msi
"C:\Program Files (x86)\WiX Toolset v3.14\bin\dark.exe" -x $(build.sourcesdirectory)\extractedMsi installer\PowerToysSetup\$(BuildPlatform)\$(BuildConfiguration)\${{parameters.buildSubDir}}\${{parameters.installerPrefix}}-$(XES_BINARYVERSION)-$(BuildPlatform).msi
dir $(build.sourcesdirectory)\extractedMsi
# Check if deps.json files don't reference different dll versions.
Expand Down Expand Up @@ -102,7 +99,7 @@ steps:
- task: CmdLine@2
displayName: "Insignia: Extract Engine from Bundle"
inputs:
script: '"C:\Program Files (x86)\WiX Toolset v3.14\bin\insignia.exe" -ib installer\PowerToysSetup\$(BuildPlatform)\$(BuildConfiguration)\${{parameters.buildSubDir}}\${{parameters.installerPrefix}}-${{ parameters.versionNumber }}-$(BuildPlatform).exe -o installer\engine.exe'
script: '"C:\Program Files (x86)\WiX Toolset v3.14\bin\insignia.exe" -ib installer\PowerToysSetup\$(BuildPlatform)\$(BuildConfiguration)\${{parameters.buildSubDir}}\${{parameters.installerPrefix}}-$(XES_BINARYVERSION)-$(BuildPlatform).exe -o installer\engine.exe'

- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@5
displayName: "ESRP CodeSigning (Engine)"
Expand Down Expand Up @@ -138,7 +135,7 @@ steps:
- task: CmdLine@2
displayName: "Insignia: Merge Engine into Bundle"
inputs:
script: '"C:\Program Files (x86)\WiX Toolset v3.14\bin\insignia.exe" -ab installer\engine.exe installer\PowerToysSetup\$(BuildPlatform)\$(BuildConfiguration)\${{parameters.buildSubDir}}\${{parameters.installerPrefix}}-${{ parameters.versionNumber }}-$(BuildPlatform).exe -o installer\PowerToysSetup\$(BuildPlatform)\$(BuildConfiguration)\${{parameters.buildSubDir}}\${{parameters.installerPrefix}}-${{ parameters.versionNumber }}-$(BuildPlatform).exe'
script: '"C:\Program Files (x86)\WiX Toolset v3.14\bin\insignia.exe" -ab installer\engine.exe installer\PowerToysSetup\$(BuildPlatform)\$(BuildConfiguration)\${{parameters.buildSubDir}}\${{parameters.installerPrefix}}-$(XES_BINARYVERSION)-$(BuildPlatform).exe -o installer\PowerToysSetup\$(BuildPlatform)\$(BuildConfiguration)\${{parameters.buildSubDir}}\${{parameters.installerPrefix}}-$(XES_BINARYVERSION)-$(BuildPlatform).exe'

- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@5
displayName: Sign Bootstrapper
Expand Down
19 changes: 7 additions & 12 deletions .pipelines/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ parameters:
default:
- x64
- arm64
- name: versionNumber
type: string
default: '0.0.1'
- name: signingParameters
type: object
default:
Expand Down Expand Up @@ -83,13 +80,6 @@ extends:
submodules: true
persistCredentials: True

# Sets versions for all PowerToy created DLLs
- task: PowerShell@1
displayName: Set Versions.Prop
inputs:
scriptName: .pipelines/versionSetting.ps1
arguments: -versionNumber '${{ parameters.versionNumber }}' -DevEnvironment ''

# ESRP needs 'Microsoft.NETCore.App', version '6.0.0' (x64)
- task: UseDotNet@2
displayName: 'Use .NET 6 SDK'
Expand Down Expand Up @@ -120,6 +110,13 @@ extends:
# - Webcam report tool
# - Installer
# - Bootstrapper Installer

- pwsh: |-
nuget install Microsoft.Windows.Terminal.Versioning -OutputDirectory _versioning -Source https://pkgs.dev.azure.com/shine-oss/terminal/_packaging/TerminalDependencies/nuget/v3/index.json
$VersionRoot = (Get-Item _versioning\Microsoft.Windows.*).FullName
& "$VersionRoot\build\Setup.ps1" -ProjectDirectory "$(Build.SourcesDirectory)" -Verbose
displayName: Set up versioning via M.W.T.V
- task: PowerShell@2
displayName: Download and install WiX 3.14 development build
inputs:
Expand Down Expand Up @@ -487,7 +484,6 @@ extends:
- template: .pipelines/installer-steps.yml@self
parameters:
signingParameters: ${{ parameters.signingParameters }}
versionNumber: ${{ parameters.versionNumber }}
perUserArg: "false"
buildSubDir: "MachineSetup"
installerPrefix: "PowerToysSetup"
Expand All @@ -502,7 +498,6 @@ extends:
- template: .pipelines/installer-steps.yml@self
parameters:
signingParameters: ${{ parameters.signingParameters }}
versionNumber: ${{ parameters.versionNumber }}
perUserArg: "true"
buildSubDir: "UserSetup"
installerPrefix: "PowerToysUserSetup"
Expand Down
132 changes: 1 addition & 131 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,133 +1,3 @@
<Project>
<Import Project="src\Version.props" />
<PropertyGroup>
<Copyright>Copyright (C) Microsoft Corporation. All rights reserved.</Copyright>
<AssemblyCopyright>Copyright (C) Microsoft Corporation. All rights reserved.</AssemblyCopyright>
<AssemblyProduct>PowerToys</AssemblyProduct>
<AssemblyCompany>Microsoft Corp.</AssemblyCompany>
<Company>Microsoft Corporation</Company>
<Authors>Microsoft Corporation</Authors>
<Product>PowerToys</Product>
<NeutralLanguage>en-US</NeutralLanguage>
<Platforms>x64;ARM64</Platforms>
<PackageTags>PowerToys</PackageTags>
<EnableNETAnalyzers>true</EnableNETAnalyzers>
<AnalysisMode>Recommended</AnalysisMode>
<_SkipUpgradeNetAnalyzersNuGetWarning>true</_SkipUpgradeNetAnalyzersNuGetWarning>
<NuGetAuditMode>direct</NuGetAuditMode>
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion> <!-- Don't add source revision hash to the product version of binaries. -->
<PlatformTarget>$(Platform)</PlatformTarget>
</PropertyGroup>

<PropertyGroup Condition="'$(MSBuildProjectExtension)' == '.csproj'">
<Version>$(Version).0</Version>
<RepositoryUrl>https://github.com/microsoft/PowerToys</RepositoryUrl>
<RepositoryType>GitHub</RepositoryType>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>

<PropertyGroup>
<_PropertySheetDisplayName>PowerToys.Root.Props</_PropertySheetDisplayName>
<ForceImportBeforeCppProps>$(MsbuildThisFileDirectory)\Cpp.Build.props</ForceImportBeforeCppProps>
</PropertyGroup>

<ItemGroup Condition="'$(MSBuildProjectExtension)' == '.csproj'">
<PackageReference Include="StyleCop.Analyzers">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<Compile Include="$(MSBuildThisFileDirectory)\src\codeAnalysis\GlobalSuppressions.cs" Link="GlobalSuppressions.cs" />
<AdditionalFiles Include="$(MSBuildThisFileDirectory)\src\codeAnalysis\StyleCop.json" Link="StyleCop.json" />

<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

<!-- Add ability to run tests via "msbuild /t:Test" -->
<!--
Workaround an MSBuild bug where Microsoft.Common.Test.targets is missing from the Arm64 installation.
See: https://github.com/dotnet/msbuild/pull/9984
NB 1: This means that using "/t:Test" is not supported for Arm64 builds and tests will need to be run in an alternate way,
eg running tests in VS or invoking vstest.console directly.
NB 2: <Sdk> elements do not support conditions, so this is also being worked around.
Once the change referenced above is fixed, the ImportGroup below can be replaced with:
<Sdk Name="Microsoft.Build.RunVSTest" Version="1.0.319" />
-->
<ImportGroup Condition="'$(PROCESSOR_ARCHITECTURE)' != 'ARM64'">
<Import Project="Sdk.props" Sdk="Microsoft.Build.RunVSTest" Version="1.0.319" />
<Import Project="Sdk.targets" Sdk="Microsoft.Build.RunVSTest" Version="1.0.319" />
</ImportGroup>
<PropertyGroup>
<VSTestLogger>trx</VSTestLogger>
<!--
RunVSTest by default uses %VSINSTALLDIR%\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe,
but some of the CI scenarios don't define %VSINSTALLDIR%, so be explicit about where to look for vstest.
Note: $(VsInstallRoot) is a built-in MSBuild property, so should always be defined.
-->
<VSTestToolPath>$(VsInstallRoot)\Common7\IDE\CommonExtensions\Microsoft\TestWindow</VSTestToolPath>
<!-- No arm64 agents to run the tests. -->
<RunVSTest Condition="'$(Platform)' == 'ARM64'">false</RunVSTest>
</PropertyGroup>

<!-- MSBuildCache -->
<PropertyGroup>
<!-- Off by default -->
<MSBuildCacheEnabled Condition="'$(MSBuildCacheEnabled)' == ''">false</MSBuildCacheEnabled>

<!-- In Azure pipelines, use Pipeline Caching as the cache storage backend. Otherwise, use the local cache. -->
<MSBuildCachePackageName Condition="'$(TF_BUILD)' != ''">Microsoft.MSBuildCache.AzurePipelines</MSBuildCachePackageName>
<MSBuildCachePackageName Condition="'$(MSBuildCachePackageName)' == ''">Microsoft.MSBuildCache.Local</MSBuildCachePackageName>
</PropertyGroup>

<PropertyGroup Condition="'$(MSBuildCacheEnabled)' == 'true'">
<!-- Disable when running in a pipeline as the time to upload or download the massive .pch/.pchast to the cache is greater than the savings they provide. -->
<UsePrecompiledHeaders Condition="'$(TF_BUILD)' != ''">false</UsePrecompiledHeaders>

<!-- Change this to bust the cache -->
<MSBuildCacheCacheUniverse Condition="'$(MSBuildCacheCacheUniverse)' == ''">202408150737</MSBuildCacheCacheUniverse>

<!--
Visual Studio telemetry reads various ApplicationInsights.config files and other files after the project is finished, likely in a detached process.
This is acceptable and should not impact cache correctness.
-->
<MSBuildCacheAllowFileAccessAfterProjectFinishFilePatterns>
$(MSBuildCacheAllowFileAccessAfterProjectFinishFilePatterns);
\**\ApplicationInsights.config;
$(LocalAppData)\Microsoft\VSApplicationInsights\**;
$(LocalAppData)\Microsoft\Windows\INetCache\**;
A:\;
E:\;
$(windir)\**;
</MSBuildCacheAllowFileAccessAfterProjectFinishFilePatterns>

<!-- Unit tests of low-priv processes, eg the preview handler tests, may log to this location. -->
<MSBuildCacheAllowFileAccessAfterProjectFinishFilePatterns>
$(MSBuildCacheAllowFileAccessAfterProjectFinishFilePatterns);
$(USERPROFILE)\AppData\LocalLow\Microsoft\PowerToys\**;
</MSBuildCacheAllowFileAccessAfterProjectFinishFilePatterns>

<!--
This repo uses a common output directory with many projects writing duplicate outputs. Allow everything, but note this costs some performance in the form of requiring
the cache to use copies instead of hardlinks when pulling from cache.
-->
<MSBuildCacheIdenticalDuplicateOutputPatterns>$(MSBuildCacheIdenticalDuplicateOutputPatterns);**</MSBuildCacheIdenticalDuplicateOutputPatterns>

<!-- version of MSBuildCache is not part of the cache key -->
<PackagesConfigFile>$(MSBuildThisFileDirectory)packages.config</PackagesConfigFile>
<MSBuildCacheIgnoredInputPatterns>$(MSBuildCacheIgnoredInputPatterns);$(PackagesConfigFile)</MSBuildCacheIgnoredInputPatterns>
</PropertyGroup>

<PropertyGroup Condition="'$(MSBuildCacheEnabled)' == 'true' and '$(MSBuildCachePackageRoot)' == ''">
<PackagesConfigContents>$([System.IO.File]::ReadAllText("$(PackagesConfigFile)"))</PackagesConfigContents>
<MSBuildCachePackageVersion>$([System.Text.RegularExpressions.Regex]::Match($(PackagesConfigContents), 'Microsoft.MSBuildCache.*?version="(.*?)"').Groups[1].Value)</MSBuildCachePackageVersion>
<MSBuildCachePackageRoot>$(MSBuildThisFileDirectory)packages\$(MSBuildCachePackageName).$(MSBuildCachePackageVersion)</MSBuildCachePackageRoot>
<MSBuildCacheSharedCompilationPackageRoot>$(MSBuildThisFileDirectory)packages\Microsoft.MSBuildCache.SharedCompilation.$(MSBuildCachePackageVersion)</MSBuildCacheSharedCompilationPackageRoot>
</PropertyGroup>

<ImportGroup Condition="'$(MSBuildCacheEnabled)' == 'true'">
<Import Project="$(MSBuildCachePackageRoot)\build\$(MSBuildCachePackageName).props" />
<Import Project="$(MSBuildCacheSharedCompilationPackageRoot)\build\Microsoft.MSBuildCache.SharedCompilation.props" />
</ImportGroup>
<Import Project="$(MSBuildThisFileDirectory)\custom.props" />
</Project>
7 changes: 2 additions & 5 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
<Project>
<Sdk Name="Microsoft.Build.CopyOnWrite" Version="1.0.282" />

<Import Project="$(MSBuildCachePackageRoot)\build\$(MSBuildCachePackageName).targets" Condition="'$(MSBuildCacheEnabled)' == 'true'" />
<Import Project="$(MSBuildCacheSharedCompilationPackageRoot)\build\Microsoft.MSBuildCache.SharedCompilation.targets" Condition="'$(MSBuildCacheEnabled)' == 'true'" />
</Project>
<Import Project="$(MSBuildThisFileDirectory)\custom.targets" />
</Project>
1 change: 0 additions & 1 deletion PowerToys.sln
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
Directory.Build.targets = Directory.Build.targets
Directory.Packages.props = Directory.Packages.props
Solution.props = Solution.props
src\Version.props = src\Version.props
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Settings.UI.Library", "src\settings-ui\Settings.UI.Library\Settings.UI.Library.csproj", "{B1BCC8C6-46B5-4BFA-8F22-20F32D99EC6A}"
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@ In this release, we focused on adding a new utility (PowerToys Workspaces), Adva
### Development

- Ported all C++/CX code to C++/WinRT.
- Moved Version.props import to Directory.Build.props.
- Extracted self-containment related .csproj properties to src/Common.SelfContained.props.
- Unused and obsolete dependencies cleanup. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
- Extracted CSWinRT related .csproj properties to src/Common.Dotnet.CsWinRT.props.
Expand Down
Loading

0 comments on commit 3d6b78e

Please sign in to comment.