Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include public/private dependency status in cargo metadata #14502

Closed
Tracked by #44663
eopb opened this issue Sep 5, 2024 · 2 comments · Fixed by #14504
Closed
Tracked by #44663

Include public/private dependency status in cargo metadata #14502

eopb opened this issue Sep 5, 2024 · 2 comments · Fixed by #14504
Assignees
Labels
C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` Command-metadata S-accepted Status: Issue or feature is accepted, and has a team member available to help mentor or review Z-public-dependency Nightly: public-dependency

Comments

@eopb
Copy link
Contributor

eopb commented Sep 5, 2024

Problem

related to rust-lang/rust#44663

Information about whether or not a dependency is public is not included in the output of cargo metadata.

This could be useful for custom subcommands. cargo override, would find this useful for eopb/cargo-override#121

Proposed Solution

When -Zpublic-dependency is enabled, include a boolean flag in cargo metadatas output at packages[].dependencies[].public.
If -Zpublic-dependency is not enabled, this flag should not appear in cargo metadata output.

Notes

If this feature request is accepted, I'm happy to claim and take a crack at working on it

@eopb eopb added C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` S-triage Status: This issue is waiting on initial triage. labels Sep 5, 2024
@epage epage added Command-metadata Z-public-dependency Nightly: public-dependency S-accepted Status: Issue or feature is accepted, and has a team member available to help mentor or review and removed S-triage Status: This issue is waiting on initial triage. labels Sep 6, 2024
@epage
Copy link
Contributor

epage commented Sep 6, 2024

This seems like basic enough of metadata for us to include.

@eopb
Copy link
Contributor Author

eopb commented Sep 6, 2024

@rustbot claim

eopb added a commit to eopb/cargo that referenced this issue Sep 6, 2024
eopb added a commit to eopb/cargo that referenced this issue Sep 6, 2024
eopb added a commit to eopb/cargo that referenced this issue Sep 6, 2024
eopb added a commit to eopb/cargo that referenced this issue Sep 6, 2024
eopb added a commit to eopb/cargo that referenced this issue Sep 6, 2024
fixes rust-lang#14502

This change introduces a new method, `Dependency::serialized` which replaces the direct `Serialize` implmentation on `Dependency`.

This matches the pattern used by `Package` with its `Package::serialized`, and enables us to influence the serialization format with unstable flags.

I replaced borrowed types in `SerializedDependency` with owned variants to satisfy the borrow checker.
This shouldn't be an issue since `Dependency` is cheap to copy.
eopb added a commit to eopb/cargo that referenced this issue Sep 6, 2024
fixes rust-lang#14502

This change introduces a new method, `Dependency::serialized` which replaces the direct `Serialize` implementation on `Dependency`.

This matches the pattern used by `Package` with its `Package::serialized`, and enables us to influence the serialization format with unstable flags.

I replaced borrowed types in `SerializedDependency` with owned variants to satisfy the borrow checker.
This shouldn't be an issue since `Dependency` is cheap to copy.
eopb added a commit to eopb/cargo that referenced this issue Sep 6, 2024
fixes rust-lang#14502

This change introduces a new method, `Dependency::serialized` which replaces the direct `Serialize` implementation on `Dependency`.

This matches the pattern used by `Package` with its `Package::serialized`, and enables us to influence the serialization format with unstable flags.

I replaced borrowed types in `SerializedDependency` with owned variants to satisfy the borrow checker.
This matches `SerializedPackage` and shouldn't be an issue since `Dependency` is cheap to copy.
@bors bors closed this as completed in b958d79 Sep 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` Command-metadata S-accepted Status: Issue or feature is accepted, and has a team member available to help mentor or review Z-public-dependency Nightly: public-dependency
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants