3

Part 2 of RFC2906 -- allow inheriting from a different `Cargo.toml` by Muscraft...

 2 years ago
source link: https://github.com/rust-lang/cargo/pull/10517
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Copy link

Contributor

Muscraft commented 19 days ago

edited

Tracking issue: #8415
RFC: rust-lang/rfcs#2906

Part 1

This PR focuses on inheriting from a root workspace:

  • Allow inheriting from a different Cargo.toml
  • Add in searching for a workspace root in to_real_manifest as needed
  • Fixed problem where a package would try to pull a dependency from a workspace and specify { workspace = true, optional = true } and it would not respect the optional
  • Added tests to verify everything is in working order

Remaining implementation work for the RFC

  • Correctly inherit fields that are relative paths
    • Including adding support for inheriting license_file, readme, and path-dependencies
  • Path dependencies infer version directive
  • Lock workspace dependencies and warn when unused
  • Optimizations, as needed
  • Evaluate any new fields for being inheritable (e.g. rust-version)

Problems:

  • There is duplication of code that can't be removed without significant refactoring
  • Potential to parse the same manifest many times when searching for a root
    • This should not happen when a [package] specifies its workspace
    • This should only happen if the workspace root is greater than one folder above

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK