Skip to content

Commit

Permalink
Installer: dramatically simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
DHowett committed Sep 19, 2024
1 parent b01bf3e commit 1c87d8a
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 29 deletions.
7 changes: 1 addition & 6 deletions .pipelines/v2/templates/job-build-project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -438,19 +438,14 @@ jobs:
signingIdentity: ${{ parameters.signingIdentity }}
versionNumber: ${{ parameters.versionNumber }}
additionalBuildOptions: ${{ parameters.additionalBuildOptions }}
perUserArg: "false"
buildSubDir: "MachineSetup"
installerPrefix: "PowerToysSetup"

- template: steps-build-installer.yml
parameters:
codeSign: ${{ parameters.codeSign }}
signingIdentity: ${{ parameters.signingIdentity }}
versionNumber: ${{ parameters.versionNumber }}
additionalBuildOptions: ${{ parameters.additionalBuildOptions }}
perUserArg: "true"
buildSubDir: "UserSetup"
installerPrefix: "PowerToysUserSetup"
buildUserInstaller: true # NOTE: This is the distinction between the above and below rules

- task: CopyFiles@2
displayName: Copying setup file over
Expand Down
55 changes: 32 additions & 23 deletions .pipelines/v2/templates/steps-build-installer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,9 @@ 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"
- name: buildUserInstaller
type: boolean
default: false
- name: codeSign
type: boolean
default: false
Expand All @@ -26,17 +20,29 @@ steps:
& git clean -xfd -e *exe -- .\installer\
displayName: Clean the installer to reduce cross-contamination
- pwsh: |-
$IsPerUser = $${{ parameters.buildUserInstaller }}
$InstallerBuildSlug = "MachineSetup"
$InstallerBasename = "PowerToysSetup"
If($IsPerUser) {
$InstallerBuildSlug = "UserSetup"
$InstallerBasename = "PowerToysUserSetup"
}
$InstallerBasename += "-${{ parameters.versionNumber }}-$(BuildPlatform)"
Write-Host "##vso[task.setvariable variable=InstallerBuildSlug]$InstallerBuildSlug"
Write-Host "##vso[task.setvariable variable=InstallerRelativePath]$(BuildPlatform)\$(BuildConfiguration)\$InstallerBuildSlug"
Write-Host "##vso[task.setvariable variable=InstallerBasename]$InstallerBasename"
displayName: Prepare Installer Variables
- task: VSBuild@1
displayName: Build PowerToysSetupCustomActions DLL # This dll needs to be built and signed before building the MSI.
inputs:
solution: "**/installer/PowerToysSetup.sln"
vsVersion: 17.0
msbuildArgs: >-
/t:PowerToysSetupCustomActions
/p:RunBuildEvents=true /p:PerUser=${{parameters.perUserArg}}
/p:RunBuildEvents=true;PerUser=${{parameters.buildUserInstaller}};RestorePackagesConfig=true;CIBuild=true
-restore -graph
/p:RestorePackagesConfig=true
/p:CIBuild=true
/bl:$(Build.SourcesDirectory)\msbuild.binlog
${{ parameters.additionalBuildOptions }}
$(MSBuildCacheParameters)
Expand All @@ -51,7 +57,7 @@ steps:
displayName: Sign PowerToysSetupCustomActions DLL
signingIdentity: ${{ parameters.signingIdentity }}
inputs:
FolderPath: 'installer/PowerToysSetupCustomActions/$(BuildPlatform)\$(BuildConfiguration)\${{parameters.buildSubDir}}'
FolderPath: 'installer/PowerToysSetupCustomActions/$(InstallerRelativePath)'
signType: batchSigning
batchSignPolicyFile: '$(build.sourcesdirectory)\.pipelines\ESRPSigning_installer.json'
ciPolicyFile: '$(build.sourcesdirectory)\.pipelines\CIPolicy.xml'
Expand All @@ -64,11 +70,9 @@ steps:
solution: "**/installer/PowerToysSetup.sln"
vsVersion: 17.0
msbuildArgs: >-
/p:RunBuildEvents=false /p:PerUser=${{parameters.perUserArg}} /p:BuildProjectReferences=false
/t:PowerToysInstaller
/p:RunBuildEvents=false;PerUser=${{parameters.buildUserInstaller}};BuildProjectReferences=false;RestorePackagesConfig=true;CIBuild=true
-restore -graph
/p:RestorePackagesConfig=true
/p:CIBuild=true
/bl:$(Build.SourcesDirectory)\msbuild.binlog
${{ parameters.additionalBuildOptions }}
$(MSBuildCacheParameters)
platform: $(BuildPlatform)
Expand All @@ -77,7 +81,7 @@ steps:
maximumCpuCount: true

