Add a JSON output mode to cargo package
.
#14262
Draft
+121
−57
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In multi-crate workspaces, it can be ambiguous where files are sourced from when building packages. This extends the existing
--list
command line flag to optionally emit JSON when called as-l=json
or--list=json
. Existing behaviour is unaffected.The JSON format is slightly different to that proposed in #11666: it exposes the distinction within
cargo::ops::cargo_package
itself around whether an archive file is generated or sourced from the disk. A new crate created withcargo new --lib foo
generates this output:I'm open minded as to whether the
VcsInfo
should actually be included, but it feels like there's little harm in doing so.Fixes #11666, and is at least extremely relevant to #13953.