feat: add msglib readonly sidecar
This commit is contained in:
53
scripts/build-msglib-sidecar.ps1
Normal file
53
scripts/build-msglib-sidecar.ps1
Normal file
@@ -0,0 +1,53 @@
|
||||
param(
|
||||
[string]$OutputDir = "runs/msglib-sidecar",
|
||||
[string]$Configuration = "Release"
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
$repo = Resolve-Path -LiteralPath (Join-Path $PSScriptRoot "..")
|
||||
$sourceDir = Join-Path $repo "native/MsgLibReadSidecar"
|
||||
$outDirPath = Join-Path $repo $OutputDir
|
||||
$outExe = Join-Path $outDirPath "MsgLibReadSidecar.exe"
|
||||
|
||||
if (-not (Test-Path -LiteralPath $sourceDir)) {
|
||||
throw "source directory not found: $sourceDir"
|
||||
}
|
||||
|
||||
$csc = "$env:WINDIR\Microsoft.NET\Framework\v4.0.30319\csc.exe"
|
||||
if (-not (Test-Path -LiteralPath $csc)) {
|
||||
throw "32-bit .NET Framework csc.exe v4.0.30319 not found"
|
||||
}
|
||||
|
||||
New-Item -ItemType Directory -Force -Path $outDirPath | Out-Null
|
||||
|
||||
$sources = Get-ChildItem -LiteralPath $sourceDir -Filter '*.cs' | Sort-Object Name | ForEach-Object { $_.FullName }
|
||||
if (-not $sources) {
|
||||
throw "no C# sources found in $sourceDir"
|
||||
}
|
||||
|
||||
& $csc `
|
||||
/nologo `
|
||||
/target:exe `
|
||||
/platform:x86 `
|
||||
/optimize+ `
|
||||
/warn:0 `
|
||||
/out:$outExe `
|
||||
/reference:System.dll `
|
||||
/reference:System.Core.dll `
|
||||
/reference:System.Data.dll `
|
||||
/reference:System.Web.Extensions.dll `
|
||||
$sources
|
||||
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "MsgLib sidecar compilation failed with exit code $LASTEXITCODE"
|
||||
}
|
||||
|
||||
[ordered]@{
|
||||
ok = $true
|
||||
configuration = $Configuration
|
||||
platform = "x86"
|
||||
csc = $csc
|
||||
source_dir = $sourceDir
|
||||
output = $outExe
|
||||
} | ConvertTo-Json -Depth 4 -Compress
|
||||
Reference in New Issue
Block a user