microsoft / axe-windows

Automated accessibility testing engine for Windows applications
MIT License
136 stars 62 forks source link

feat(localization): Embed localized files in the NuGet package #786

Closed DaveTryon closed 1 year ago

DaveTryon commented 1 year ago

Details

Add the localized resource files for the Core, Rules, and RuleSelection projects to the NuGet package. This is complicated a bit by the fact that the localized files get created only in the SignedRelease job of the build pipeline, but we want to make sure that we can still build the NuGet package locally for validation testing. We want to avoid having 2 versions of the nuspec file, so this PR takes a tiered approach:

  1. It updates the nuspec file to use glob patterns to include all Axe.Windows DLL's (including any subfolders) under the CI project's build into the NuGet package. It also omits the PDB files, which are no longer generated and should have been removed back in #727
  2. It adds CopyLocalizedFiles.ps1 to ./tools/scripts. This script is responsible for picking up the MicroBuild-generated localized files for a single project and placing them into the directory structure expected by .NET
  3. It adds a CopyLocalizedFiles target to CI.csproj. This target is enabled only when building in the SignedRelease job of the signed pipeline, and runs CopyLocalizedFiles.ps1 for each of the Core, Rules, and RuleSelection projects. This target runs after the build but before the Pack target

The net result is that when building within the SignedRelease job of the signed build pipeline, the signed localized files get included within the signed NuGet package. When building anywhere else, the unsigned NuGet package contains unsigned English files--which is all we need for validation.

The validation build published a NuGet package that contains the correctly signed resource files. The localization file structure of this package matches what exists in the Microsoft.VisualStudio.Services.Client package.

Motivation

Part of the localization feature

Context

Pull request checklist