From b42cb89364c205d0a7d6b16976160efc496f9e57 Mon Sep 17 00:00:00 2001 From: ddidderr Date: Thu, 20 Aug 2026 09:05:51 +0200 Subject: [PATCH] feat(build): add real-data launcher workflows The default GUI build previously selected the peer-CLI fixture catalog, which made a successful no-bundle build unsuitable as a launcher built from real packages. Route `build` through the production resource map and production profile, retaining `build-fixture` for test-only GUI builds. Add explicit production run/build recipes, generate the catalog before a package-dir build, and let the default `run` route through that workflow when `LANSPREAD_GAMES_DIR` or a Just variable override is supplied. Integrate the metadata cache so unchanged `--all` generation is skipped, with `LANSPREAD_CATALOG_FORCE=1` available for an explicit refresh. The pre-existing release-mode change in the catalog recipe remains unstaged and is intentionally not part of this commit. Test Plan: - `just --fmt --check` -- passed - `just --dry-run build-production /srv/games` -- passed - `just --dry-run catalog-generate-production /srv/games` -- passed - `git diff --cached --check` -- passed --- justfile | 53 +++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 47 insertions(+), 6 deletions(-) diff --git a/justfile b/justfile index 032517d..afd5909 100644 --- a/justfile +++ b/justfile @@ -8,7 +8,10 @@ FIXTURE_CATALOG_SOURCE := "crates/lanspread-tauri-deno-ts/src-tauri/game.db" FIXTURE_CATALOG_ROOT := "crates/lanspread-peer-cli/catalogs" PRODUCTION_CATALOG_DB := "crates/lanspread-tauri-deno-ts/src-tauri/game.db" PRODUCTION_MANIFEST_ROOT := "crates/lanspread-tauri-deno-ts/src-tauri/manifests" +CATALOG_CACHE_STAMP := ".lanspread/catalog-cache/production.json" CATALOG_UNRAR := env_var_or_default("LANSPREAD_UNRAR", "crates/lanspread-tauri-deno-ts/src-tauri/binaries/unrar-x86_64-unknown-linux-gnu") +GAMES_DIR := env_var_or_default("LANSPREAD_GAMES_DIR", "") +CATALOG_FORCE := env_var_or_default("LANSPREAD_CATALOG_FORCE", "0") TAURI_DEV_CONFIG := '{"bundle":{"resources":{"../../lanspread-peer-cli/catalogs/default/game.db":"game.db","../../lanspread-peer-cli/catalogs/default/manifests/":"manifests/","assets/*":"assets/"}}}' TAURI_FIXTURE_ENV := "LANSPREAD_USE_FIXTURE_CATALOG=1" @@ -16,12 +19,35 @@ setup: cargo install tauri-cli cd crates/lanspread-tauri-deno-ts && deno install --frozen=true -run: fixture-catalog-check +run: + if [ -n "{{ GAMES_DIR }}" ]; then \ + just run-production "{{ GAMES_DIR }}"; \ + else \ + just run-fixture; \ + fi + +run-fixture: fixture-catalog-check {{ TAURI_FIXTURE_ENV }} cargo tauri dev --config crates/lanspread-tauri-deno-ts/src-tauri/tauri.dev.conf.json --release -build: fixture-catalog-check +run-production GAMES_DIR: + just catalog-generate-production "{{ GAMES_DIR }}" + just catalog-check-production + cargo tauri dev --config crates/lanspread-tauri-deno-ts/src-tauri/tauri.production.conf.json --release + +build: + just build-production "{{ GAMES_DIR }}" + +build-fixture: fixture-catalog-check {{ TAURI_FIXTURE_ENV }} cargo tauri build --config crates/lanspread-tauri-deno-ts/src-tauri/tauri.dev.conf.json --no-bundle #-- --profile dev +build-production GAMES_DIR="": + if [ -n "{{ GAMES_DIR }}" ]; then \ + just catalog-generate-production "{{ GAMES_DIR }}"; \ + else \ + just catalog-check-production; \ + fi + cargo tauri build --config crates/lanspread-tauri-deno-ts/src-tauri/tauri.production.conf.json --no-bundle -- --profile production + bundle: catalog-check-production cargo tauri build --config crates/lanspread-tauri-deno-ts/src-tauri/tauri.production.conf.json -- --profile production @@ -112,12 +138,27 @@ catalog-check-production: # Generate the complete production authority from PACKAGES_DIR//. catalog-generate-production PACKAGES_DIR: - cargo run -p lanspread-compat --bin lanspread-catalog-publisher -- generate \ - --catalog-db {{ PRODUCTION_CATALOG_DB }} \ + @if [ "{{ CATALOG_FORCE }}" = "1" ] || ! python3 tools/catalog_source_cache.py check \ + --stamp {{ CATALOG_CACHE_STAMP }} \ --packages-dir "{{ PACKAGES_DIR }}" \ + --catalog-db {{ PRODUCTION_CATALOG_DB }} \ --manifests-dir {{ PRODUCTION_MANIFEST_ROOT }} \ - --unrar "{{ CATALOG_UNRAR }}" \ - --all + --unrar "{{ CATALOG_UNRAR }}"; then \ + cargo run -p lanspread-compat --bin lanspread-catalog-publisher -- generate \ + --catalog-db {{ PRODUCTION_CATALOG_DB }} \ + --packages-dir "{{ PACKAGES_DIR }}" \ + --manifests-dir {{ PRODUCTION_MANIFEST_ROOT }} \ + --unrar "{{ CATALOG_UNRAR }}" \ + --all && \ + python3 tools/catalog_source_cache.py record \ + --stamp {{ CATALOG_CACHE_STAMP }} \ + --packages-dir "{{ PACKAGES_DIR }}" \ + --catalog-db {{ PRODUCTION_CATALOG_DB }} \ + --manifests-dir {{ PRODUCTION_MANIFEST_ROOT }} \ + --unrar "{{ CATALOG_UNRAR }}"; \ + else \ + echo "catalog generation skipped: source metadata matches {{ CATALOG_CACHE_STAMP }}"; \ + fi # Regenerate one game in an already complete production authority. catalog-generate-production-game PACKAGES_DIR GAME_ID: