Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,9 @@ jobs:
- name: Type-check the simulator feature set
# The host simulator is a real build configuration with real users (the `ui-sim` skill, and
# `make macapp`, which ships `--release --no-default-features --features hostsim,play-feed` to
# somebody who has none of this installed). Nothing else in CI compiles it, so a change that
# only breaks the Mac side merges green and is found by a person trying to demo the app.
# somebody who has none of this installed). `simulators.yml` builds, links and launches it on
# macOS and Linux, in jobs that need a macOS runner and the host FFmpeg; this is the cheap early
# answer for the same feature sets, so a change that only breaks the Mac side fails here first.
run: |
cd rust-modules
cargo "+$RUST_TOOLCHAIN" check --lib --features hostsim
Expand Down
22 changes: 21 additions & 1 deletion .github/workflows/simulators.yml
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,30 @@ jobs:
uses: ./.github/actions/deps-cache
- uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2
with:
workspaces: rust-modules -> target-sim-ci
workspaces: |
rust-modules -> target-sim-ci
rust-modules -> target-sim-ci-macapp
key: simulator-macos
- name: Build native macOS simulator
run: make sim-macos SIM_TDIR=rust-modules/target-sim-ci
- name: Link the macOS app's feature set
# What `make macapp` ships: `--no-default-features --features hostsim,play-feed` (the
# release build in `ci/mkmacapp.py`, linked here in DEBUG: the harder case for the reliance
# below, and cheaper than a release build). The desktop platform (`platform_desktop`) never
# names the television's code, but the crate still COMPILES it (`system.rs`'s Wayland and
# SDL-private externs, `webos`, `keymanager`): a host executable links only because nothing
# references those items and the linker drops them (`-dead_strip` here, `--gc-sections` on
# Linux). A change that makes one reachable from the desktop entry fails this link on
# libwayland, glib or luna-service2, which the default-features build above may not show. This
# step guards that reliance until the platform crates split and the desktop build no longer
# contains `webos` (docs/platform-ports.md, W7). It has its own target dir because cargo does
# not hash its output: in `target-sim-ci` it would overwrite the binary the steps below run.
# The host FFmpeg and libass it links were staged by the step above.
run: |
CARGO_INCREMENTAL=0 cargo "+$(make -s print-rust-toolchain)" build \
--manifest-path rust-modules/Cargo.toml \
--target-dir rust-modules/target-sim-ci-macapp \
--no-default-features --features hostsim,play-feed --bin plxnative-sim
- name: Replay all committed product recordings
# 960x540, not the driver's 1920x1080 default. The runner has no GPU (the log says `GL:
# Apple Software Renderer`), so a replay is CPU-bound in the rasteriser and costs what the
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ rust-modules/target-sim-lab/
# `make screenshots-sim` — the documentation-screenshot simulator (hostsim + devtriggers).
rust-modules/target-sim-shots/
rust-modules/target-sim-video/
# `simulators.yml` builds into `target-sim-ci` (`make sim-macos SIM_TDIR=...`) and `target-sim-ci-macapp`
# (the macapp feature set's link), in the checkout; a lane reproducing that job gets the same trees.
rust-modules/target-sim-ci*/
# pkg/plxnative-storage's own target dir, deliberately separate from $(RUST_TDIR) — see the
# Makefile's STORAGE_TDIR comment. One glob for every RELEASE/LAB/SYMBOLS combination.
rust-modules/target*-storage/
Expand Down
10 changes: 5 additions & 5 deletions ci/check-deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# present — the present gate's worker door: ONE atomic static in machine/src/present.rs and ONE
# `wake_from_worker`.
# effect — `Effect::` spelled nowhere (the enum is `Fx::`, the app's `AppFx::`).
# sink — `tv::sink::installed` and `VideoSink` only under player/, tv/, tv.rs, port.rs and app/adapters/backends.rs
# sink — `tv::sink::installed` and `VideoSink` only under player/, tv/, tv.rs, port.rs, platform_desktop.rs and app/adapters/backends.rs
# (step L15: the Starfish/ACB verbs are the player's alone).
#
# Phase 4 rule (D3 rewrite, phase 12):
Expand Down Expand Up @@ -1140,8 +1140,8 @@ else fail "frame: $frame_bad line(s) of a privileged OS-primitive call outside a
fi # frame

