Skip to content

Make: a PLATFORM axis (webos, desktop, tizen), with no build change yet - #1482

Merged
GLinnik21 merged 2 commits into
mainfrom
platform/w1-platform-axis
Nov 20, 2026
Merged

GLinnik21 merged 2 commits into
mainfrom
platform/w1-platform-axis

Conversation

@GLinnik21

Copy link
Copy Markdown
Collaborator

Step W1 of the platform plan (discussion #1460). PLATFORM becomes a make variable with three values: webos, desktop, tizen. Later steps hang the per-platform crates and packaging on it. Nothing reads it yet, so no build changes.

What changes

  • Makefile: a PLATFORM block right after the FLAVOR block. A bad value stops make before the stamp reset deletes anything.
    • PLATFORMS := $(shell python3 ci/platform_axis.py --list), then PLATFORM ?= webos, then a refusal unless the value is exactly one word from the list. A bare filter would also pass webos bogus and %.
    • sim, sim-%, macapp and macapp-zip imply PLATFORM := desktop when PLATFORM was not given. An explicit value wins.
    • Two query targets, print-platform and print-rust-target, sit beside the other print-* targets and are in QUERY_GOALS, so they leave pkg/ alone. print-rust-target prints RUST_TARGET, which does not move with PLATFORM: the platform does not choose the compatibility axis (Rust target, sysroot, firmware floor, signing).
    • No cargo-running target is added (DISK_ENTRIES untouched). PLATFORM is not exported and is not part of RUST_CFG or RUST_TDIR.
  • ci/platform_axis.py: the list and --list. It imports only sys. It is not ci/platform.py, because ci/mkmacapp.py, ci/build-libass.py and ci/test-compat.py import the stdlib platform, and a ci/platform.py would shadow it for every script run from ci/.
  • ci/test_platform_axis.py (22 tests), in ci/check-python-steps.txt. It covers:
    • --list, the default, and each value from the command line and from the environment;
    • refusal of webso, WEBOS, empty, webos bogus, webos webos, %, web% and android;
    • the desktop implication through dry runs of 16 sim and macapp goals, and an explicit value beating it;
    • print-rust-target unchanged under all three platforms;
    • both queries leaving a seeded pkg/ untouched, with a control showing a building goal does reset it;
    • the stdlib-shadow guard: no stdlib-named module in ci/, each consumer importing the real platform when run from ci/, and a control with a fake platform.py.
    • Mutation-checked: a broken implied-goal list, a missing QUERY_GOALS entry and a planted ci/platform.py each fail the intended tests.

Known properties

  • Like FLAVOR, a PLATFORM set in the environment is read. A stray value fails every make invocation with the refusal message.
  • The platform is one value per invocation, read from the whole goal list.
  • Other goals that build the simulator but are not named sim-* (check-replay, screenshots, screenshots-sim, site-video-sim) do not imply desktop yet. That matters once PLATFORM selects something, so it is left for W4, the simulator as its own platform.
  • Cost: one more python start per make, measured at +12 ms (make -s print-flavor, median of 30 runs, repeated twice: 89 → 101 ms).

Verify

  • make -s print-flavor print-appid: byte-identical before and after (debug, com.beb.plxnative.debug). make -s print-platform print-rust-target: webos, armv7-unknown-linux-gnueabi.
  • make -n of the default goal: byte-identical before and after (57 lines), including the ARM link line and both cargo lines. Also identical: ipk, RELEASE=1 ipk, FLAVOR=stable RELEASE=1 ipk, sim-macos, sim-linux, macapp, lint, check-nodef and test-hostsim. A byte-identical binary is not claimed.
  • python3 ci/test_platform_axis.py: Ran 22 tests OK. ci/test_disk_preflight.py: Ran 54 tests OK. ci/test_arm_profile.py, ci/test_ci_split.py, ci/test_check_collisions.py, flavor.py --selftest and ci/check-deps.sh are green.

build-bench

--only noop,leaf,app,arm, 3 runs each, base e2088058d against this change, on one Mac. The ARM row was skipped on both sides because a fresh worktree has no ARM staticlib and the bench never builds one. Other lanes were building outside the check lock, so the load moved between 3.8 and 16 on 10 cores.

Scenario Base pair 1 (median, min–max) Change pair 1 Base pair 2 Change pair 2
No-op host test build 0.1 s (0.1–0.1), 0/190 0.1 s (0.1–4.7), 0/190 5.1 s (max 15.2) 0.2 s (max 0.2)
Edit leaf plx_base cbuf.rs 52.1 s (45.3–53.7) 68.7 s (54.7–71.6) 83.2 s (83.0–84.0) 104.1 s (95.2–107.2)
Edit leaf app coldstart.rs 17.4 s (17.3–19.3) 22.6 s (18.9–32.2) 35.0 s (25.5–39.7) 33.1 s (26.7–35.5)

Pair 2 printed the tool's "load > 10 cores, numbers are noisy" warning on both sides.

The change side read slower in both pairs, and that is host load, not the change:

  • Every timed scenario runs cargo with the config print-bench-config prints, and that config and the whole dry run are byte-identical.
  • Run back to back on the change tree, the OLD Makefile was slower than the new one: leaf 61.5 s (50.5–72.2) against 47.8 s (45.4–55.3), app 30.6 s against 21.7 s.
  • The units rebuilt are the same on both sides: 0, 35 and 1 of 190.

🤖 Generated with Claude Code

GLinnik21 and others added 2 commits November 20, 2026 08:16
`PLATFORM ?= webos` joins FLAVOR as a validated Makefile axis. FLAVOR is the install
identity; PLATFORM is the target OS, and the word now means a build target after the
bottom layer crate became `plx_os`. Values come from a new `ci/platform_axis.py --list`,
read at parse time the way `ci/flavor.py --list` is, so `make PLATFORM=webso ...` is a
message and not a build of something nobody asked for. A value must be exactly one listed
word (a `filter` of the value against the list would pass `webos bogus` and `%`).

`sim`, `sim-*`, `macapp` and `macapp-zip` imply `desktop` when PLATFORM was not given on
the command line or in the environment; an explicit value wins, and the public target names
do not change.

PLATFORM does not choose the compatibility axis: the Rust target, sysroot and, later, the
managed TFM, firmware floor and signing path stay separate variables. `print-platform` and
`print-rust-target` are explicit query goals in QUERY_GOALS, so asking resets nothing under
`pkg/`, and `print-rust-target` answers the same under every PLATFORM.

The script is not named `ci/platform.py`: `mkmacapp.py`, `build-libass.py` and
`test-compat.py` import the standard library's `platform`, and Python puts a script's own
directory first on `sys.path`, so a file of that name would shadow it for all of them.
`ci/test_platform_axis.py` pins the list, the refusal, the implication (read from a dry run
in a scratch tree), the untouched `pkg/` and the shadow case, with a control that proves
its probe would notice one.

No recipe reads PLATFORM yet, so with the default every target builds what it built before.

Co-Authored-By: Claude <noreply@anthropic.com>
…seeded

test_a_refused_value_is_refused_whatever_the_goal dry-ran `all` and
`sim-macos` with the default cwd, so in the real checkout, against this
file's own rule that every goal dry run uses a scratch tree. Were the
refusal ever to regress, the Makefile's parse-time stamp reset would have
run on the developer's tree and deleted pkg/plxnative and the staged
libraries.

The test now lives in a ScratchTree class, seeds a stamp that is not the
current configuration's and a built binary before each goal, and asserts
both survive the refusal. That removes the hazard and pins "the refusal
comes before the reset" by observation: a refusal moved below the reset
prints the same error, so the message alone could not show it. The seed
and the untouched-assertion are shared with the existing
asking-never-resets test.

Co-Authored-By: Claude <noreply@anthropic.com>
@GLinnik21
GLinnik21 merged commit 73e8281 into main Nov 20, 2026
19 checks passed
@GLinnik21
GLinnik21 deleted the platform/w1-platform-axis branch November 20, 2026 06:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant