Собирать релизный архив и брать профиль из пакета

package-release.ps1 кладёт в zip то, что нужно другу: install/uninstall/
start-launcher, dist с артефактами, profiles, README. Сборка запускается
внутри, чтобы архив всегда соответствовал исходникам.

Установщик теперь сначала смотрит профиль в profiles\latest.rsxp пакета, и
только потом в старый путь с моей машины - раньше друг получил бы
"профиля нет".
This commit is contained in:
SashegDev
2026-10-17 01:49:47 +03:00
parent 9f43d35f44
commit 2eaab88809
2 changed files with 89 additions and 4 deletions
+9 -4
View File
@@ -141,14 +141,19 @@ Copy-Item (Join-Path $Dist 'rsx-bridge.jar') (Join-Path $ModHome 'bridge') -Forc
Say 'скопирован rsx-bridge.jar'
$existingProfile = Join-Path $ModHome 'bridge\profiles\latest.rsxp'
$repoProfile = Join-Path $Repo 'profiles\latest.rsxp'
$oldProfile = 'G:\rsx-mod\bridge\profiles\latest.rsxp'
if (-not (Test-Path $existingProfile) -and (Test-Path $oldProfile)) {
if (Test-Path $existingProfile) {
Say 'профиль уже на месте, оставляю как есть'
} elseif (Test-Path $repoProfile) {
# the profile that ships with this package: the mapping for the vendor build
Copy-Item $repoProfile (Split-Path $existingProfile) -Force
Say 'установлен профиль сборки игры из пакета (latest.rsxp)'
} elseif (Test-Path $oldProfile) {
Copy-Item $oldProfile (Split-Path $existingProfile) -Force
Say 'перенесён профиль сборки игры (latest.rsxp)'
} elseif (Test-Path $existingProfile) {
Say 'профиль уже на месте, оставляю как есть'
} else {
Say 'профиля нет - запусти prepare-build.cmd после первой установки', Yellow
Say 'профиля нет - моды грузиться не будут, нужен latest.rspx для этой сборки', Yellow
}
# --------------------------------------------------------------- patch the launcher
+80
View File
@@ -0,0 +1,80 @@
# build a release zip: everything a friend needs to install the modloader
#
# powershell -ExecutionPolicy Bypass -File scripts\package-release.ps1
# powershell -ExecutionPolicy Bypass -File scripts\package-release.ps1 -Version 0.1.1
#
# The zip is a subset of the repo: no sources of the reverse engineering
# tooling, no build scratch, just the installer and the artifacts it installs.
param(
[string]$Version = '0.1.0'
)
$ErrorActionPreference = 'Stop'
$Repo = Split-Path -Parent $PSScriptRoot
function Say($message, $color) {
if ($color) {
Write-Host $message -ForegroundColor $color
} else {
Write-Host $message
}
}
$name = "rsx-modloader-$Version"
$stage = Join-Path $Repo "build\$name"
$zip = Join-Path $Repo "dist\$name.zip"
Say 'Собираю артефакты...'
& (Join-Path $PSScriptRoot 'build.ps1')
if ($LASTEXITCODE -ne 0) {
Say ' сборка не удалась.' Red
exit 1
}
Say ''
Say 'Собираю пакет...'
Remove-Item $stage -Recurse -Force -ErrorAction SilentlyContinue
Remove-Item $zip -Force -ErrorAction SilentlyContinue
New-Item -ItemType Directory -Force -Path $stage | Out-Null
# the entrypoints a friend actually clicks
foreach ($file in 'install.cmd', 'uninstall.cmd', 'start-launcher.cmd', 'build.cmd') {
$src = Join-Path $Repo $file
if (Test-Path $src) {
Copy-Item $src (Join-Path $stage $file) -Force
}
}
foreach ($dir in 'dist', 'profiles') {
$src = Join-Path $Repo $dir
if (Test-Path $src) {
Copy-Item $src (Join-Path $stage $dir) -Recurse -Force
}
}
foreach ($file in 'README.md', 'LICENSE', 'AUTHORS.md') {
$src = Join-Path $Repo $file
if (Test-Path $src) {
Copy-Item $src (Join-Path $stage $file) -Force
}
}
# the .cmd entrypoints call scripts\*.ps1, so keep that layout inside the zip
New-Item -ItemType Directory -Force -Path (Join-Path $stage 'scripts') | Out-Null
Copy-Item (Join-Path $PSScriptRoot 'install.ps1') (Join-Path $stage 'scripts\install.ps1') -Force
Copy-Item (Join-Path $PSScriptRoot 'start-launcher.ps1') (Join-Path $stage 'scripts\start-launcher.ps1') -Force
# build scratch must never end up in a release
Get-ChildItem $stage -Recurse -Include '*.new', '*.orig', '*.class' -File |
ForEach-Object { Remove-Item $_.FullName -Force -ErrorAction SilentlyContinue }
Say ''
Say 'Жму zip...'
Add-Type -AssemblyName System.IO.Compression.FileSystem
[System.IO.Compression.ZipFile]::CreateFromDirectory(
$stage, $zip, [System.IO.Compression.CompressionLevel]::Optimal, $false)
$size = [math]::Round((Get-Item $zip).Length / 1MB, 2)
Say ''
Say "Готово: dist\$name.zip ($size МБ)" Green
Say ''
Say 'В архиве:'
Get-ChildItem $stage | ForEach-Object { Say " $($_.Name)" }