From 2eaab888095670c5ff9b761f160f6e07f9623480 Mon Sep 17 00:00:00 2001 From: SashegDev Date: Sat, 17 Oct 2026 01:49:47 +0300 Subject: [PATCH] =?UTF-8?q?=EF=BB=BF=D0=A1=D0=BE=D0=B1=D0=B8=D1=80=D0=B0?= =?UTF-8?q?=D1=82=D1=8C=20=D1=80=D0=B5=D0=BB=D0=B8=D0=B7=D0=BD=D1=8B=D0=B9?= =?UTF-8?q?=20=D0=B0=D1=80=D1=85=D0=B8=D0=B2=20=D0=B8=20=D0=B1=D1=80=D0=B0?= =?UTF-8?q?=D1=82=D1=8C=20=D0=BF=D1=80=D0=BE=D1=84=D0=B8=D0=BB=D1=8C=20?= =?UTF-8?q?=D0=B8=D0=B7=20=D0=BF=D0=B0=D0=BA=D0=B5=D1=82=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit package-release.ps1 кладёт в zip то, что нужно другу: install/uninstall/ start-launcher, dist с артефактами, profiles, README. Сборка запускается внутри, чтобы архив всегда соответствовал исходникам. Установщик теперь сначала смотрит профиль в profiles\latest.rsxp пакета, и только потом в старый путь с моей машины - раньше друг получил бы "профиля нет". --- scripts/install.ps1 | 13 ++++-- scripts/package-release.ps1 | 80 +++++++++++++++++++++++++++++++++++++ 2 files changed, 89 insertions(+), 4 deletions(-) create mode 100644 scripts/package-release.ps1 diff --git a/scripts/install.ps1 b/scripts/install.ps1 index d6c3e67..2c21496 100644 --- a/scripts/install.ps1 +++ b/scripts/install.ps1 @@ -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 diff --git a/scripts/package-release.ps1 b/scripts/package-release.ps1 new file mode 100644 index 0000000..07d6ab7 --- /dev/null +++ b/scripts/package-release.ps1 @@ -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)" }