- 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\$(InstallerRelativePath)\$(InstallerBasename).msi
dir $(build.sourcesdirectory)\extractedMsi
displayName: "Extracting MSI to verify contents"
Expand All @@ -97,7 +101,7 @@ steps:
displayName: Sign MSI
signingIdentity: ${{ parameters.signingIdentity }}
inputs:
FolderPath: 'installer/PowerToysSetup/$(BuildPlatform)\$(BuildConfiguration)\${{parameters.buildSubDir}}'
FolderPath: 'installer/PowerToysSetup/$(InstallerRelativePath)'
signType: batchSigning
batchSignPolicyFile: '$(build.sourcesdirectory)\.pipelines\ESRPSigning_installer.json'
ciPolicyFile: '$(build.sourcesdirectory)\.pipelines\CIPolicy.xml'
Expand All @@ -110,7 +114,12 @@ steps:
inputs:
solution: "**/installer/PowerToysSetup.sln"
vsVersion: 17.0
msbuildArgs: /p:CIBuild=true /t:PowerToysBootstrapper /p:PerUser=${{parameters.perUserArg}} ${{ parameters.additionalBuildOptions }} $(MSBuildCacheParameters)
msbuildArgs: >-
/t:PowerToysBootstrapper
/p:PerUser=${{parameters.buildUserInstaller}};CIBuild=true
-restore -graph
${{ parameters.additionalBuildOptions }}
$(MSBuildCacheParameters)
platform: $(BuildPlatform)
configuration: $(BuildConfiguration)
clean: false # don't undo our hard work above by deleting the MSI
Expand All @@ -119,7 +128,7 @@ steps:
# The entirety of bundle unpacking/re-packing is unnecessary if we are not code signing it.
- ${{ if eq(parameters.codeSign, true) }}:
- 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
"C:\Program Files (x86)\WiX Toolset v3.14\bin\insignia.exe" -ib installer\PowerToysSetup\$(InstallerRelativePath)\$(InstallerBasename).exe -o installer\engine.exe
displayName: "Insignia: Extract Engine from Bundle"
- template: steps-esrp-signing.yml
Expand Down Expand Up @@ -155,15 +164,15 @@ steps:
]
- 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
"C:\Program Files (x86)\WiX Toolset v3.14\bin\insignia.exe" -ab installer\engine.exe installer\PowerToysSetup\$(InstallerRelativePath)\$(InstallerBasename).exe -o installer\PowerToysSetup\$(InstallerRelativePath)\$(InstallerBasename).exe
displayName: "Insignia: Merge Engine into Bundle"
- template: steps-esrp-signing.yml
parameters:
displayName: Sign Bootstrapper
signingIdentity: ${{ parameters.signingIdentity }}
inputs:
FolderPath: 'installer/PowerToysSetup/$(BuildPlatform)\$(BuildConfiguration)\${{parameters.buildSubDir}}'
FolderPath: 'installer/PowerToysSetup/$(InstallerRelativePath)'
signType: batchSigning
batchSignPolicyFile: '$(build.sourcesdirectory)\.pipelines\ESRPSigning_installer.json'
ciPolicyFile: '$(build.sourcesdirectory)\.pipelines\CIPolicy.xml'
Expand Down

1 comment on commit 1c87d8a

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@check-spelling-bot Report

🔴 Please review

See the 📜action log or 📝 job summary for details.

Unrecognized words (30)
akv
binskim
checkcflags
cloudvault
conhost
conpty
createvpack
gdnbaselines
gitcheckin
issecret
msbuildcache
MSDL
nerf
NUnit
owneralias
packagename
PDBs
pgo
policheck
sbom
symbolrequestprod
trafficmanager
vpack
vpackdirectory
VPACKMANIFESTDIRECTORY
wtl
Wtt
XES
xfgcheck
XUnit
Previously acknowledged words that are now absent AKV applayout appsfolder cswinrt GBarm netcore nugets systemsettings SYSTEMWOW telem USEPOSITION USESIZE winappdriver 🫥
To accept these unrecognized words as correct and remove the previously acknowledged and now absent words, you could run the following commands

... in a clone of the [email protected]:microsoft/PowerToys.git repository
on the dev/duhowett/new-build-rules branch (ℹ️ how do I use this?):

curl -s -S -L 'https://raw.githubusercontent.com/check-spelling/check-spelling/v0.0.22/apply.pl' |
perl - 'https://github.com/microsoft/PowerToys/actions/runs/10948896486/attempts/1'
Available 📚 dictionaries could cover words (expected and unrecognized) not in the 📘 dictionary

This includes both expected items (1919) from .github/actions/spell-check/expect.txt and unrecognized words (30)

Dictionary Entries Covers Uniquely
cspell:gaming-terms/dict/gaming-terms.txt 59 1 1
cspell:r/src/r.txt 543 1 1
cspell:cpp/src/people.txt 23 1
cspell:cpp/src/ecosystem.txt 51 1

Consider adding them (in .github/workflows/spelling2.yml) for uses: check-spelling/[email protected] in its with:

      with:
        extra_dictionaries:
          cspell:gaming-terms/dict/gaming-terms.txt
          cspell:r/src/r.txt
          cspell:cpp/src/people.txt
          cspell:cpp/src/ecosystem.txt

To stop checking additional dictionaries, add (in .github/workflows/spelling2.yml) for uses: check-spelling/[email protected] in its with:

check_extra_dictionaries: ''
Errors (2)

See the 📜action log or 📝 job summary for details.

❌ Errors Count
❌ check-file-path 1
ℹ️ non-alpha-in-dictionary 1

See ❌ Event descriptions for more information.

If the flagged items are 🤯 false positives

If items relate to a ...

  • binary file (or some other file you wouldn't want to check at all).

    Please add a file path to the excludes.txt file matching the containing file.

    File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.

    ^ refers to the file's path from the root of the repository, so ^README\.md$ would exclude README.md (on whichever branch you're using).

  • well-formed pattern.

    If you can write a pattern that would match it,
    try adding it to the patterns.txt file.

    Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.

    Note that patterns can't match multiline strings.

Please sign in to comment.