mirror of
https://github.com/aphrody-labs/PowerShell.git
synced 2026-10-17 04:36:39 +00:00
Fix build.psm1 to account for LocalAccount dll
This commit is contained in:
1 parent
76e9b74418
commit
69769cede7
1 file changed
+37
-5
+37
-5
@@ -871,14 +871,26 @@ function Start-ResGen
|
||||
"Microsoft.PowerShell.Commands.Utility",
|
||||
"Microsoft.PowerShell.ConsoleHost",
|
||||
"Microsoft.PowerShell.CoreCLR.Eventing",
|
||||
"Microsoft.PowerShell.LocalAccounts",
|
||||
"Microsoft.PowerShell.Security",
|
||||
"System.Management.Automation") | % {
|
||||
$module = $_
|
||||
ls "$PSScriptRoot/src/$module/resources" | % {
|
||||
$className = $_.Name.Replace('.resx', '')
|
||||
$xml = [xml](cat -raw $_.FullName)
|
||||
$genSource = Get-StronglyTypeCsFileForResx -xml $xml -ModuleName $module -ClassName $className
|
||||
$outPath = "$PSScriptRoot/src/windows-build/gen/$module/$className.cs"
|
||||
|
||||
$fileName = $className
|
||||
$namespace = ''
|
||||
|
||||
$lastIndexOfDot = $className.LastIndexOf(".")
|
||||
if ($lastIndexOfDot -ne -1)
|
||||
{
|
||||
$namespace = $className.Substring(0, $lastIndexOfDot)
|
||||
$className = $className.Substring($lastIndexOfDot + 1)
|
||||
}
|
||||
|
||||
$genSource = Get-StronglyTypeCsFileForResx -xml $xml -ModuleName $module -ClassName $className -NamespaceName $namespace
|
||||
$outPath = "$PSScriptRoot/src/windows-build/gen/$module/$fileName.cs"
|
||||
log "ResGen for $outPath"
|
||||
mkdir -ErrorAction SilentlyContinue (Split-Path $outPath) > $null
|
||||
Set-Content -Encoding Ascii -Path $outPath -Value $genSource
|
||||
@@ -975,8 +987,9 @@ function script:Start-NativeExecution([scriptblock]$sb)
|
||||
|
||||
function script:Get-StronglyTypeCsFileForResx
|
||||
{
|
||||
param($xml, $ModuleName, $ClassName)
|
||||
$body = @'
|
||||
param($xml, $ModuleName, $ClassName, $NamespaceName = '')
|
||||
|
||||
$banner = @'
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a Start-ResGen funciton from build.psm1.
|
||||
@@ -987,6 +1000,16 @@ $body = @'
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
{0}
|
||||
'@
|
||||
|
||||
$namespace = @'
|
||||
namespace {0} {{
|
||||
{1}
|
||||
}}
|
||||
'@
|
||||
|
||||
$body = @'
|
||||
using System;
|
||||
using System.Reflection;
|
||||
|
||||
@@ -1056,7 +1079,16 @@ internal class {0} {{
|
||||
$entry -f $name,$val
|
||||
}
|
||||
} | Out-String
|
||||
$resultCode = $body -f $ClassName,$ModuleName,$entries
|
||||
|
||||
$bodyCode = $body -f $ClassName,$ModuleName,$entries
|
||||
|
||||
if ($NamespaceName -ne '')
|
||||
{
|
||||
$bodyCode = $namespace -f $NamespaceName, $bodyCode
|
||||
}
|
||||
|
||||
$resultCode = $banner -f $bodyCode
|
||||
|
||||
return $resultCode -replace "`r`n?|`n","`r`n"
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user