Skip to content

Commit

Permalink
[installer] Support per-user installation (microsoft#24087)
Browse files Browse the repository at this point in the history
* Add per user installer

* Separate upgrade codes for per machine and per user installation
Move per machine check to bootstrapper
Move all defines to common.wxs
Fix CI

* Update installer/PowerToysSetup/generateFileList.ps1

Co-authored-by: Jeremy Sinclair <[email protected]>

* Update installer/PowerToysSetup/generateAllFileComponents.ps1

Co-authored-by: Jeremy Sinclair <[email protected]>

* Update installer/PowerToysSetup/generateFileList.ps1

Co-authored-by: Jeremy Sinclair <[email protected]>

* expect.txt

* Revert "Update installer/PowerToysSetup/generateFileList.ps1"

This reverts commit 34545da.

* Update release CI to build both installers

* Revert bundle name change

It messes up app ID for per-user installation which ends up breaking winget update
of the per-user PT

* spellcheck

* Fix bad merge

* Add RegistryPreview

* Include backup_restore_settings.json

* Revert testing endpoint change

---------

Co-authored-by: Jeremy Sinclair <[email protected]>
  • Loading branch information
stefansjfw and snickler authored Mar 31, 2023
1 parent 07579c9 commit 870f8e3
Show file tree
Hide file tree
Showing 48 changed files with 3,244 additions and 1,109 deletions.
195 changes: 176 additions & 19 deletions .github/actions/spell-check/expect.txt

Large diffs are not rendered by default.

3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,3 @@ src/common/Telemetry/*.etl
/src/modules/previewpane/SvgThumbnailProvider/$(SolutionDir)$(Platform)/$(Configuration)/modules/FileExplorerPreview/SvgThumbnailProvider.xml
/src/modules/powerrename/ui/RCa24464
/src/modules/powerrename/ui/RCb24464

# Generated installer file for Monaco source files.
/installer/PowerToysSetup/MonacoSRC.wxs
1 change: 1 addition & 0 deletions .pipelines/ESRPSigning_core.json
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@
"modules\\FileExplorerPreview\\Microsoft.Web.WebView2.Wpf.dll",
"modules\\FileExplorerPreview\\WebView2Loader.dll",
"modules\\Hosts\\Microsoft.Graphics.Canvas.Interop.dll",
"modules\\Hosts\\clrcompression.dll",
"modules\\launcher\\e_sqlite3.dll",
"modules\\launcher\\LazyCache.dll",
"modules\\launcher\\SQLitePCLRaw.batteries_v2.dll",
Expand Down
4 changes: 2 additions & 2 deletions .pipelines/ESRPSigning_installer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
{
"MatchedPath": [
"PowerToysSetupCustomActions.dll",
"PowerToysSetup-*.exe",
"PowerToysSetup-*.msi"
"PowerToys*Setup-*.exe",
"PowerToys*Setup-*.msi"
],
"SigningInfo": {
"Operations": [
Expand Down
41 changes: 39 additions & 2 deletions .pipelines/ci/templates/build-powertoys-steps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ steps:
filePath: '$(build.sourcesdirectory)\.pipelines\installWiX.ps1'

- task: VSBuild@1
displayName: 'Build PowerToys MSI'
displayName: 'Build PowerToys per-machine MSI'
inputs:
solution: '**\installer\PowerToysSetup.sln'
vsVersion: 17.0
Expand All @@ -163,7 +163,7 @@ steps:
maximumCpuCount: true

- task: VSBuild@1
displayName: 'Build PowerToys Bootstrapper'
displayName: 'Build PowerToys per-machine Bootstrapper'
inputs:
solution: '**\installer\PowerToysSetup.sln'
vsVersion: 17.0
Expand All @@ -173,6 +173,43 @@ steps:
clean: false
maximumCpuCount: true

- task: PowerShell@2
displayName: Clean installer dir before building per-user installer
inputs:
targetType: inline
script: git clean -xfd -e *exe -- .\installer\
pwsh: true

- task: NuGetCommand@2
displayName: Restore NuGet packages for PowerToysSetup.sln
inputs:
command: restore
feedsToUse: config
configPath: NuGet.config
restoreSolution: installer\PowerToysSetup.sln
restoreDirectory: '$(Build.SourcesDirectory)\installer\packages'

- task: VSBuild@1
displayName: 'Build PowerToys per-user MSI'
inputs:
solution: '**\installer\PowerToysSetup.sln'
vsVersion: 17.0
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'
msbuildArgs: /t:PowerToysInstaller ${{ parameters.additionalBuildArguments }} /p:PerUser=true
maximumCpuCount: true

- task: VSBuild@1
displayName: 'Build PowerToys per-user Bootstrapper'
inputs:
solution: '**\installer\PowerToysSetup.sln'
vsVersion: 17.0
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'
msbuildArgs: /t:PowerToysBootstrapper ${{ parameters.additionalBuildArguments }} /p:PerUser=true
clean: false
maximumCpuCount: true

# directly not doing WinAppDriver testing
- task: VSTest@2
displayName: 'MS Tests'
Expand Down
141 changes: 141 additions & 0 deletions .pipelines/installer-steps.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
parameters:
- name: versionNumber
type: string
default: "0.0.1"
- name: perUserArg
type: string
default: "false"
- name: buildSubDir
type: string
default: "MachineSetup"
- name: installerPrefix
type: string
default: "PowerToysSetup"

steps:
- task: VSBuild@1
displayName: Build PowerToysSetupCustomActions DLL # This dll needs to be build and signed before building the MSI.
inputs:
solution: "**/installer/PowerToysSetup.sln"
vsVersion: 17.0
msbuildArgs: /p:CIBuild=true /bl:$(Build.SourcesDirectory)\msbuild.binlog /t:PowerToysSetupCustomActions /p:RunBuildEvents=true /p:PerUser=${{parameters.perUserArg}}
platform: $(BuildPlatform)
configuration: $(BuildConfiguration)
clean: true
maximumCpuCount: true

- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1
displayName: Sign PowerToysSetupCustomActions DLL
inputs:
ConnectedServiceName: "Terminal/Console/WinAppDriver Team Code Signing Connection"
FolderPath: 'installer/PowerToysSetupCustomActions/$(BuildPlatform)\$(BuildConfiguration)\${{parameters.buildSubDir}}'
signType: batchSigning
batchSignPolicyFile: '$(build.sourcesdirectory)\.pipelines\ESRPSigning_installer.json'
ciPolicyFile: '$(build.sourcesdirectory)\.pipelines\CIPolicy.xml'

## INSTALLER START
#### MSI BUILDING AND SIGNING
- task: VSBuild@1
displayName: Build MSI
inputs:
solution: "**/installer/PowerToysSetup.sln"
vsVersion: 17.0
msbuildArgs: /p:CIBuild=true /target:PowerToysInstaller /bl:$(Build.SourcesDirectory)\msbuild.binlog /p:RunBuildEvents=false /p:PerUser=${{parameters.perUserArg}}
platform: $(BuildPlatform)
configuration: $(BuildConfiguration)
clean: false # don't undo our hard work above by deleting the CustomActions dll
maximumCpuCount: true

- task: CmdLine@2
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
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'

- task: PowerShell@1
displayName: Verifying MSI Custom Actions DLL is signed
inputs:
scriptName: .pipelines/versionAndSignCheck.ps1
arguments: -targetDir '$(build.sourcesdirectory)\extractedMsi\Binary'

- 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)\${{parameters.buildSubDir}}'
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:
solution: "**/installer/PowerToysSetup.sln"
vsVersion: 17.0
msbuildArgs: /p:CIBuild=true /bl:$(Build.SourcesDirectory)\msbuild.binlog /t:PowerToysBootstrapper /p:PerUser=${{parameters.perUserArg}}
platform: $(BuildPlatform)
configuration: $(BuildConfiguration)
clean: false # don't undo our hard work above by deleting the MSI
maximumCpuCount: true

- 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'

- 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: '"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'

- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1
displayName: Sign Bootstrapper
inputs:
ConnectedServiceName: "Terminal/Console/WinAppDriver Team Code Signing Connection"
FolderPath: 'installer/PowerToysSetup/$(BuildPlatform)\$(BuildConfiguration)\${{parameters.buildSubDir}}'
signType: batchSigning
batchSignPolicyFile: '$(build.sourcesdirectory)\.pipelines\ESRPSigning_installer.json'
ciPolicyFile: '$(build.sourcesdirectory)\.pipelines\CIPolicy.xml'
#### END BOOTSTRAP
## END INSTALLER
Loading

0 comments on commit 870f8e3

Please sign in to comment.