[release/v7.6.7] Fix LocProject.json tests and trigger CIs on changes to LocProject.json (#28104)

This commit is contained in:
Dongbo Wang authored and GitHub committed 2026-09-24 17:09:07 -07:00
1 parent 10414fb917
commit 2db50eaee4
2 files changed
+33 -4

No files matched your search

@@ -112,6 +112,9 @@ runs:
const globalConfigChanged = files.some(file => file === '.globalconfig' || file === 'nuget.config' || file === 'global.json');
console.log(`✓ Global config changed: ${globalConfigChanged}`);
const localizationConfigChanged = files.some(file => file === 'Localize/LocProject.json');
console.log(`✓ Localization config changed: ${localizationConfigChanged}`);
const packagingChanged = files.some(file =>
file === '.github/workflows/windows-ci.yml' ||
file === '.github/workflows/linux-ci.yml' ||
@@ -128,7 +131,7 @@ runs:
toolsCiPsm1Changed;
console.log(`→ Packaging changed: ${packagingChanged}`);
const source = mainSourceChanged || toolsChanged || githubChanged || propsChanged || testsChanged || globalConfigChanged;
const source = mainSourceChanged || toolsChanged || githubChanged || propsChanged || testsChanged || globalConfigChanged || localizationConfigChanged;
console.log(`→ Source (composite): ${source}`);
core.endGroup();
@@ -29,8 +29,18 @@ Describe "LocProject.json file validation" -Tags "CI" {
$realSourceFile = Join-Path $repoRoot $sourceFile
Test-Path -Path $realSourceFile | Should -BeTrue
$_.OutputPath | Should -BeExactly "$parentDir\"
$_.CopyOption | Should -BeExactly 'LangIDOnPathAndName'
if ($sourceFile -like '*.resx') {
$_.OutputPath | Should -BeExactly "$parentDir\"
$_.CopyOption | Should -BeExactly 'LangIDOnPathAndName'
}
elseif ($sourceFile -like '*.xml') {
$_.OutputPath + "en-US" | Should -BeExactly $parentDir
$_.CopyOption | Should -BeExactly 'LangIDOnPath'
}
else {
throw "Unexpected source file type: $sourceFile"
}
}
}
@@ -38,6 +48,21 @@ Describe "LocProject.json file validation" -Tags "CI" {
$srcDir = Join-Path $repoRoot 'src'
$project = $locProject.Projects[0]
$resxLocItemCount = 0
$xmlLocItemCount = 0
foreach ($item in $project.LocItems) {
if ($item.SourceFile -like '*.resx') {
$resxLocItemCount++
}
elseif ($item.SourceFile -like '*.xml') {
$xmlLocItemCount++
}
else {
throw "Unexpected source file type: $($item.SourceFile)"
}
}
try {
Push-Location -Path $srcDir
$resDirs = Get-ChildItem 'resources' -Recurse -Directory | ForEach-Object FullName
@@ -48,7 +73,8 @@ Describe "LocProject.json file validation" -Tags "CI" {
$totalResourceCount += $count
}
$project.LocItems.Count | Should -Be $totalResourceCount
$resxLocItemCount | Should -Be $totalResourceCount
$xmlLocItemCount | Should -Be 1
}
finally {
Pop-Location