From db0ecb590c7e2623a5c165d605aa8b8fabed983f Mon Sep 17 00:00:00 2001 From: omigamedev Date: Fri, 5 Jun 2026 00:03:17 +0200 Subject: [PATCH] Guard platform build target matrix --- docs/modernization/build-inventory.md | 5 ++ docs/modernization/debt.md | 7 +- docs/modernization/roadmap.md | 4 +- scripts/dev/check_platform_build_targets.py | 92 +++++++++++++++++++++ tests/CMakeLists.txt | 5 ++ 5 files changed, 109 insertions(+), 4 deletions(-) create mode 100644 scripts/dev/check_platform_build_targets.py diff --git a/docs/modernization/build-inventory.md b/docs/modernization/build-inventory.md index 3d268a1..f1fff29 100644 --- a/docs/modernization/build-inventory.md +++ b/docs/modernization/build-inventory.md @@ -81,6 +81,7 @@ python scripts/dev/clangd_nav.py symbols --file src/app_core/document_export.h - python scripts/dev/clangd_nav.py definition --file src/node_panel_brush.cpp --line 511 --column 39 python scripts/dev/clangd_nav.py references --file src/app_core/brush_ui.h --line 783 --column 45 --path-regex "src[\\/]app_core" python scripts/dev/clangd_nav.py self-test +python scripts/dev/check_platform_build_targets.py ``` Known local toolchain state: @@ -138,6 +139,10 @@ Known local toolchain state: and app status planning. The PowerShell wrapper accepts repeated, array, or comma-separated `-Presets`/`-Targets` values so scripted callers can narrow the same matrix without accidentally passing a single combined target. + `scripts/dev/check_platform_build_targets.py`, registered as + `panopainter_platform_build_target_matrix_self_test`, verifies the PowerShell + and shell wrapper defaults include every current CMake test executable plus + the required component and `pano_cli` targets. - Root CMake exposes named `fuzz` and `stress` CTest presets. `fuzz` currently runs deterministic parser/serializer edge tests for binary streams, image metadata, PPI, stroke scripts, and layout XML; `stress` currently runs the diff --git a/docs/modernization/debt.md b/docs/modernization/debt.md index d5a88a0..3207a3e 100644 --- a/docs/modernization/debt.md +++ b/docs/modernization/debt.md @@ -22,9 +22,10 @@ agent or engineer to remove them without reconstructing context from chat. `platform-build.sh` now include the current headless component/test matrix, including brush-package coverage and the app-core startup/file/document/ brush/canvas/history/grid/toolbar/tools/about/preferences/status automation - tests, so Android root CMake validation no longer silently skips newly - extracted feature slices. Package targets remain open under DEBT-0009 and - DEBT-0011. + tests, and `panopainter_platform_build_target_matrix_self_test` now verifies + the wrapper defaults against the current CMake test executables, so Android + root CMake validation no longer silently skips newly extracted feature + slices. Package targets remain open under DEBT-0009 and DEBT-0011. - 2026-06-04: DEBT-0036 was narrowed again. Canvas stroke commit, thumbnail, and object-draw history paths now query saved blend state through tested `pp_renderer_gl` capability-state dispatch; CanvasLayer equirect diff --git a/docs/modernization/roadmap.md b/docs/modernization/roadmap.md index 9d6c0cb..42715d3 100644 --- a/docs/modernization/roadmap.md +++ b/docs/modernization/roadmap.md @@ -1258,7 +1258,9 @@ automation now builds the current headless component matrix, including the current app-core startup/file/document/brush/canvas/history/grid/toolbar/ tools/about/preferences/status automation tests. The PowerShell wrapper also normalizes comma-separated `-Presets` and `-Targets` values for reliable -machine-driven partial matrix checks. +machine-driven partial matrix checks. `panopainter_platform_build_target_matrix_self_test` +keeps the PowerShell and shell wrapper defaults aligned with every current +CMake test executable plus required component targets. `package-smoke` now emits a structured package readiness matrix for Windows AppX, Android standard/Quest/Focus APKs, Apple bundles, and WebGL output, with blocked prerequisites tied to DEBT-0011. App/package entrypoints still need to diff --git a/scripts/dev/check_platform_build_targets.py b/scripts/dev/check_platform_build_targets.py new file mode 100644 index 0000000..c534fa2 --- /dev/null +++ b/scripts/dev/check_platform_build_targets.py @@ -0,0 +1,92 @@ +#!/usr/bin/env python3 +"""Verify platform-build wrappers include the current headless target matrix.""" + +from __future__ import annotations + +import json +import re +import sys +from pathlib import Path + + +REQUIRED_COMPONENT_TARGETS = [ + "pp_foundation", + "pp_assets", + "pp_paint", + "pp_document", + "pp_renderer_api", + "pp_renderer_gl", + "pp_paint_renderer", + "pp_ui_core", + "pp_platform_api", + "pp_app_core", + "pano_cli", +] + + +def repo_root() -> Path: + return Path(__file__).resolve().parents[2] + + +def cmake_test_targets(root: Path) -> list[str]: + cmake_lists = root / "tests" / "CMakeLists.txt" + text = cmake_lists.read_text(encoding="utf-8") + return sorted(set(re.findall(r"^\s*add_executable\(([^\s\)]+)", text, re.MULTILINE))) + + +def powershell_default_targets(root: Path) -> list[str]: + script = root / "scripts" / "automation" / "platform-build.ps1" + targets: list[str] = [] + in_targets = False + + for line in script.read_text(encoding="utf-8").splitlines(): + if "[string[]]$Targets" in line: + in_targets = True + if not in_targets: + continue + + targets.extend(re.findall(r'"([^"]+)"', line)) + if in_targets and line.strip() == ")": + break + + return sorted(set(targets)) + + +def shell_default_targets(root: Path) -> list[str]: + script = root / "scripts" / "automation" / "platform-build.sh" + text = script.read_text(encoding="utf-8") + match = re.search(r'targets="\$\{[^:]+:-(.*)\}"', text) + if not match: + raise RuntimeError("Could not find default targets in platform-build.sh") + return sorted(set(match.group(1).split())) + + +def missing(expected: list[str], actual: list[str]) -> list[str]: + actual_set = set(actual) + return [target for target in expected if target not in actual_set] + + +def main() -> int: + root = repo_root() + expected = sorted(set(REQUIRED_COMPONENT_TARGETS + cmake_test_targets(root))) + ps_targets = powershell_default_targets(root) + sh_targets = shell_default_targets(root) + + result = { + "ok": True, + "expectedTargetCount": len(expected), + "powershellTargetCount": len(ps_targets), + "shellTargetCount": len(sh_targets), + "missing": { + "platform-build.ps1": missing(expected, ps_targets), + "platform-build.sh": missing(expected, sh_targets), + }, + } + result["ok"] = all(not values for values in result["missing"].values()) + + print(json.dumps(result, separators=(",", ":"))) + return 0 if result["ok"] else 1 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index ffc2142..0fc43ec 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -5,6 +5,11 @@ add_test(NAME panopainter_clangd_nav_regex_self_test set_tests_properties(panopainter_clangd_nav_regex_self_test PROPERTIES LABELS "tooling;desktop-fast") +add_test(NAME panopainter_platform_build_target_matrix_self_test + COMMAND "${Python3_EXECUTABLE}" "${PROJECT_SOURCE_DIR}/scripts/dev/check_platform_build_targets.py") +set_tests_properties(panopainter_platform_build_target_matrix_self_test PROPERTIES + LABELS "tooling;desktop-fast") + add_library(pp_test_harness INTERFACE) target_include_directories(pp_test_harness INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}")