Add a new YAML release pipeline to replace the old CDPx one (#15039)

* lets move unneeded stuff out

* adding in direct installer yml

* forcing internal

* Create release.yml

* Update release.yml

* Try to use the right feed, scrub

* What if we don't do package ES...

* Update release.yml

* Update release.yml

* Update release.yml for Azure Pipelines

* Update release.yml

* Update release.yml

* seeing where we are in the world

* adjustment

* fixed a copy/paste

* think we're in root, having a dir command just to verify

* start copying over core files

* adding in tools + setup

* fixing telem

* ci: fix could not lock config file flakiness

* forcing root dir

* attempting to copy files again

* adding notes

* lets try this again

* trying a quicker way to figure out root

* maybe it is the slash not being there looking at docs deeper

* playing with slashes

* signing

* tewak

* fixing file path for signing.  suprise, app driver and PT have different paths :)

* getting my sign on

* tweaking json

* Adjusting files and getting output from build

* fixing yml copy and paste oops

* fixing spacing ...

* getting bootstrapper added

* moving file and seeing if we can't get this pipeline goodness working

* trying my next oops at powershell ...

* shift in version location i bet this will fail, doing a parallel build to verify

* trying again for powershell passing in arg

* Dustin showed me the error

* forcing as string

* fdsfasd

* forcing as string

* getting sad panda

* trying to force array

* lets try this on single line ....

* i made a major oops

* Sync'ing naming, adding in signing for msi & boot

* breaking up signing into smaller bits

* grr, not everything committed

* Added a lot of comments

* fixing installer signing path

* fixing paths

* seeing if this fixes some of the signing quirks

* removing 3rd party double, removing the pipeline call

* centeralizing again

* more consolidation

* Going a bit more wide

* going very wide

* seeing if i can't do a dual but more targetted list

* think having leading slash caused a failure

* looks like the esrp  does not verify paths don't exist

* fixing 3rd party

* reseting old stuff so old pipeline still works

* resetting version setting

* [PR INTO CRUTKAS BR] Fix the localization pipeline (#15026)

* Fix localization

This commit makes a few changes:
1. It introduces a couple scripts for moving localization files
   around based on Touchdown's output shape. They are well-documented.
2. It rewrites portions of the RESX->RC converter to avoid resgen and
   handle the new touchdown language types.

* I forgot the cardinal rule of using YAML: Don't

* Fix duplicate keys in Keyboard Editor!

* Up the timeout

* Update the language list in the wxs

* Use IsPipeline

* Special case SvgPreviewHandler >:{

* Push this down to Clint's branch: fix the publish profile

* Reinstate the call to publish.cmd

* Document it

* build the publishing rules

* Remove the GitSubmodules hack

* Restore CDPx move_uwp_resources

* Don't need this any more! spelling.

* adding spelling

* sorting alphabetical

* fix spelling

* shifint to new dll naming

* Move GcodePreviewHandler's Resources to follow the preferred C# format

* Revert "Move GcodePreviewHandler's Resources to follow the preferred C# format"

This reverts commit daf4c7ef3a.

* remove SVG workaround - requires #15054!

* cleaning up commented code dustin said i could delete :)

* fixing tab vs space

* Update release.yml

Fixing Dustin comments

Co-authored-by: Clint Rutkas <crutkas@microsoft.com>
Co-authored-by: Dustin Howett <duhowett@microsoft.com>
Co-authored-by: Jaime Bernardo <jaime@janeasystems.com>
Co-authored-by: Dustin L. Howett <dustin@howett.net>
This commit is contained in:
Clint Rutkas
2021-12-17 18:15:31 -08:00
committed by GitHub
parent 239610f1cd
commit d5a2bf16d9
23 changed files with 948 additions and 168 deletions

View File

@@ -25,9 +25,6 @@ else
$initResourceID = 101
}
# Temporary file created used for resgen
$tempFile = "temporaryResourceFile.txt"
# Flags to check if the first updated has occurred
$headerFileUpdated = $false
$rcFileUpdated = $false
@@ -50,6 +47,7 @@ if (!(Test-Path -Path $generatedFilesFolder))
# Hash table to get the language codes from the code used in the file name
$languageHashTable = @{ "en" = @("ENU", "ENGLISH", "ENGLISH_US", "English (United States)");
"zh-Hans" = @("CHS", "CHINESE", "NEUTRAL", "Chinese (Simplified)");
"zh-CN" = @("CHS", "CHINESE", "NEUTRAL", "Chinese (Simplified)");
"cs" = @("CSY", "CZECH", "NEUTRAL", "Czech");
"hu" = @("HUN", "HUNGARIAN", "NEUTRAL", "Hungarian");
"pl" = @("PLK", "POLISH", "NEUTRAL", "Polish");
@@ -74,6 +72,7 @@ $languageHashTable = @{ "en" = @("ENU", "ENGLISH", "ENGLISH_US", "English (Unite
"sv" = @("SVE", "SWEDISH", "NEUTRAL", "Swedish");
"pt-PT" = @("PTG", "PORTUGUESE", "PORTUGUESE", "Portuguese (Portugal)");
"zh-Hant" = @("CHT", "CHINESE", "CHINESE_TRADITIONAL", "Chinese (Traditional)")
"zh-TW" = @("CHT", "CHINESE", "CHINESE_TRADITIONAL", "Chinese (Traditional)")
}
# Store the content to be written to a buffer
@@ -81,14 +80,15 @@ $headerFileContent = ""
$rcFileContent = ""
# Iterate over all resx files in parent directory
Get-ChildItem $parentDirectory -Filter *.resx |
Get-ChildItem $parentDirectory -Recurse -Filter *.resx |
Foreach-Object {
# Use resgen to parse resx to txt. More details at https://docs.microsoft.com/en-us/dotnet/framework/tools/resgen-exe-resource-file-generator#converting-between-resource-file-types
Write-Host "Processing $($_.FullName)"
$xmlDocument = $null
try {
resgen $_.FullName $tempFile
$xmlDocument = [xml](Get-Content $_.FullName -ErrorAction:Stop)
}
catch {
echo "resgen failed to convert resx file"
Write-Host "Failed to load $($_.FullName)"
exit 0
}
@@ -97,39 +97,50 @@ Foreach-Object {
$tokens = $_.Name -split "\."
if ($tokens.Count -eq 3) {
$lang = $tokens[1]
} else {
$d = $_.Directory.Name
If ($d.Contains('-')) { # Looks like a language directory
$lang = $d
}
}
$langData = $languageHashTable[$lang]
if ($null -eq $langData -and $lang.Contains('-')) {
# Modern Localization comes in with language + country tuples;
# we want to detect the language alone if we don't support the language-country
# version.
$lang = ($lang -split "-")[0]
$langData = $languageHashTable[$lang]
}
if ($null -eq $langData) {
Write-Warning "Unknown language $lang"
Return
}
$newLinesForRCFile = ""
$newLinesForHeaderFile = ""
$count = $initResourceID
try {
foreach ($line in (Get-Content $tempFile -Encoding unicode)) {
# Each line of the resgen text file is of the form ResourceName=ResourceValue with no spaces.
$content = $line -split "=", 2
foreach ($entry in $xmlDocument.root.data) {
$culture = [System.Globalization.CultureInfo]::GetCultureInfo('en-US')
# Each resource is named as IDS_ResxResourceName, in uppercase. Escape occurrences of double quotes in the string
$lineInRCFormat = "IDS_" + $content[0].ToUpper($culture) + " L`"" + $content[1].Replace("`"", "`"`"") + "`""
$lineInRCFormat = "IDS_" + $entry.name.ToUpper($culture) + " L`"" + $entry.value.Replace("`"", "`"`"") + "`""
$newLinesForRCFile = $newLinesForRCFile + "`r`n " + $lineInRCFormat
# Resource header file needs to be updated only for one language
if (!$headerFileUpdated) {
$lineInHeaderFormat = "#define IDS_" + $content[0].ToUpper($culture) + " " + $count.ToString()
$lineInHeaderFormat = "#define IDS_" + $entry.name.ToUpper($culture) + " " + $count.ToString()
$newLinesForHeaderFile = $newLinesForHeaderFile + "`r`n" + $lineInHeaderFormat
$count++
}
}
}
catch {
echo "Failed to read temporary file."
echo "Failed to read XML document."
exit 0
}
# Delete temporary text file used by resgen
Remove-Item $tempFile
# Add string table syntax
$newLinesForRCFile = "`r`nSTRINGTABLE`r`nBEGIN" + $newLinesForRCFile + "`r`nEND"

View File

@@ -0,0 +1,29 @@
[CmdletBinding()]
# This script finds all C#/.NET resx files and renames them from
# Folder/Language/x.resw to Folder/x.Language.resw, with language
# mapping. This is required because Touchdown localization uses a
# different directory structure.
$Items = Get-ChildItem . -Recurse -Filter *.resx
# Each of the projects we care about stores its resources
# in a Properties directory. We **DO NOT** want to move
# resource files from other projects (since we use resx files
# in standard Win32 projects as well.)
$Items = $Items | Where-Object {
$_.Directory.Parent.Name -Eq "Properties"
}
If ($Items.Count -Le 0) {
# Nothing to do.
Write-Verbose "Nothing to do."
Exit 0
}
ForEach($Item in $Items) {
$PropertiesRoot = $Item.Directory.Parent
$Language = $Item.Directory.Name
$Destination = Join-Path $PropertiesRoot.FullName ("{0}.{1}{2}" -F ($Item.BaseName, $Language, $Item.Extension))
Write-Verbose "Renaming $($Item.FullName) to $Destination"
Move-Item $Item.FullName $Destination
}

View File

@@ -0,0 +1,18 @@
[CmdletBinding()]
# This script finds all UWP resw files that are emitted by Touchdown
# with a bad path (en-us/lang-lang) and moves them to the correct
# location.
$Items = Get-ChildItem . -Recurse -Filter *.resw |
Where-Object FullName -Like "*\en-US\*\*.resw"
If ($Items.Count -Le 0) {
# Nothing to do.
Write-Verbose "Nothing to do."
Exit 0
}
$Items | ForEach-Object {
# Move each resw file's parent folder into its parent's parent's folder.
Move-Item -Verbose $_.Directory.FullName $_.Directory.Parent.Parent.FullName -EA:Ignore
}