# sink: the Starfish/ACB verbs (`tv::sink::VideoSink`) are the player's alone (step L15). Only
# `player/`, `play-uri/`, the native `webos/` port, and `port.rs` (which names one)
# and `tv.rs` with `tv/` (which hold it) name `tv::sink::installed` or `VideoSink`; so does
# `player/`, `play-uri/`, the native `webos/` port, and `port.rs` and `platform_desktop.rs` (which
# name one each) and `tv.rs` with `tv/` (which hold it) name `tv::sink::installed` or `VideoSink`; so does
# `app/adapters/backends.rs`, the boot composition that resolves the installed display once for the
# ACB plane's boot and hands it on (it was `player/plane_boot.rs`; the composition root is where the
# driver set is built). Every other module reaches the television through the narrower `tv` interfaces. Wholly-test files are skipped like inline
Expand All @@ -1156,12 +1156,12 @@ while IFS= read -r line; do
case "$p" in "$SRC_PLAY_FEED"/*|"$SRC_PLAY_URI"/*)
case "$line" in *tv::sink::installed*|*tv::sink::display_installed*) ;; *) continue ;; esac ;;
esac
case "$p" in "$SRC_MEDIA"/player/*|"$SRC_OS"/tv/*|"$SRC_OS"/tv.rs|"$SRC_OS"/webos/*|"$SRC"/port.rs|"$SRC"/app/adapters/backends.rs) continue ;; esac
case "$p" in "$SRC_MEDIA"/player/*|"$SRC_OS"/tv/*|"$SRC_OS"/tv.rs|"$SRC_OS"/webos/*|"$SRC"/port.rs|"$SRC"/platform_desktop.rs|"$SRC"/app/adapters/backends.rs) continue ;; esac
if is_wholly_test "$p"; then continue; fi
echo " $line"; sink_bad=$((sink_bad+1))
done < <(grep_code 'tv::sink::(installed|display_installed)|\b(VideoSink|DisplaySink)\b' "$SRC" "$SRC_OS" "$SRC_UI" "$SRC_MEDIA" "$SRC_PLAYBACK_CONTRACT" "$SRC_PLAY_URI" "$SRC_PLAY_FEED" "$SRC_MEDIA_CODECS" "$SRC_APPKIT" "$SRC_SCREENS" "$SRC_OWP")
if [ "$sink_bad" -eq 0 ]; then ok "sink"
else fail "sink: $sink_bad line(s) naming the video sink outside playback execution, port.rs, tv.rs and tv/"; fi
else fail "sink: $sink_bad line(s) naming the video sink outside playback execution, port.rs, platform_desktop.rs, tv.rs and tv/"; fi
fi # sink

# route: `Route::` in app/ = 0, and `enum Route` gone from the whole tree (D1/D4). No allowlist:
Expand Down
5 changes: 3 additions & 2 deletions ci/mkmacapp.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#!/usr/bin/env python3
"""Build `PlxNative.app` — the app core as a SELF-CONTAINED macOS application.

This is the `hostsim` build (`rust-modules/src/bin/sim.rs`): the same UI, the same Plex data layer
and the same event loop the television runs, wrapped in a bundle that carries its own SDL, its own
This is the desktop platform's build (`rust-modules/src/platform_desktop.rs`, entered by
`rust-modules/src/bin/sim.rs`, feature `hostsim`): the same UI, the same Plex data layer and the same
event loop the television runs, booted on the desktop's own platform and wrapped in a bundle that carries its own SDL, its own
fonts and its own copy of every non-system library it links, so it starts on a Mac that has none of
this repo's build environment installed. What it is NOT is a television — there is no video
pipeline off-device (`play-feed/src/ffi_host.rs`), so Play lands on the app's real failure read-out.
Expand Down
11 changes: 11 additions & 0 deletions ci/module-layers.ini
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ members = screens
uses = base machine os gfx net plex telemetry ui data session media appkit screens playback_contract play_uri play_feed media_codecs
members =
crate app dev lab capture remote focusprobe hud_cli hud_tools shot coldstart textinput system release_line port
platform_desktop

[platform webos]
# Not a layer: the modules that exist only because the target is webOS. Identity, capability and
Expand All @@ -207,3 +208,13 @@ members =
# `port.rs` (docs/module-layers.md, step L15). Nothing outside names the port, so it can become its own
# crate on top, and another TV OS another port beside it.
members = webos keymanager system port

[platform desktop]
# Not a layer, like [platform webos]: the simulator's and the macOS app's own platform. Its tables
# (`SERVICES`, the shell, the frame probe, `PLATFORM`) and its entry (`run`, which `src/bin/sim.rs`
# calls) are written for a host, from the shared `NONE` groups of `os`'s `tv` wherever a host has
# nothing to say, so nothing outside it needs to name it and it names none of [platform webos]: the
# gate fails a reference from here to `webos`, `keymanager`, `system` or `port` like any other
# reference from outside that port. It stays a module of the application crate until the platform
# crates split (docs/platform-ports.md, W7).
members = platform_desktop
25 changes: 14 additions & 11 deletions ci/test_sim_backend.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
#!/usr/bin/env python3
"""Every simulator build that drops the default features still selects the Feed backend.

`hostsim` swaps the television's native video sink for the simulator's (`plx_play_feed::ffi_host`),
but that stand-in is the Feed backend's, so it exists only when `play-feed` is built. A simulator
built `--no-default-features --features hostsim` selects NO backend: its app installs `NoSink`, so
Play can only ever reach the failure read-out and the clock sink (`plxnative-clocksink`) has nothing
to arm. Three builds drift into that state because they drop `devtools` and `devtriggers` with
`--no-default-features` and then list `hostsim` alone: the `.app` bundle (`ci/mkmacapp.py`), the
screenshot simulator (`make screenshots-sim`) and the demo-video simulator (`make site-video-sim`);
so does the CI step that type-checks the simulator feature set, which then proves nothing about the
The simulator is its own platform (`platform_desktop`, which `hostsim` compiles), and the video sink
it hands the application is the Feed backend's host sink (`plx_play_feed::ffi_host`), which exists
only when `play-feed` is built. A simulator built `--no-default-features --features hostsim` selects
NO backend: its platform installs `NoSink`, so Play can only ever reach the failure read-out and the
clock sink (`plxnative-clocksink`) has nothing to arm. Three builds drift into that state because
they drop `devtools` and `devtriggers` with `--no-default-features` and then list `hostsim` alone:
the `.app` bundle (`ci/mkmacapp.py`), the screenshot simulator (`make screenshots-sim`) and the
demo-video simulator (`make site-video-sim`); so do the CI steps that type-check
(`ci.yml`) and link (`simulators.yml`) the simulator feature set, which then prove nothing about the
configuration the other three ship.

The scan finds every cargo command line in the files that can hold one, joins its continuations and
Expand All @@ -26,6 +27,7 @@
MAKEFILE = "Makefile"
MKMACAPP = "ci/mkmacapp.py"
CI_YML = ".github/workflows/ci.yml"
SIMULATORS_YML = ".github/workflows/simulators.yml"


def feature_flags(tokens):
Expand Down Expand Up @@ -91,7 +93,7 @@ def python_cargo_commands(path):

def scan():
commands = []
for path in (MAKEFILE, CI_YML):
for path in (MAKEFILE, CI_YML, SIMULATORS_YML):
commands += text_cargo_commands(path)
for path in sorted(p.relative_to(ROOT).as_posix() for p in (ROOT / "ci").glob("*.py")):
commands += python_cargo_commands(path)
Expand All @@ -106,7 +108,7 @@ class SimulatorBackend(unittest.TestCase):
def test_the_scan_reaches_the_builds_it_exists_for(self):
sims = sim_commands(scan())
reached = {(path, bool(no_default)) for path, _, _, no_default, _ in sims}
for site in (MKMACAPP, MAKEFILE, CI_YML):
for site in (MKMACAPP, MAKEFILE, CI_YML, SIMULATORS_YML):
with self.subTest(site):
self.assertIn((site, True), reached, f"no `--no-default-features --features hostsim` build found in {site}")
makefile_lines = " ".join(line for path, _, line, _, _ in sims if path == MAKEFILE)
Expand All @@ -126,10 +128,11 @@ def test_a_simulator_without_default_features_selects_the_feed_backend(self):
)

def test_each_scripted_simulator_build_is_pinned_to_its_features(self):
"""The three bundle/screenshot/video builds and the CI type-check, spelled out."""
"""The three bundle/screenshot/video builds and the CI type-check and link, spelled out."""
pinned = {
MKMACAPP: {"hostsim", "play-feed"},
CI_YML: {"hostsim", "play-feed"},
SIMULATORS_YML: {"hostsim", "play-feed"},
}
sims = sim_commands(scan())
for site, expected in pinned.items():
Expand Down
2 changes: 1 addition & 1 deletion docs/agent-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ the pinned Sentry Native cross-build), and `sshpass` (Homebrew; deploy/run use y
asserts only what its code promises (no panic, the documented bounds, round trips) and a crash fails the
run, with the input in `fuzz/artifacts/<target>/`. The package is a top-level `fuzz/` with its own
`[workspace]`, so no shipped `Cargo.toml` names it and no shipped build changes; it depends on the layer
crates by path, with `plx_media/hostsim` (the one configuration that links on a host), and `fuzz/build.rs`
crates by path, with `plx_media/hostsim` (the host configuration: the Feed backend's host sink and the layers' host stand-ins), and `fuzz/build.rs`
reuses `rust-modules/build_support/host_link.rs`. `tools/fuzz-hud.py` is the whole workflow
(`list | seed | lock | build | run`): it copies `rust-modules/Cargo.lock` to the gitignored `fuzz/Cargo.lock`
(the shared crates are exactly the shipped versions), builds with the nightly named by `FUZZ_TOOLCHAIN`
Expand Down
6 changes: 3 additions & 3 deletions docs/macos-app.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ television runs, packaged so it starts on a Mac that has none of this repo's bui
no Homebrew, no SDL, no toolchain. `ci/mkmacapp.py` is the whole recipe; this note is why it looks
the way it does and what the result is and is not.

It is **not a new build of the app**. It is `--features hostsim,play-feed` — the desktop simulator
(`docs/…`/`rust-modules/src/bin/sim.rs`, and the `ui-sim` skill) — with the dev features off and a
bundle around it. (`play-feed` is named because `--no-default-features` drops it, and the simulator's
It is **not a new build of the app**. It is `--features hostsim,play-feed` — the desktop simulator,
which boots the app on the desktop's own platform (`rust-modules/src/platform_desktop.rs`, entered by
`rust-modules/src/bin/sim.rs`; the `ui-sim` skill) — with the dev features off and a bundle around it. (`play-feed` is named because `--no-default-features` drops it, and the simulator's
video sink belongs to that backend.) Every UI change, every Plex data-layer change, is the same code the ipk ships.

## What it can do, and the one thing it cannot
Expand Down
Loading
Loading