2021-12-18 10:15:31 +08:00
# This build should never run as CI or against a pull request.
trigger : none
pr : none
pool :
name : WinDevPool-L
2022-02-07 22:08:30 +08:00
demands : ImageOverride -equals WinDevVS17-latest
2021-12-18 10:15:31 +08:00
parameters :
- name : buildConfigurations
type : object
default :
- Release
- name : buildPlatforms
type : object
default :
- x64
- name : versionNumber
type : string
default : '0.0.1'
variables :
IsPipeline : 1 # The installer uses this to detect whether it should pick up localizations
name : $(BuildDefinitionName)_$(date:yyMM).$(date:dd)$(rev:rrr)
resources :
repositories :
- repository : self
type : git
ref : main
jobs :
- job : Build
strategy :
matrix :
${{ each config in parameters.buildConfigurations }}:
${{ each platform in parameters.buildPlatforms }}:
${{ config }}_${{ platform }}:
BuildConfiguration : ${{ config }}
BuildPlatform : ${{ platform }}
displayName : Build
timeoutInMinutes : 120 # Some of the loc stuff adds quite a bit of time.
cancelTimeoutInMinutes : 1
steps :
- checkout : self
clean : true
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 ''
2022-02-07 22:08:30 +08:00
# Guardian tool needs 'Microsoft.NETCore.App', version '2.1.0' (x64)
- task : UseDotNet@2
displayName : 'Use .NET Core 2.1 SDK'
inputs :
packageType : sdk
version : '2.1.x'
- task : UseDotNet@2
displayName : 'Use .NET 6 SDK'
inputs :
packageType : sdk
version : '6.x'
- task : NuGetAuthenticate@0
inputs :
nuGetServiceConnections : PowerToysCDPxFeed
- task : NuGetToolInstaller@1
displayName : Use NuGet Installer latest
# this will restore the following nugets:
# - main solution
# - Bug report tool
# - Webcam report tool
# - Installer
# - Bootstrapper Installer
- task : NuGetCommand@2
displayName : NuGet restore solutions dependencies
inputs :
command : restore
restoreSolution : '**/*.sln'
selectOrConfig : config
nugetConfigPath : .pipelines/release-nuget.config
2021-12-18 10:15:31 +08:00
- task : MicrosoftTDBuild.tdbuild-task.tdbuild-task.TouchdownBuildTask@1
displayName : 'Download Localization Files -- PowerToys 37400'
inputs :
teamId : 37400
authId : '$(TouchdownApplicationID)'
authKey : '$(TouchdownApplicationKey)'
resourceFilePath : |
**\Resources.resx
**\Resource.resx
**\Resources.resw
appendRelativeDir : true
localizationTarget : false
2022-02-11 05:52:28 +08:00
# pseudoSetting: Included
2022-02-07 22:08:30 +08:00
2021-12-18 10:15:31 +08:00
- task : PowerShell@2
displayName : Move Loc files into correct locations
inputs :
targetType : inline
script : >-
$VerbosePreference = "Continue"
./tools/build/move-and-rename-resx.ps1
./tools/build/move-uwp-resw.ps1
pwsh : true
- task : CmdLine@2
displayName : Moving telem files
inputs :
script : |
call nuget.exe restore -configFile .pipelines/release-nuget.config -PackagesDirectory . .pipelines/packages.config || exit /b 1
move /Y "Microsoft.PowerToys.Telemetry.2.0.0\build\include\TraceLoggingDefines.h" "src\common\Telemetry\TraceLoggingDefines.h" || exit /b 1
move /Y "Microsoft.PowerToys.Telemetry.2.0.0\build\include\TelemetryBase.cs" "src\common\Telemetry\TelemetryBase.cs" || exit /b 1
## ALL BUT INSTALLER BUILDING
- task : VSBuild@1
displayName : Build PowerToys main project
inputs :
solution : '**\PowerToys.sln'
2022-02-07 22:08:30 +08:00
vsVersion : 17.0
2021-12-18 10:15:31 +08:00
msbuildArgs : /p:CIBuild=true /bl:$(Build.SourcesDirectory)\msbuild.binlog
platform : $(BuildPlatform)
configuration : $(BuildConfiguration)
clean : true
maximumCpuCount : true
- task : VSBuild@1
displayName : Build BugReportTool
inputs :
solution : '**/tools/BugReportTool/BugReportTool.sln'
2022-02-15 03:41:10 +08:00
vsVersion : 17.0
2021-12-18 10:15:31 +08:00
msbuildArgs : /p:CIBuild=true /bl:$(Build.SourcesDirectory)\msbuild.binlog
platform : $(BuildPlatform)
configuration : $(BuildConfiguration)
clean : true
maximumCpuCount : true
- task : VSBuild@1
displayName : Build WebcamReportTool
inputs :
solution : '**/tools/WebcamReportTool/WebcamReportTool.sln'
2022-02-07 22:08:30 +08:00
vsVersion : 17.0
2021-12-18 10:15:31 +08:00
msbuildArgs : /p:CIBuild=true /bl:$(Build.SourcesDirectory)\msbuild.binlog
platform : $(BuildPlatform)
configuration : $(BuildConfiguration)
clean : true
maximumCpuCount : true
2022-04-28 04:21:00 +08:00
- task : VSBuild@1
2022-04-28 19:20:05 +08:00
displayName : Build StylesReportTool
2022-04-28 04:21:00 +08:00
inputs :
2022-04-28 19:20:05 +08:00
solution : '**/tools/StylesReportTool/StylesReportTool.sln'
2022-04-28 04:21:00 +08:00
vsVersion : 17.0
msbuildArgs : /p:CIBuild=true /bl:$(Build.SourcesDirectory)\msbuild.binlog
platform : $(BuildPlatform)
configuration : $(BuildConfiguration)
clean : true
maximumCpuCount : true
2021-12-18 10:15:31 +08:00
- task : VSBuild@1
displayName : Build PowerToysSetupCustomActions
inputs :
solution : '**/installer/PowerToysSetup.sln'
2022-02-07 22:08:30 +08:00
vsVersion : 17.0
2021-12-18 10:15:31 +08:00
msbuildArgs : /target:PowerToysSetupCustomActions /p:CIBuild=true /bl:$(Build.SourcesDirectory)\msbuild.binlog
platform : $(BuildPlatform)
configuration : $(BuildConfiguration)
clean : true
maximumCpuCount : true
- task : VSBuild@1
displayName : Publish Settings for Packaging
inputs :
2022-04-20 04:00:28 +08:00
solution : 'src/settings-ui/Settings.UI/PowerToys.Settings.csproj'
2022-02-07 22:08:30 +08:00
vsVersion : 17.0
2021-12-18 10:15:31 +08:00
msbuildArgs : >-
/target:Publish
/p:Configuration=$(BuildConfiguration);Platform=$(BuildPlatform);AppxBundle=Never
/p:VCRTForwarders-IncludeDebugCRT=false
/p:PowerToysRoot=$(Build.SourcesDirectory)
/p:PublishProfile=InstallationPublishProfile.pubxml
platform : $(BuildPlatform)
configuration : $(BuildConfiguration)
maximumCpuCount : true
- task : VSBuild@1
displayName : Publish Launcher for Packaging
inputs :
solution : 'src/modules/launcher/PowerLauncher/PowerLauncher.csproj'
2022-02-07 22:08:30 +08:00
vsVersion : 17.0
2021-12-18 10:15:31 +08:00
# The arguments should be the same as the ones for Settings; make sure they are.
msbuildArgs : >-
/target:Publish
/p:Configuration=$(BuildConfiguration);Platform=$(BuildPlatform);AppxBundle=Never
/p:VCRTForwarders-IncludeDebugCRT=false
/p:PowerToysRoot=$(Build.SourcesDirectory)
/p:PublishProfile=InstallationPublishProfile.pubxml
platform : $(BuildPlatform)
configuration : $(BuildConfiguration)
maximumCpuCount : true
#### MAIN SIGNING AREA
# reference https://dev.azure.com/microsoft/Dart/_git/AppDriver?path=/ESRPSigning.json&version=GBarm64-netcore&_a=contents for winappdriver
# https://dev.azure.com/microsoft/Dart/_git/AppDriver?path=/CIPolicy.xml&version=GBarm64-netcore&_a=contents
2022-02-07 22:08:30 +08:00
2021-12-18 10:15:31 +08:00
- task : SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1
displayName : Sign Core PT
inputs :
ConnectedServiceName : 'Terminal/Console/WinAppDriver Team Code Signing Connection'
FolderPath : '$(BuildPlatform)/$(BuildConfiguration)' # Video conf uses x86 and x64. This path will also work for PowerToysSetupCustomActions which is in a different root dir
signType : batchSigning
batchSignPolicyFile : '$(build.sourcesdirectory)\.pipelines\ESRPSigning_core.json'
ciPolicyFile : '$(build.sourcesdirectory)\.pipelines\CIPolicy.xml'
- task : SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1
displayName : Sign x86 directshow VCM
inputs :
ConnectedServiceName : 'Terminal/Console/WinAppDriver Team Code Signing Connection'
FolderPath : 'x86/$(BuildConfiguration)' # Video conf uses x86 and x64. This path will also work for PowerToysSetupCustomActions which is in a different root dir
signType : batchSigning
batchSignPolicyFile : '$(build.sourcesdirectory)\.pipelines\ESRPSigning_vcm.json'
ciPolicyFile : '$(build.sourcesdirectory)\.pipelines\CIPolicy.xml'
#### END SIGNING
## END MAIN
## INSTALLER START
#### MSI BUILDING AND SIGNING
- task : VSBuild@1
displayName : Build MSI
inputs :
solution : '**/installer/PowerToysSetup.sln'
2022-02-07 22:08:30 +08:00
vsVersion : 17.0
2022-01-06 02:28:09 +08:00
msbuildArgs : /p:CIBuild=true /target:PowerToysInstaller /bl:$(Build.SourcesDirectory)\msbuild.binlog
2021-12-18 10:15:31 +08:00
platform : $(BuildPlatform)
configuration : $(BuildConfiguration)
clean : true
maximumCpuCount : true
2022-01-11 10:26:27 +08:00
- task : CmdLine@2
displayName : 'Extracting MSI to verify contents'
inputs :
script : |
.\installer\packages\WiX.3.11.2\tools\dark.exe -x $(build.sourcesdirectory)\extractedMsi installer\PowerToysSetup\$(BuildPlatform)\$(BuildConfiguration)\PowerToysSetup-${{ parameters.versionNumber }}-$(BuildPlatform).msi
dir $(build.sourcesdirectory)\extractedMsi
# Did we sign all files
- task : PowerShell@1
displayName : Verifying entire build is signed and version set
inputs :
scriptName : .pipelines/versionAndSignCheck.ps1
arguments : -targetDir '$(build.sourcesdirectory)\extractedMsi\File'
2021-12-18 10:15:31 +08:00
- task : SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1
displayName : Sign MSI
inputs :
ConnectedServiceName : 'Terminal/Console/WinAppDriver Team Code Signing Connection'
FolderPath : 'installer/PowerToysSetup/$(BuildPlatform)\$(BuildConfiguration)'
signType : batchSigning
batchSignPolicyFile : '$(build.sourcesdirectory)\.pipelines\ESRPSigning_installer.json'
ciPolicyFile : '$(build.sourcesdirectory)\.pipelines\CIPolicy.xml'
#### END MSI
#### BOOTSTRAP BUILDING AND SIGNING
- task : VSBuild@1
displayName : Build Bootstrapper
inputs :
2022-01-06 02:28:09 +08:00
solution : '**/installer/PowerToysSetup.sln'
2022-02-07 22:08:30 +08:00
vsVersion : 17.0
2022-04-05 16:58:03 +08:00
msbuildArgs : /p:CIBuild=true /bl:$(Build.SourcesDirectory)\msbuild.binlog /t:PowerToysBootstrapper
2021-12-18 10:15:31 +08:00
platform : $(BuildPlatform)
configuration : $(BuildConfiguration)
2022-04-05 16:58:03 +08:00
clean : false # don't undo our hard work above by deleting the MSI
2021-12-18 10:15:31 +08:00
maximumCpuCount : true
2022-01-06 02:28:09 +08:00
- task : CmdLine@2
displayName: 'Insignia : Extract Engine from Bundle'
inputs :
script : '.\installer\packages\WiX.3.11.2\tools\insignia.exe -ib installer\PowerToysSetup\$(BuildPlatform)\$(BuildConfiguration)\PowerToysSetup-${{ parameters.versionNumber }}-$(BuildPlatform).exe -o installer\engine.exe'
- task : SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1
displayName : 'ESRP CodeSigning (Engine)'
inputs :
ConnectedServiceName : 'Terminal/Console/WinAppDriver Team Code Signing Connection'
FolderPath : 'installer'
Pattern : engine.exe
signConfigType : inlineSignParams
inlineOperation : |
[
{
"KeyCode": "CP-230012" ,
"OperationCode": "SigntoolSign" ,
"Parameters": {
"OpusName": "Microsoft" ,
"OpusInfo": "http://www.microsoft.com" ,
"FileDigest": "/fd \"SHA256\"" ,
"PageHash": "/NPH" ,
"TimeStamp": "/tr \"http://rfc3161.gtm.corp.microsoft.com/TSS/HttpTspServer\" /td sha256"
},
"ToolName": "sign" ,
"ToolVersion": "1.0"
},
{
"KeyCode": "CP-230012" ,
"OperationCode": "SigntoolVerify" ,
"Parameters": {},
"ToolName": "sign" ,
"ToolVersion": "1.0"
}
]
- task : CmdLine@2
displayName: 'Insignia : Merge Engine into Bundle'
inputs :
script : '.\installer\packages\WiX.3.11.2\tools\insignia.exe -ab installer\engine.exe installer\PowerToysSetup\$(BuildPlatform)\$(BuildConfiguration)\PowerToysSetup-${{ parameters.versionNumber }}-$(BuildPlatform).exe -o installer\PowerToysSetup\$(BuildPlatform)\$(BuildConfiguration)\PowerToysSetup-${{ parameters.versionNumber }}-$(BuildPlatform).exe'
2021-12-18 10:15:31 +08:00
- task : SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1
2022-03-18 01:19:16 +08:00
displayName : Sign Bootstrapper
2021-12-18 10:15:31 +08:00
inputs :
ConnectedServiceName : 'Terminal/Console/WinAppDriver Team Code Signing Connection'
2022-01-06 02:28:09 +08:00
FolderPath : 'installer/PowerToysSetup/$(BuildPlatform)\$(BuildConfiguration)'
2021-12-18 10:15:31 +08:00
signType : batchSigning
batchSignPolicyFile : '$(build.sourcesdirectory)\.pipelines\ESRPSigning_installer.json'
ciPolicyFile : '$(build.sourcesdirectory)\.pipelines\CIPolicy.xml'
#### END BOOTSTRAP
## END INSTALLER
- task : PublishBuildArtifacts@1
displayName: 'Publish Artifact : binlog'
condition : failed()
continueOnError : True
inputs :
PathtoPublish : $(Build.SourcesDirectory)\msbuild.binlog
ArtifactName : binlog-$(BuildPlatform)
- task : ComponentGovernanceComponentDetection@0
displayName : Component Detection
- task : CopyFiles@2
2022-02-26 00:42:39 +08:00
displayName : Copying files for symbols
inputs :
contents : >-
**/*.pdb
flattenFolders : True
targetFolder : $(Build.ArtifactStagingDirectory)/Symbols/
- task : PowerShell@2
displayName : 'Remove unneeded files from ArtifactStagingDirectory'
inputs :
targetType : 'inline'
script : |
cd $(Build.ArtifactStagingDirectory)/Symbols/
Remove-Item vc143.pdb
Remove-Item *test*
- task : PublishSymbols@2
displayName : Publish symbols path
continueOnError : True
inputs :
SearchPattern : |
$(Build.ArtifactStagingDirectory)/Symbols/**/*.*
IndexSources : false
SymbolServerType : TeamServices
- task : PublishBuildArtifacts@1
displayName: 'Publish Artifact : Symbols'
inputs :
PathtoPublish : $(System.ArtifactsDirectory)/Symbols/
ArtifactName : Symbols
- task : DeleteFiles@1
displayName : 'Remove symbols from ArtifactStagingDirectory'
inputs :
Contents : '*'
SourceFolder : $(Build.ArtifactStagingDirectory)/Symbols/
RemoveSourceFolder : True
- task : CopyFiles@2
displayName : Copying setup file over
2021-12-18 10:15:31 +08:00
inputs :
contents : '**/PowerToysSetup-*.exe'
flattenFolders : True
targetFolder : $(Build.ArtifactStagingDirectory)
2022-02-26 00:42:39 +08:00
2021-12-18 10:15:31 +08:00
- task : PublishBuildArtifacts@1
displayName: 'Publish Artifact : PowerToySetup'
inputs :
PathtoPublish : $(System.ArtifactsDirectory)
2022-02-26 00:42:39 +08:00
ArtifactName : setup-$(BuildPlatform)
2021-12-18 10:15:31 +08:00
...