From 7e26425e86e8b3611219874bbc2c8d20b457e0a7 Mon Sep 17 00:00:00 2001 From: Sergei Vorobev Date: Fri, 17 Jun 2016 11:12:30 -0700 Subject: [PATCH] Make Start-ResGen smarter: don't need to explicitly list all modules --- build.psm1 | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/build.psm1 b/build.psm1 index f90dc21130..71e2c50f81 100644 --- a/build.psm1 +++ b/build.psm1 @@ -872,26 +872,22 @@ function Start-ResGen [CmdletBinding()] param() - @("Microsoft.PowerShell.Commands.Management", -"Microsoft.PowerShell.Commands.Utility", -"Microsoft.PowerShell.ConsoleHost", -"Microsoft.PowerShell.ScheduledJob", -"Microsoft.PowerShell.CoreCLR.Eventing", -"Microsoft.PowerShell.LocalAccounts", -"Microsoft.PowerShell.Security", -"System.Management.Automation") | % { - $module = $_ - Get-ChildItem "$PSScriptRoot/src/$module/resources" -Filter '*.resx' | % { - $className = $_.Name.Replace('.resx', '') - $xml = [xml](Get-Content -raw $_.FullName) + Get-ChildItem $PSScriptRoot/src -Directory | ? { + Get-ChildItem (Join-Path $_.FullName 'resources') -ErrorAction SilentlyContinue} | % { + $_. Name} | % { - $fileName = $className - $genSource = Get-StronglyTypeCsFileForResx -xml $xml -ModuleName $module -ClassName $className - $outPath = "$PSScriptRoot/src/$module/gen/$fileName.cs" - Write-Verbose "ResGen for $outPath" - New-Item -Type Directory -ErrorAction SilentlyContinue (Split-Path $outPath) > $null - Set-Content -Encoding Ascii -Path $outPath -Value $genSource - } + $module = $_ + Get-ChildItem "$PSScriptRoot/src/$module/resources" -Filter '*.resx' | % { + $className = $_.Name.Replace('.resx', '') + $xml = [xml](Get-Content -raw $_.FullName) + + $fileName = $className + $genSource = Get-StronglyTypeCsFileForResx -xml $xml -ModuleName $module -ClassName $className + $outPath = "$PSScriptRoot/src/$module/gen/$fileName.cs" + Write-Verbose "ResGen for $outPath" + New-Item -Type Directory -ErrorAction SilentlyContinue (Split-Path $outPath) > $null + Set-Content -Encoding Ascii -Path $outPath -Value $genSource + } } }