Skip to content

build: Declare every third-party dependency in [workspace.dependencies] - #2061

Merged
zackees merged 2 commits into
obs-rust:masterfrom
vpacher:build/2056-workspace-deps
Oct 24, 2026
Merged

zackees merged 2 commits into
obs-rust:masterfrom
vpacher:build/2056-workspace-deps

Conversation

@vpacher

@vpacher vpacher commented Oct 24, 2026 •

Copy link
Copy Markdown
Member

Refs #2056 (proposal 2; proposal 1 is #2059. Proposal 3, cargo deny or a ci_lint rule, is not in this PR: ci/test_workspace_dependencies.py covers the rule inside the repository.)

What and why

[workspace.dependencies] held only libloading. The other 15 crates.io dependencies were declared in each crate, with different version requirements (cc "1" and "=1.6.0", pkg-config "0.3" and "=0.3.34", serde_json "1.0.151" and "=1.0.151"), and their features were set in 13 manifests.

  • Root Cargo.toml: all 16 third-party dependencies are in [workspace.dependencies]. Each entry pins the one version in Cargo.lock with = and sets default-features = false. Exact pins were already used for the root table, obs-build, foldhash and criterion.
  • Members: dep = { workspace = true, ... }, with the same choices as before:
    • default-features = true where the crate used the defaults before. This includes cc, dunce, libloading and pkg-config, which have no default features today, so a later version cannot change what these crates get.
    • features = [...] unchanged (cc parallel, criterion cargo_bench_support, flate2 rust_backend, serde derive, tungstenite handshake).
  • ci/test_workspace_dependencies.py keeps it that way:
    • every third-party dependency of a member (all dependency kinds and target tables) uses workspace = true;
    • every workspace entry pins the Cargo.lock version with =, sets default-features = false and has no features;
    • every entry is used.

A version bump is now one line in the root Cargo.toml plus Cargo.lock.

No change in what is built. Cargo.lock is unchanged. cargo tree --locked --target all -e features,normal,build,dev gives byte-identical output before and after (30 outputs):

  • --workspace;
  • every member with -p;
  • -p libobs-rust --no-default-features, -p obs-util, -p obs-studio-rust --features libobs-integration,bundled-native.

cargo metadata --locked prints no warnings.

RED → GREEN

  • RED commit: bb1c4bd adds ci/test_workspace_dependencies.py. On master, 2 of 3 tests fail: 38 declarations do not inherit, and libloading is a string with default features on.
  • GREEN: fea31ab. ci/test_workspace_dependencies.py 3/3. Linux (Debian 13, soldr 0.9.38, Rust 1.98.1):
    • OBS_GATE_SKIP_SELF_TEST=1 uv run ci/local_gate.py --lane lint (as the Fast Gate runs it): ok, 43 s.
    • SOLDR_RUSTC_WRAPPER=none soldr cargo test --workspace --locked --no-run: ok.
    • All ci/ self-tests: 1177 run. 3 errors in test_hybrid_packaging.py, because this host has no zstd; master gives the same 3 errors on this host.
  • Real app: N/A (build manifests only, no change in the resolved graph).

Checklist

  • Base is master
  • I claimed the issue, or no one else has an open PR for it
  • RED, then GREEN commits
  • User-visible change: not applicable, no user-visible change
  • (Optional) Local gate passed and the pushed head is stamped; otherwise PR CI runs the full suite
  • Warning or flag changes: not applicable
  • Intentional differences from C: not applicable (no port)

🤖 Generated with Claude Code

vpacher and others added 2 commits October 24, 2026 07:47
[workspace.dependencies] holds only libloading. The other 16 crates.io
dependencies are declared in each crate, with different version
requirements (cc "1" and "=1.6.0", pkg-config "0.3" and "=0.3.34") and
with the feature choices spread over 13 manifests.

ci/test_workspace_dependencies.py requires:
- every third-party dependency of a workspace member, in every
  dependency table and target table, uses `workspace = true`;
- every [workspace.dependencies] entry is a table, pins the one version
  in Cargo.lock with `=`, sets `default-features = false` and has no
  `features` (crates enable what they need);
- every entry is used by a member.

On master, 2 of the 3 tests fail: 38 dependency declarations do not
inherit, and libloading is a plain string with default features on.

Refs obs-rust#2056

Co-Authored-By: Claude Opus 5.5 <[email protected]>
[workspace.dependencies] now holds all 16 crates.io dependencies (it held
only libloading). Each entry pins the one version in Cargo.lock with `=`
and sets `default-features = false`. The 13 member manifests inherit
them with `workspace = true` and keep their previous feature choices:

- `default-features = true` where the crate used the dependency's
  defaults before (also for cc, dunce, libloading and pkg-config, which
  define no default features today, so a later version cannot change
  what these crates get);
- `features = [...]` unchanged (cc parallel, criterion
  cargo_bench_support, flate2 rust_backend, serde derive, tungstenite
  handshake).

The pins are the Cargo.lock versions, so Cargo.lock does not change. The
requirements that were caret before (cc "1", libc "0.2", proptest "1",
pkg-config "0.3", ...) are now exact; obs-build, obs-data and the root
table already used exact pins. A version bump is now one line in the
root Cargo.toml plus Cargo.lock.

`cargo tree --locked --target all -e features,normal,build,dev` is
byte-identical before and after for the workspace, for every member
(`-p`), and for `-p libobs-rust --no-default-features`, `-p obs-util`
and `-p obs-studio-rust --features libobs-integration,bundled-native`
(30 outputs). cargo metadata prints no warnings.

ci/test_workspace_dependencies.py: 3/3.

Refs obs-rust#2056

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@vpacher
vpacher requested a review from zackees as a code owner October 24, 2026 05:54
@zackees
zackees added this pull request to the merge queue Oct 24, 2026
Merged via the queue into obs-rust:master with commit 7423726 Oct 24, 2026
31 checks passed
@vpacher
vpacher deleted the build/2056-workspace-deps branch October 24, 2026 06:34
MCPVOT pushed a commit to MCPVOT/obs-studio that referenced this pull request Oct 30, 2026
…rust#2603) (obs-rust#2604)

Since obs-rust#2061 the root [workspace.dependencies] declares serde_json with
default-features = false, and obs-build, obs-preflight and
obs-studio-rust turn the defaults on again with default-features = true.
Cargo honours that, but the cargo-chef recipe of soldr cook does not:
serde_json builds with neither std nor alloc and fails. setup-soldr then
continues without cooked dependencies and never saves the cook cache, so
every Rust CI lane compiles all external crates on every run.

The three members now name the feature: features = ["std"]. std is
serde_json's default feature, so the normal build and Cargo.lock do not
change.

Verified on Linux (soldr 0.9.31): before, soldr cook --release and
--profile dev exit 101 on serde_json; after, both exit 0.
cargo check --workspace --locked passes; ci.test_workspace_dependencies
passes.

Fixes obs-rust#2603

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants