Skip to content

Commit ca02e03

Browse files
committed
Add some documentation for --filter-platform.
1 parent d6b5a6b commit ca02e03

File tree

5 files changed

+44
-4
lines changed

5 files changed

+44
-4
lines changed

src/bin/cargo/commands/metadata.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ pub fn cli() -> App {
1515
.arg(
1616
opt(
1717
"filter-platform",
18-
"Only include resolve dependencies matching the given target-triple \
19-
(\"host\" for current host)",
18+
"Only include resolve dependencies matching the given target-triple",
2019
)
2120
.value_name("TRIPLE"),
2221
)

src/cargo/ops/cargo_output_metadata.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ pub fn output_metadata(ws: &Workspace<'_>, opt: &OutputMetadataOptions) -> Cargo
5454
})
5555
}
5656

57+
/// This is the structure that is serialized and displayed to the user.
58+
///
59+
/// See cargo-metadata.adoc for detailed documentation of the format.
5760
#[derive(Serialize)]
5861
pub struct ExportInfo {
5962
packages: Vec<Package>,
@@ -84,6 +87,7 @@ struct Dep {
8487
pkg: PackageId,
8588
}
8689

90+
/// Builds the resolve graph as it will be displayed to the user.
8791
fn build_resolve_graph(
8892
ws: &Workspace<'_>,
8993
resolve_opts: ResolveOpts,

src/doc/man/cargo-metadata.adoc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,9 @@ The output has the following format:
202202
/* The resolved dependency graph, with the concrete versions and features
203203
selected. The set depends on the enabled features.
204204
This is null if --no-deps is specified.
205+
By default, this includes all dependencies for all target platforms.
206+
The `--filter-platform` flag may be used to narrow to a specific
207+
target triple.
205208
*/
206209
"resolve": {
207210
/* Array of nodes within the dependency graph.
@@ -265,6 +268,14 @@ The output has the following format:
265268
Specify the version of the output format to use. Currently `1` is the only
266269
possible value.
267270

271+
*--filter-platform* _TRIPLE_::
272+
This filters the `resolve` output to only include dependencies for the
273+
given target triple. Without this flag, the resolve includes all targets.
274+
+
275+
Note that the dependencies listed in the "packages" array still includes all
276+
dependencies. Each package definition is intended to be an unaltered
277+
reproduction of the information within `Cargo.toml`.
278+
268279
include::options-features.adoc[]
269280

270281
=== Display Options

src/doc/man/generated/cargo-metadata.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,9 @@ <h2 id="cargo_metadata_output_format">OUTPUT FORMAT</h2>
209209
/* The resolved dependency graph, with the concrete versions and features
210210
selected. The set depends on the enabled features.
211211
This is null if --no-deps is specified.
212+
By default, this includes all dependencies for all target platforms.
213+
The `--filter-platform` flag may be used to narrow to a specific
214+
target triple.
212215
*/
213216
"resolve": {
214217
/* Array of nodes within the dependency graph.
@@ -279,6 +282,16 @@ <h3 id="cargo_metadata_output_options">Output Options</h3>
279282
<p>Specify the version of the output format to use. Currently <code>1</code> is the only
280283
possible value.</p>
281284
</dd>
285+
<dt class="hdlist1"><strong>--filter-platform</strong> <em>TRIPLE</em></dt>
286+
<dd>
287+
<p>This filters the <code>resolve</code> output to only include dependencies for the
288+
given target triple. Without this flag, the resolve includes all targets.</p>
289+
<div class="paragraph">
290+
<p>Note that the dependencies listed in the "packages" array still includes all
291+
dependencies. Each package definition is intended to be an unaltered
292+
reproduction of the information within <code>Cargo.toml</code>.</p>
293+
</div>
294+
</dd>
282295
</dl>
283296
</div>
284297
</div>

src/etc/man/cargo-metadata.1

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
.\" Title: cargo-metadata
33
.\" Author: [see the "AUTHOR(S)" section]
44
.\" Generator: Asciidoctor 2.0.10
5-
.\" Date: 2019-09-17
5+
.\" Date: 2019-10-28
66
.\" Manual: \ \&
77
.\" Source: \ \&
88
.\" Language: English
99
.\"
10-
.TH "CARGO\-METADATA" "1" "2019-09-17" "\ \&" "\ \&"
10+
.TH "CARGO\-METADATA" "1" "2019-10-28" "\ \&" "\ \&"
1111
.ie \n(.g .ds Aq \(aq
1212
.el .ds Aq '
1313
.ss \n[.ss] 0
@@ -223,6 +223,9 @@ The output has the following format:
223223
/* The resolved dependency graph, with the concrete versions and features
224224
selected. The set depends on the enabled features.
225225
This is null if \-\-no\-deps is specified.
226+
By default, this includes all dependencies for all target platforms.
227+
The `\-\-filter\-platform` flag may be used to narrow to a specific
228+
target triple.
226229
*/
227230
"resolve": {
228231
/* Array of nodes within the dependency graph.
@@ -288,6 +291,16 @@ dependencies.
288291
Specify the version of the output format to use. Currently \fB1\fP is the only
289292
possible value.
290293
.RE
294+
.sp
295+
\fB\-\-filter\-platform\fP \fITRIPLE\fP
296+
.RS 4
297+
This filters the \fBresolve\fP output to only include dependencies for the
298+
given target triple. Without this flag, the resolve includes all targets.
299+
.sp
300+
Note that the dependencies listed in the "packages" array still includes all
301+
dependencies. Each package definition is intended to be an unaltered
302+
reproduction of the information within \fBCargo.toml\fP.
303+
.RE
291304
.SS "Feature Selection"
292305
.sp
293306
When no feature options are given, the \fBdefault\fP feature is activated for

0 commit comments

Comments
 (0)