Skip to content

Commit 45cd14f

Browse files
committed
Fix standalone release archive consistency
1 parent 84976f9 commit 45cd14f

4 files changed

Lines changed: 31 additions & 12 deletions

File tree

.github/workflows/springboard-release.yml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -213,17 +213,11 @@ jobs:
213213
base="artifacts/SpringBoard-Core-${VERSION}-${{ matrix.target }}.sdz"
214214
application="artifacts/SpringBoard-${VERSION}-${{ matrix.target }}"
215215
mkdir -p artifacts
216-
uv run --project build --locked sbc-packager-base \
217-
--repo-root . \
218-
--native-plugin "native/target/release/${{ matrix.native_plugin }}" \
219-
--output "$base" \
220-
--platform "${{ matrix.platform }}" \
221-
--version "$VERSION" \
222-
--run-config config/ui-rust.json
223216
uv run --project build --locked sbc-packager-application \
224217
--repo-root . \
225218
--distribution build/distribution.json \
226219
--output-dir "$application" \
220+
--editor-archive-output "$base" \
227221
--native-plugin "native/target/release/${{ matrix.native_plugin }}" \
228222
--engine-archive "$engine_archive" \
229223
--platform "${{ matrix.platform }}" \

build/README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
# SpringBoard packaging
22

3-
The packager produces:
3+
The release packager produces:
44

55
- A platform-specific `.sdz` containing SpringBoard Core and its native plugin.
66
- A complete application containing the engine, editor, settings, and start
77
script.
88

9-
The complete application is built directly from an engine release `.7z`.
10-
Packaging removes the AIs and unused engine executables, then renames `spring`
11-
to `SpringBoard` or `SpringBoard.exe`.
9+
The complete application is built from an engine release `.7z`. Packaging
10+
removes the AIs, unused engine executables, and their Windows import libraries,
11+
then renames `spring` to `SpringBoard` or `SpringBoard.exe`. The application
12+
build exports the exact `.sdz` embedded in the application as the standalone
13+
editor artifact.
1214

1315
```bash
1416
uv run --project build --locked sbc-packager-base --help

build/sbc_packager/application/cli.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from __future__ import annotations
22

3+
import shutil
34
from pathlib import Path
45
from typing import Annotated
56

@@ -25,6 +26,7 @@ def application_command(
2526
version: Annotated[str, typer.Option(..., "--version")],
2627
engine_archive: Annotated[Path, typer.Option(..., "--engine-archive", exists=True, dir_okay=False)],
2728
run_config: Annotated[Path, typer.Option("--run-config")] = Path("config/ui-rust.json"),
29+
editor_archive_output: Annotated[Path | None, typer.Option("--editor-archive-output")] = None,
2830
archive: Annotated[bool, typer.Option("--archive/--no-archive")] = True,
2931
) -> None:
3032
build_application(
@@ -36,6 +38,7 @@ def application_command(
3638
platform=platform,
3739
version=version,
3840
run_config=run_config,
41+
editor_archive_output=editor_archive_output,
3942
archive=archive,
4043
)
4144

@@ -50,6 +53,7 @@ def build_application(
5053
platform: str,
5154
version: str,
5255
run_config: Path,
56+
editor_archive_output: Path | None,
5357
archive: bool,
5458
) -> Path:
5559
normalized_platform = normalize_platform(platform)
@@ -63,7 +67,7 @@ def build_application(
6367

6468
resolved_repo_root = repo_root.resolve()
6569
game_name = resolve_game_name(resolved_repo_root, version)
66-
prepare_game_archive(
70+
game_archive = prepare_game_archive(
6771
repo_root=resolved_repo_root,
6872
files_dir=resolved_output,
6973
game_name=game_name,
@@ -74,6 +78,8 @@ def build_application(
7478
run_config=run_config,
7579
loading_image=find_engine_loading_image(resolved_output),
7680
)
81+
if editor_archive_output is not None:
82+
export_editor_archive(game_archive, editor_archive_output)
7783

7884
config = read_application_config(distribution.resolve())
7985
(resolved_output / "script.txt").write_text(render_start_script(game_name, config.launch), encoding="utf-8")
@@ -88,5 +94,18 @@ def build_application(
8894
return resolved_output
8995

9096

97+
def export_editor_archive(game_archive: Path, output: Path) -> Path:
98+
resolved_output = output.resolve()
99+
if resolved_output.suffix.lower() != ".sdz":
100+
raise RuntimeError(f"Editor archive output must end in .sdz: {resolved_output}")
101+
if resolved_output.exists():
102+
raise RuntimeError(f"Refusing to overwrite editor archive: {resolved_output}")
103+
resolved_output.parent.mkdir(parents=True, exist_ok=True)
104+
shutil.copy2(game_archive, resolved_output)
105+
write_sha256(resolved_output)
106+
print(f"Created editor archive: {resolved_output}")
107+
return resolved_output
108+
109+
91110
def main() -> None:
92111
app()

build/sbc_packager/application/engine.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
PRUNED_ENGINE_DIRECTORIES = ("AI",)
88
PRUNED_ENGINE_EXECUTABLES = ("pr-downloader", "spring-dedicated", "spring-headless")
9+
PRUNED_WINDOWS_IMPORT_LIBRARIES = ("libspring-dedicated.dll.a", "libspring-headless.dll.a")
910

1011

1112
def install_engine(*, destination: Path, engine_archive: Path) -> None:
@@ -20,6 +21,9 @@ def prune_engine(application_dir: Path, platform: str) -> None:
2021
executable_suffix = "" if platform == "linux" else ".exe"
2122
for executable in PRUNED_ENGINE_EXECUTABLES:
2223
(application_dir / f"{executable}{executable_suffix}").unlink(missing_ok=True)
24+
if platform == "win32":
25+
for import_library in PRUNED_WINDOWS_IMPORT_LIBRARIES:
26+
(application_dir / import_library).unlink(missing_ok=True)
2327
for directory in PRUNED_ENGINE_DIRECTORIES:
2428
path = application_dir / directory
2529
if path.is_symlink() or path.is_file():

0 commit comments

Comments
 (0)