Skip to content

Commit

Permalink
Elaborate on motivation of --unit-graph.
Browse files Browse the repository at this point in the history
  • Loading branch information
ehuss committed Mar 15, 2020
1 parent aa80a98 commit 4107872
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/cargo/util/command_prelude.rs
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ pub trait ArgMatchesExt {
if build_config.unit_graph {
config
.cli_unstable()
.fail_if_stable_opt("--unit-graph", 0)?;
.fail_if_stable_opt("--unit-graph", 8002)?;
}

let opts = CompileOptions {
Expand Down
11 changes: 10 additions & 1 deletion src/doc/src/reference/unstable.md
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ The `-Z crate-versions` flag will make `cargo doc` include appropriate crate ver
You can find an example screenshot for the cargo itself in the tracking issue.

### unit-graph
* Tracking Issue: TODO
* Tracking Issue: [#8002](https://github.com/rust-lang/cargo/issues/8002)

The `--unit-graph` flag can be passed to any build command (`build`, `check`,
`run`, `test`, `bench`, `doc`, etc.) to emit a JSON object to stdout which
Expand All @@ -567,6 +567,15 @@ depends on.
cargo +nightly build --unit-graph -Z unstable-options
```

This structure provides a more complete view of the dependency relationship as
Cargo sees it. In particular, the "features" field supports the new feature
resolver where a dependency can be built multiple times with different
features. `cargo metadata` fundamentally cannot represent the relationship of
features between different dependency kinds, and features now depend on which
command is run and which packages and targets are selected. Additionally it
can provide details about intra-package dependencies like build scripts or
tests.

The following is a description of the JSON structure:

```javascript
Expand Down

0 comments on commit 4107872

Please sign in to comment.