Skip to content

Build: plxnative-storage is its own workspace package - #333

Merged
GLinnik21 merged 1 commit into
mainfrom
lane/storage-own-package
Sep 30, 2026
Merged

GLinnik21 merged 1 commit into
mainfrom
lane/storage-own-package

Conversation

@GLinnik21

Copy link
Copy Markdown
Collaborator

Closes #321

What changed

rust-modules/ is now a cargo workspace. The root package plxnative-modules is untouched and keeps its literal version; plxnative-storage is a member package at rust-modules/storage/ that does not depend on the app crate (it #[path]-includes the same src/storage_service/*.rs and src/storage/state.rs as before). As a [[bin]] of the app package it made cargo build the whole application library for a binary that uses none of it.

  • One Cargo.lock, one .cargo/config.toml, same target dirs, every cargo invocation keeps its cwd (rust-modules/).
  • Install-identity generation moved from build.rs to build_support/install_identities.rs, called by both build scripts (no copy).
  • Lints: [workspace.lints.rust] warnings = "deny", inherited by both packages.
  • Makefile: pkg/plxnative-storage is cargo rustc -p plxnative-storage --bin plxnative-storage ..., same target dir/flags/env, artifact path unchanged, depends only on the helper's own inputs; make check runs cargo test -p plxnative-storage; make lint passes --workspace.
  • ci/test_no_host_staticlib.py probes with cargo build --lib instead of the storage bin (still red on a staticlib crate type); ci/check-staticlib-artifact.py needed no change.
  • Stale comments corrected.

Red, then green

New ci/test_storage_package_isolated.py (wired into make check) runs both storage invocations and fails on any compiler-artifact record for plxnative_modules (fresh counts). The ARM-shaped cargo rustc invocation is checked host-side in dev profile: a 32-bit build-std build is too heavy for a unit gate, and the property is decided by the package graph.

Unmodified tree: FAILED (failures=3) (bin owned by plxnative-modules; cargo test build compiled plxnative_modules (fresh: False); cargo rustc build compiled plxnative_modules (fresh: False)). After: Ran 6 tests ... OK.

Feature tree

No drift for shipped dependencies: cargo tree -e features for the ARM target and the ARM-unit fingerprints (features per unit) match the old layout exactly; the app package's tree is identical to the old one. The only fingerprint differences are the new storage package's own units and host build-dependency units (not shipped).

ELF

pkg/plxnative-storage: 1630408 -> 1630212 bytes, not byte-identical. DT_NEEDED (8) and the 109 dynamic symbols are identical; the normalized nm list (3535 symbols; ::h<hash>, v0 Cs..._, .llvm.N, anon.<hash>.N stripped) is identical. Differences: .rodata +64 bytes, all panic-location source paths (src/bin/../storage_service/x.rs became storage/src/../../src/storage_service/x.rs), plus crate-disambiguator/CGU/build-id hashes. fw-compat review: PASS (identical fwcompat matrix, FLAGS_1, versions, CP15 scan).

Sizes and compiles

  • Fresh storage ARM target dir: 562 MB -> 257 MB.
  • ARM storage build: Compiling plxnative-modules 1 -> 0.
  • make check storage steps: 2 host compiles of the app lib -> 0 (the library is built once directly by the staticlib probe).

Gates (committed tree)

cargo +nightly check --lib --no-default-features and check -p plxnative-storage --no-default-features (cwd rust-modules): OK. make check: exit 0 (test result: ok. 5257 passed, ok. 5331 passed, ok. 102 passed for the helper). make and RELEASE=1 make: exit 0.

Not yet verified: on-device run of pkg/plxnative-storage (manager runs it under the TV lock).

🤖 Generated with Claude Code

https://claude.ai/code/session_01PUkd69QzFciCfQucbfiyKv

The storage helper was a [[bin]] of the app package, so cargo built the whole ~423k-line
application library for a binary that links none of it: two host library builds in `make check`
(`cargo test --bin plxnative-storage`, ci/test_storage_service_package.py) and a third, ARM one, in
the `pkg/plxnative-storage` rule.

rust-modules/ is now a cargo workspace. The root package `plxnative-modules` is unchanged and keeps
its literal `version` (bump-version, check-package, source_bundle and the release tooling read it);
`plxnative-storage` is a member at rust-modules/storage/ (src/main.rs = the old
src/bin/plxnative-storage.rs, `#[path]`-including the same src/storage_service/*.rs and
src/storage/state.rs as before) and does not depend on the app crate. One Cargo.lock, one
.cargo/config.toml, same target dirs, every cargo invocation keeps its cwd.

- Install-identity generation moved out of build.rs into build_support/install_identities.rs,
  called by both build scripts: one generator, no copy.
- `[lints.rust] warnings = "deny"` is `[workspace.lints.rust]`, inherited by both packages.
- Makefile: the storage rule is `cargo rustc -p plxnative-storage --bin plxnative-storage ...` with
  the same target dir, flags and env, and depends on the helper's own inputs; `make check` runs
  `cargo test -p plxnative-storage`; `make lint` passes --workspace.
- ci/test_storage_package_isolated.py (new, in make check) runs both storage invocations and fails on
  any compiler-artifact record for plxnative_modules. RED on the unmodified tree (3 failures: the
  bin is owned by plxnative-modules, and both the test build and the rustc build compiled
  plxnative_modules), GREEN after. The ARM-shaped invocation is checked host-side in dev profile: a
  32-bit build-std build is too heavy for a unit gate and the property is decided by the package
  graph.
- ci/test_no_host_staticlib.py probed the lib through the storage bin; it now uses
  `cargo build --lib` and keeps its red-on-staticlib property. check-staticlib-artifact.py needed no
  change (the root lib keeps its name).
- Comments this made false were corrected (Cargo.toml, Makefile, state.rs, app/mod.rs, gfx.rs,
  release-config-check.py).

Measured:
- Shipped dependency features unchanged: the ARM units' fingerprints and `cargo tree -e features`
  for the target are identical to the old layout; only host build-dep units differ (they are not
  shipped).
- pkg/plxnative-storage (ARM, --no-default-features): 1630408 -> 1630212 bytes, not byte-identical.
  DT_NEEDED (8), the 109 dynamic symbols, and the normalized `nm` lists (3535 symbols, hashes, v0
  Cs..._ disambiguators, .llvm.N and anon.* ids stripped) are identical; section sizes differ by
  64 bytes of .rodata, which is the panic-location source paths
  (`src/bin/../storage_service/x.rs` -> `storage/src/../../src/storage_service/x.rs`). fwcompat
  matrix identical and OK on every release.
- Fresh storage target dir: 562 MB -> 257 MB; the ARM storage build compiles 0 copies of
  plxnative-modules (was 1). In `make check` the storage steps compile 0 (was 2 host compiles).

Open: on-device run of pkg/plxnative-storage has not been done.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01PUkd69QzFciCfQucbfiyKv
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.

Build: move plxnative-storage into its own workspace package

1 participant