53 lines
1.7 KiB
PowerShell
53 lines
1.7 KiB
PowerShell
param(
|
|
[ValidateSet("Release", "Debug")]
|
|
[string]$Configuration = "Release",
|
|
[string]$Runtime = "win-x64"
|
|
)
|
|
|
|
$ErrorActionPreference = "Stop"
|
|
|
|
$repoRoot = Resolve-Path (Join-Path $PSScriptRoot "..")
|
|
$sidecarProject = Join-Path $repoRoot "Journal.Sidecar\Journal.Sidecar.csproj"
|
|
$publishOutputDir = Join-Path $repoRoot "output"
|
|
$publishedSidecarExe = Join-Path $publishOutputDir "Journal.Sidecar.exe"
|
|
$tauriBinDir = Join-Path $repoRoot "Journal.App\src-tauri\bin"
|
|
$tauriBundledSidecarExe = Join-Path $tauriBinDir "Journal.Sidecar.exe"
|
|
|
|
if (-not (Get-Command dotnet -ErrorAction SilentlyContinue)) {
|
|
throw "dotnet was not found in PATH. Install .NET SDK and retry."
|
|
}
|
|
|
|
if (-not (Test-Path $sidecarProject)) {
|
|
throw "Sidecar project not found: $sidecarProject"
|
|
}
|
|
|
|
New-Item -ItemType Directory -Force -Path $publishOutputDir | Out-Null
|
|
|
|
$publishArgs = @(
|
|
"publish", $sidecarProject,
|
|
"-c", $Configuration,
|
|
"-r", $Runtime,
|
|
"--self-contained",
|
|
"-p:PublishSingleFile=true",
|
|
"-p:IncludeNativeLibrariesForSelfExtract=true",
|
|
"-p:RestoreIgnoreFailedSources=true",
|
|
"-p:NuGetAudit=false",
|
|
"-o", $publishOutputDir
|
|
)
|
|
|
|
Write-Host "Publishing Journal.Sidecar for Tauri bundle..." -ForegroundColor Cyan
|
|
Write-Host "> dotnet $($publishArgs -join ' ')" -ForegroundColor DarkGray
|
|
& dotnet @publishArgs
|
|
|
|
if ($LASTEXITCODE -ne 0) {
|
|
throw "dotnet publish failed with exit code $LASTEXITCODE."
|
|
}
|
|
|
|
if (-not (Test-Path $publishedSidecarExe)) {
|
|
throw "Sidecar publish output not found: $publishedSidecarExe"
|
|
}
|
|
|
|
New-Item -ItemType Directory -Force -Path $tauriBinDir | Out-Null
|
|
Copy-Item -Force $publishedSidecarExe $tauriBundledSidecarExe
|
|
Write-Host "Staged sidecar for Tauri: $tauriBundledSidecarExe" -ForegroundColor Green
|