File tree 3 files changed +25
-5
lines changed 3 files changed +25
-5
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ use serde::Serialize;
19
19
use tracing:: debug;
20
20
21
21
use crate :: core:: compiler:: { CompileKind , RustcTargetData } ;
22
- use crate :: core:: dependency:: DepKind ;
22
+ use crate :: core:: dependency:: { ArtifactKind , DepKind } ;
23
23
use crate :: core:: resolver:: features:: ForceAllTargets ;
24
24
use crate :: core:: resolver:: { HasDevUnits , Resolve } ;
25
25
use crate :: core:: {
@@ -167,6 +167,14 @@ impl Package {
167
167
pub fn proc_macro ( & self ) -> bool {
168
168
self . targets ( ) . iter ( ) . any ( |target| target. proc_macro ( ) )
169
169
}
170
+ // TODO fix this. For now, just wanted it to return a plausible value. Must figure out why .kinds() returns a Vec.
171
+ /// Gets crate-type in { .., artifact = <crate-type> } of this package
172
+ pub fn artifact_kind ( & self ) -> Option < & ArtifactKind > {
173
+ let found = self . dependencies ( ) . iter ( ) . find_map ( |dep| dep. artifact ( ) ) ;
174
+
175
+ // TODO for now just returns the first ArtifactKind in the Vec<ArtifactKind>
176
+ found?. kinds ( ) . iter ( ) . next ( )
177
+ }
170
178
/// Gets the package's minimum Rust version.
171
179
pub fn rust_version ( & self ) -> Option < & RustVersion > {
172
180
self . manifest ( ) . rust_version ( )
Original file line number Diff line number Diff line change @@ -75,12 +75,21 @@ impl<'a> fmt::Display for Display<'a> {
75
75
} else {
76
76
""
77
77
} ;
78
+ // TODO this is probably NOT the right way to get the ArtifactKind
79
+ //
80
+ let artifact_suffix =
81
+ if let Some ( artifact_kind) = package. artifact_kind ( ) {
82
+ format ! ( " ({})" , artifact_kind. crate_type( ) )
83
+ } else {
84
+ "" . to_string ( )
85
+ } ;
78
86
write ! (
79
87
fmt,
80
- "{} v{}{}" ,
88
+ "{} v{}{}{} " ,
81
89
package. name( ) ,
82
90
package. version( ) ,
83
- proc_macro_suffix
91
+ proc_macro_suffix,
92
+ artifact_suffix,
84
93
) ?;
85
94
86
95
let source_id = package. package_id ( ) . source_id ( ) ;
Original file line number Diff line number Diff line change @@ -1521,7 +1521,7 @@ fn dependencies_of_dependencies_work_in_artifacts() {
1521
1521
. with_stdout_data ( str![ [ r#"
1522
1522
foo v0.0.0 ([ROOT]/foo)
1523
1523
[build-dependencies]
1524
- └── bar v0.5.0 ([ROOT]/foo/bar)
1524
+ └── bar v0.5.0 (bin) ( [ROOT]/foo/bar)
1525
1525
└── baz v1.0.0
1526
1526
1527
1527
"# ] ] )
@@ -1572,13 +1572,16 @@ fn artifact_dep_target_specified() {
1572
1572
. masquerade_as_nightly_cargo ( & [ "bindeps" ] )
1573
1573
. with_stdout_data ( str![ [ r#"
1574
1574
foo v0.0.0 ([ROOT]/foo)
1575
- └── bindep v0.0.0 ([ROOT]/foo/bindep)
1575
+ └── bindep v0.0.0 (bin) ( [ROOT]/foo/bindep)
1576
1576
1577
1577
"# ] ] )
1578
1578
. with_status ( 0 )
1579
1579
. run ( ) ;
1580
1580
}
1581
1581
1582
+ // TODO
1583
+ // fn tree_suffix_bin_cdlib_staticlib() {}
1584
+
1582
1585
/// From issue #10061
1583
1586
/// The case where:
1584
1587
/// * artifact dep is { target = <specified> }
You can’t perform that action at this time.
0 commit comments