Add explicit client/server side field to manifest #2
+19
-2
@@ -163,8 +163,25 @@ if ($LauncherExePath) {
|
|||||||
}
|
}
|
||||||
$launcherFile = Get-Item $LauncherExePath
|
$launcherFile = Get-Item $LauncherExePath
|
||||||
$launcherVersion = $launcherFile.VersionInfo.FileVersion
|
$launcherVersion = $launcherFile.VersionInfo.FileVersion
|
||||||
|
$versionSource = 'PE FileVersion'
|
||||||
|
|
||||||
|
# Linux PowerShell can't read PE FileVersion from a Windows .exe. When that
|
||||||
|
# happens, fall back to launcher/ModpackLauncher.csproj's <Version> (the
|
||||||
|
# source of truth that the Windows compile bakes into FileVersion anyway).
|
||||||
|
# Append ".0" so callers get the same 4-part form as the PE metadata.
|
||||||
if ([string]::IsNullOrWhiteSpace($launcherVersion)) {
|
if ([string]::IsNullOrWhiteSpace($launcherVersion)) {
|
||||||
throw "Launcher exe has no FileVersion -- set <Version> in ModpackLauncher.csproj and republish."
|
$csprojPath = Join-Path $here '..\launcher\ModpackLauncher.csproj'
|
||||||
|
if (Test-Path $csprojPath) {
|
||||||
|
[xml]$csproj = Get-Content $csprojPath
|
||||||
|
$csprojVersion = ($csproj.Project.PropertyGroup.Version | Where-Object { $_ }) | Select-Object -First 1
|
||||||
|
if ($csprojVersion) {
|
||||||
|
$launcherVersion = if ($csprojVersion -match '^\d+\.\d+\.\d+$') { "$csprojVersion.0" } else { $csprojVersion }
|
||||||
|
$versionSource = "csproj <Version> (fallback)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ([string]::IsNullOrWhiteSpace($launcherVersion)) {
|
||||||
|
throw "Launcher exe has no FileVersion and csproj <Version> couldn't be read either -- set <Version> in ModpackLauncher.csproj and republish."
|
||||||
}
|
}
|
||||||
# FileVersion is the four-component form (e.g. "0.1.0.0" for csproj <Version>0.1.0</Version>).
|
# FileVersion is the four-component form (e.g. "0.1.0.0" for csproj <Version>0.1.0</Version>).
|
||||||
# Embed as-is -- the launcher's Version.Parse handles it directly and avoids ambiguous
|
# Embed as-is -- the launcher's Version.Parse handles it directly and avoids ambiguous
|
||||||
@@ -174,7 +191,7 @@ if ($LauncherExePath) {
|
|||||||
|
|
||||||
Write-Host ""
|
Write-Host ""
|
||||||
Write-Host ("Launcher metadata embedded:")
|
Write-Host ("Launcher metadata embedded:")
|
||||||
Write-Host (" Version: {0}" -f $launcherVersion)
|
Write-Host (" Version: {0} ({1})" -f $launcherVersion, $versionSource)
|
||||||
Write-Host (" Url: {0}" -f $LauncherPublicUrl)
|
Write-Host (" Url: {0}" -f $LauncherPublicUrl)
|
||||||
Write-Host (" Source: {0}" -f $launcherFile.FullName)
|
Write-Host (" Source: {0}" -f $launcherFile.FullName)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -214,11 +214,26 @@ $overridesLocal = Join-Path $repoRoot 'pack\overrides'
|
|||||||
$shareFiles = Join-Path $DeployShare 'files'
|
$shareFiles = Join-Path $DeployShare 'files'
|
||||||
if ($shouldRunPack -and (Test-Path $overridesLocal)) {
|
if ($shouldRunPack -and (Test-Path $overridesLocal)) {
|
||||||
Step "Mirror pack/overrides/ -> $shareFiles" {
|
Step "Mirror pack/overrides/ -> $shareFiles" {
|
||||||
# /MIR makes destination match source (deletes orphan files in $shareFiles).
|
# Prefer rsync where available (Linux/macOS); fall back to Windows robocopy.
|
||||||
# /XJ skips junctions, /R:1 /W:1 keeps retry behaviour sane on flaky shares.
|
# Both perform a mirror: orphan files in the destination are removed so
|
||||||
robocopy $overridesLocal $shareFiles /MIR /XJ /R:1 /W:1 /NFL /NDL /NJH /NJS /NP | Out-Host
|
# the share matches the local overrides exactly.
|
||||||
# Robocopy returns 0-7 for success-with-info; 8+ is real failure.
|
if (Get-Command rsync -ErrorAction SilentlyContinue) {
|
||||||
if ($LASTEXITCODE -ge 8) { throw "robocopy failed with exit $LASTEXITCODE" }
|
$src = ($overridesLocal -replace '\\','/').TrimEnd('/') + '/'
|
||||||
|
$dst = ($shareFiles -replace '\\','/').TrimEnd('/') + '/'
|
||||||
|
if (-not (Test-Path $shareFiles)) { New-Item -ItemType Directory -Path $shareFiles -Force | Out-Null }
|
||||||
|
& rsync -a --delete $src $dst
|
||||||
|
if ($LASTEXITCODE -ne 0) { throw "rsync failed with exit $LASTEXITCODE" }
|
||||||
|
}
|
||||||
|
elseif (Get-Command robocopy -ErrorAction SilentlyContinue) {
|
||||||
|
# /MIR makes destination match source (deletes orphan files in $shareFiles).
|
||||||
|
# /XJ skips junctions, /R:1 /W:1 keeps retry behaviour sane on flaky shares.
|
||||||
|
robocopy $overridesLocal $shareFiles /MIR /XJ /R:1 /W:1 /NFL /NDL /NJH /NJS /NP | Out-Host
|
||||||
|
# Robocopy returns 0-7 for success-with-info; 8+ is real failure.
|
||||||
|
if ($LASTEXITCODE -ge 8) { throw "robocopy failed with exit $LASTEXITCODE" }
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
throw "Neither rsync nor robocopy is available -- can't mirror pack overrides."
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user