File tree Expand file tree Collapse file tree 5 files changed +26
-16
lines changed Expand file tree Collapse file tree 5 files changed +26
-16
lines changed Original file line number Diff line number Diff line change @@ -362,6 +362,7 @@ possible value.
362362{{#option "`--filter-platform` _triple_" }}
363363This filters the `resolve` output to only include dependencies for the
364364given [target triple](../appendix/glossary.html#target).
365+ A literal `"host-tuple"` can be used, which will internally be substituted by the host' s target.
365366Without this flag, the resolve includes all targets.
366367
367368Note that the dependencies listed in the " packages" array still includes all
Original file line number Diff line number Diff line change @@ -354,8 +354,10 @@ OPTIONS
354354 --filter-platform triple
355355 This filters the resolve output to only include dependencies for the
356356 given target triple
357- <https://doc.rust-lang.org/cargo/appendix/glossary.html#target>.
358- Without this flag, the resolve includes all targets.
357+ <https://doc.rust-lang.org/cargo/appendix/glossary.html#target>. A
358+ literal "host-tuple" can be used, which will internally be
359+ substituted by the host’s target. Without this flag, the resolve
360+ includes all targets.
359361
360362 Note that the dependencies listed in the “packages” array still
361363 includes all dependencies. Each package definition is intended to be
Original file line number Diff line number Diff line change @@ -364,6 +364,7 @@ possible value.</p>
364364< dt class = " option-term" id= " option-cargo-metadata---filter-platform" >< a class = " option-anchor" href= " #option-cargo-metadata---filter-platform" >< code> -- filter- platform< / code> < em> triple< / em>< / a>< / dt>
365365< dd class = " option-desc" >< p> This filters the < code> resolve< / code> output to only include dependencies for the
366366given < a href= " ../appendix/glossary.html#target" > target triple< / a> .
367+ A literal < code> " host-tuple" < / code> can be used, which will internally be substituted by the host’s target.
367368Without this flag, the resolve includes all targets.< / p>
368369< p> Note that the dependencies listed in the “packages” array still includes all
369370dependencies . Each package definition is intended to be an unaltered
Original file line number Diff line number Diff line change @@ -367,6 +367,7 @@ possible value.
367367.RS 4
368368This filters the \fB resolve \fR output to only include dependencies for the
369369given \fI target triple \fR <https://doc.rust\- lang.org/cargo/appendix/glossary.html#target>\& .
370+ A literal \fB "host \- tuple" \fR can be used, which will internally be substituted by the host\[cq ] s target.
370371Without this flag, the resolve includes all targets.
371372.sp
372373Note that the dependencies listed in the \[lq ] packages\[rq ] array still includes all
Original file line number Diff line number Diff line change @@ -3842,21 +3842,15 @@ fn filter_platform() {
38423842 . run ( ) ;
38433843 clear ( ) ;
38443844
3845- // Filter on host, removes alt and cfg.
3846- p. cargo ( "metadata --filter-platform" )
3847- . arg ( & host_target)
3848- . with_stderr_data (
3849- str![ [ r#"
3845+ let host_filtered_stderr = str![ [ r#"
38503846[WARNING] please specify `--format-version` flag explicitly to avoid compatibility problems
38513847[DOWNLOADING] crates ...
38523848[DOWNLOADED] normal-dep v0.0.1 (registry `dummy-registry`)
38533849[DOWNLOADED] host-dep v0.0.1 (registry `dummy-registry`)
38543850
3855- "# ] ]
3856- . unordered ( ) ,
3857- )
3858- . with_stdout_data (
3859- str![ [ r#"
3851+ "# ] ] ;
3852+
3853+ let host_filtered_stdout = str![ [ r#"
38603854{
38613855 "packages": [
38623856 {
@@ -3945,10 +3939,21 @@ fn filter_platform() {
39453939 },
39463940 "...": "{...}"
39473941}
3948- "# ] ]
3949- . is_json ( )
3950- . unordered ( ) ,
3951- )
3942+ "# ] ] ;
3943+
3944+ // Filter on host, removes alt and cfg.
3945+ p. cargo ( "metadata --filter-platform" )
3946+ . arg ( & host_target)
3947+ . with_stderr_data ( host_filtered_stderr. clone ( ) . unordered ( ) )
3948+ . with_stdout_data ( host_filtered_stdout. clone ( ) . is_json ( ) . unordered ( ) )
3949+ . run ( ) ;
3950+ clear ( ) ;
3951+
3952+ // Filter on host-tuple, should produce same result as explicit host target.
3953+ p. cargo ( "metadata --filter-platform" )
3954+ . arg ( "host-tuple" )
3955+ . with_stderr_data ( host_filtered_stderr. unordered ( ) )
3956+ . with_stdout_data ( host_filtered_stdout. is_json ( ) . unordered ( ) )
39523957 . run ( ) ;
39533958 clear ( ) ;
39543959
You can’t perform that action at this time.
0 commit comments