generated from MrSphay/codex-agent-repository-kit
Make MrTrust executable standalone
All checks were successful
Build MrTrust / build (push) Successful in 3m3s
All checks were successful
Build MrTrust / build (push) Successful in 3m3s
This commit is contained in:
@@ -16,6 +16,21 @@ $sourcePath = Join-Path $root "src\MrTrustLauncher.cs"
|
||||
$iconPath = Join-Path $root "assets\MrTrust.ico"
|
||||
$resolvedOutputPath = Resolve-FullPath $OutputPath
|
||||
$outputDirectory = Split-Path -Parent $resolvedOutputPath
|
||||
$payloadFiles = @(
|
||||
@{ Path = "MrTrust.ps1"; ResourceName = "MrTrust.Payload.MrTrust.ps1" },
|
||||
@{ Path = "scripts\Build-MrTrustExe.ps1"; ResourceName = "MrTrust.Payload.scripts.Build-MrTrustExe.ps1" },
|
||||
@{ Path = "scripts\Install-MrTrust.ps1"; ResourceName = "MrTrust.Payload.scripts.Install-MrTrust.ps1" },
|
||||
@{ Path = "scripts\New-MrTrustCertificate.ps1"; ResourceName = "MrTrust.Payload.scripts.New-MrTrustCertificate.ps1" },
|
||||
@{ Path = "scripts\New-MrTrustIcon.ps1"; ResourceName = "MrTrust.Payload.scripts.New-MrTrustIcon.ps1" },
|
||||
@{ Path = "scripts\New-MrTrustRelease.ps1"; ResourceName = "MrTrust.Payload.scripts.New-MrTrustRelease.ps1" },
|
||||
@{ Path = "scripts\Sign-MrTrustProject.ps1"; ResourceName = "MrTrust.Payload.scripts.Sign-MrTrustProject.ps1" },
|
||||
@{ Path = "scripts\Start-MrTrustGui.ps1"; ResourceName = "MrTrust.Payload.scripts.Start-MrTrustGui.ps1" },
|
||||
@{ Path = "scripts\Uninstall-MrTrust.ps1"; ResourceName = "MrTrust.Payload.scripts.Uninstall-MrTrust.ps1" },
|
||||
@{ Path = "assets\MrTrust.ico"; ResourceName = "MrTrust.Payload.assets.MrTrust.ico" },
|
||||
@{ Path = "assets\certificates\MrSphay-LocalTrust-Root.cer"; ResourceName = "MrTrust.Payload.assets.certificates.MrSphay-LocalTrust-Root.cer" },
|
||||
@{ Path = "assets\certificates\MrSphay-CodeSigning.cer"; ResourceName = "MrTrust.Payload.assets.certificates.MrSphay-CodeSigning.cer" },
|
||||
@{ Path = "assets\certificates\thumbprints.txt"; ResourceName = "MrTrust.Payload.assets.certificates.thumbprints.txt" }
|
||||
)
|
||||
|
||||
if (-not (Test-Path -LiteralPath $sourcePath)) {
|
||||
throw "Launcher source not found: $sourcePath"
|
||||
@@ -25,6 +40,13 @@ if (-not (Test-Path -LiteralPath $iconPath)) {
|
||||
& (Join-Path $root "scripts\New-MrTrustIcon.ps1") -OutputPath $iconPath
|
||||
}
|
||||
|
||||
foreach ($payloadFile in $payloadFiles) {
|
||||
$payloadPath = Join-Path $root $payloadFile.Path
|
||||
if (-not (Test-Path -LiteralPath $payloadPath)) {
|
||||
throw "Payload file not found: $payloadPath"
|
||||
}
|
||||
}
|
||||
|
||||
New-Item -ItemType Directory -Force -Path $outputDirectory | Out-Null
|
||||
|
||||
$compilerCandidates = @(
|
||||
@@ -37,20 +59,29 @@ 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 `
|
||||
/win32icon:$iconPath `
|
||||
/reference:System.Windows.Forms.dll `
|
||||
/reference:System.Drawing.dll `
|
||||
$sourcePath
|
||||
$compilerArguments = @(
|
||||
"/nologo",
|
||||
"/target:winexe",
|
||||
"/optimize+",
|
||||
"/platform:anycpu",
|
||||
"/out:$resolvedOutputPath",
|
||||
"/win32icon:$iconPath",
|
||||
"/reference:System.Windows.Forms.dll",
|
||||
"/reference:System.Drawing.dll"
|
||||
)
|
||||
|
||||
foreach ($payloadFile in $payloadFiles) {
|
||||
$payloadPath = Join-Path $root $payloadFile.Path
|
||||
$compilerArguments += "/resource:$payloadPath,$($payloadFile.ResourceName)"
|
||||
}
|
||||
|
||||
$compilerArguments += $sourcePath
|
||||
|
||||
& $compiler @compilerArguments
|
||||
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "csc.exe failed with exit code $LASTEXITCODE."
|
||||
}
|
||||
|
||||
Write-Host "Created EXE:"
|
||||
Write-Host "Created standalone EXE:"
|
||||
Write-Host " $resolvedOutputPath"
|
||||
|
||||
@@ -27,9 +27,6 @@ if (Test-Path -LiteralPath $packageRoot) {
|
||||
}
|
||||
|
||||
New-Item -ItemType Directory -Force -Path $packageRoot | Out-Null
|
||||
New-Item -ItemType Directory -Force -Path (Join-Path $packageRoot "scripts") | Out-Null
|
||||
New-Item -ItemType Directory -Force -Path (Join-Path $packageRoot "assets\certificates") | Out-Null
|
||||
New-Item -ItemType Directory -Force -Path (Join-Path $packageRoot "docs") | Out-Null
|
||||
|
||||
if (-not (Test-Path -LiteralPath $iconPath)) {
|
||||
& (Join-Path $root "scripts\New-MrTrustIcon.ps1") -OutputPath $iconPath
|
||||
@@ -55,16 +52,7 @@ if ($SigningThumbprint) {
|
||||
}
|
||||
|
||||
Copy-Item -LiteralPath $exePath -Destination $packageRoot
|
||||
Copy-Item -LiteralPath (Join-Path $root "MrTrust.ps1") -Destination $packageRoot
|
||||
Copy-Item -LiteralPath (Join-Path $root "README.md") -Destination $packageRoot
|
||||
Copy-Item -LiteralPath $iconPath -Destination (Join-Path $packageRoot "assets")
|
||||
Copy-Item -LiteralPath (Join-Path $root "scripts\Install-MrTrust.ps1") -Destination (Join-Path $packageRoot "scripts")
|
||||
Copy-Item -LiteralPath (Join-Path $root "scripts\Uninstall-MrTrust.ps1") -Destination (Join-Path $packageRoot "scripts")
|
||||
Copy-Item -LiteralPath (Join-Path $root "scripts\Start-MrTrustGui.ps1") -Destination (Join-Path $packageRoot "scripts")
|
||||
Copy-Item -LiteralPath (Join-Path $root "assets\certificates\MrSphay-LocalTrust-Root.cer") -Destination (Join-Path $packageRoot "assets\certificates")
|
||||
Copy-Item -LiteralPath (Join-Path $root "assets\certificates\MrSphay-CodeSigning.cer") -Destination (Join-Path $packageRoot "assets\certificates")
|
||||
Copy-Item -LiteralPath (Join-Path $root "assets\certificates\thumbprints.txt") -Destination (Join-Path $packageRoot "assets\certificates")
|
||||
Copy-Item -LiteralPath (Join-Path $root "docs\security-model.md") -Destination (Join-Path $packageRoot "docs")
|
||||
|
||||
if (Test-Path -LiteralPath $zipPath) {
|
||||
Remove-Item -LiteralPath $zipPath -Force
|
||||
|
||||
Reference in New Issue
Block a user