generated from MrSphay/codex-agent-repository-kit
Add MrTrust GUI and Gitea release build
Some checks failed
Build MrTrust / build-windows (push) Has been cancelled
Some checks failed
Build MrTrust / build-windows (push) Has been cancelled
This commit is contained in:
50
scripts/Build-MrTrustExe.ps1
Normal file
50
scripts/Build-MrTrustExe.ps1
Normal file
@@ -0,0 +1,50 @@
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[string]$OutputPath = ".\dist\MrTrust.exe"
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
function Resolve-FullPath {
|
||||
param([Parameter(Mandatory)][string]$Path)
|
||||
|
||||
$executionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($Path)
|
||||
}
|
||||
|
||||
$root = Split-Path -Parent (Split-Path -Parent $MyInvocation.MyCommand.Path)
|
||||
$sourcePath = Join-Path $root "src\MrTrustLauncher.cs"
|
||||
$resolvedOutputPath = Resolve-FullPath $OutputPath
|
||||
$outputDirectory = Split-Path -Parent $resolvedOutputPath
|
||||
|
||||
if (-not (Test-Path -LiteralPath $sourcePath)) {
|
||||
throw "Launcher source not found: $sourcePath"
|
||||
}
|
||||
|
||||
New-Item -ItemType Directory -Force -Path $outputDirectory | Out-Null
|
||||
|
||||
$compilerCandidates = @(
|
||||
"$env:WINDIR\Microsoft.NET\Framework64\v4.0.30319\csc.exe",
|
||||
"$env:WINDIR\Microsoft.NET\Framework\v4.0.30319\csc.exe"
|
||||
)
|
||||
|
||||
$compiler = $compilerCandidates | Where-Object { Test-Path -LiteralPath $_ } | Select-Object -First 1
|
||||
if (-not $compiler) {
|
||||
throw "csc.exe was not found. Run this build on a Windows Gitea runner with .NET Framework installed."
|
||||
}
|
||||
|
||||
& $compiler `
|
||||
/nologo `
|
||||
/target:winexe `
|
||||
/optimize+ `
|
||||
/platform:anycpu `
|
||||
/out:$resolvedOutputPath `
|
||||
/reference:System.Windows.Forms.dll `
|
||||
/reference:System.Drawing.dll `
|
||||
$sourcePath
|
||||
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "csc.exe failed with exit code $LASTEXITCODE."
|
||||
}
|
||||
|
||||
Write-Host "Created EXE:"
|
||||
Write-Host " $resolvedOutputPath"
|
||||
Reference in New Issue
Block a user