Commit Graph

5 Commits

Author SHA1 Message Date
beeb
30a786c9a1 replace-workspace-values.py: fix missing key exception
If a cargo workspace member defines a key with `.workpace = true` but
this key does not exist in the workspace manifest, the script was
raising an exception. The case is now handled properly.
2025-09-16 21:02:13 -04:00
Lucio Franco
b92da7d1cb replace-workspace-values.py: Update cargo.toml on only lints replace 2025-07-23 10:37:23 -04:00
Winter
0d25674d1d tests.importCargoLock.gitDependencyWorkspaceInheritance: fix build
Regressed in f80228a805.

This shouldn't happen again unless we change the order that keys are
inserted (like we did here), as tomli-w respects the sort order of its
input.
2025-04-09 00:54:03 -04:00
D Anzorge
38fb742663 rustPlatform.importCargoLock: fix [package] section handling
Members of the [package] table in Cargo.toml can be either subtables, or
values like strings and bools. Python is happy to check for membership
of "workspace" in a string, since Python strings are iterables, but if
the value is a bool, Python will throw an exception.
2023-04-29 21:05:05 +02:00
Winter
5686f0064d rustPlatform.importCargoLock: add support for git dependencies that use workspace inheritance
Rust 1.64.0 added support for workspace inheritance, which allows
for crates to inherit values such as dependency version constraints or
package metadata information from their workspaces [0].

This works by having workspace members specify a value as a table, with
`workspace` set to true. Thus, supporting this in importCargoLock is as
simple as walking the crate's Cargo.toml, replacing inherited values
with their workspace counterpart.

This is also what a forthcoming Cargo release will do for `cargo vendor` [1],
but we can get ahead of it ;)

[0]: https://blog.rust-lang.org/2022/09/22/Rust-1.64.0.html#cargo-improvements-workspace-inheritance-and-multi-target-builds
[1]: https://github.com/rust-lang/cargo/pull/11414
2023-03-18 20:34:59 +01:00