@@ -5,7 +5,7 @@ use serde_derive::Deserialize;
5
5
6
6
use crate :: utils:: cache:: INTERNER ;
7
7
use crate :: utils:: helpers:: output;
8
- use crate :: { t, Build , Crate } ;
8
+ use crate :: { t, Build , Config , Crate } ;
9
9
10
10
/// For more information, see the output of
11
11
/// <https://doc.rust-lang.org/nightly/cargo/commands/cargo-metadata.html>
@@ -45,7 +45,7 @@ pub(crate) struct Target {
45
45
/// Collects and stores package metadata of each workspace members into `build`,
46
46
/// by executing `cargo metadata` commands.
47
47
pub fn build ( build : & mut Build ) {
48
- for package in workspace_members ( build) {
48
+ for package in workspace_members ( & build. config ) {
49
49
if package. source . is_none ( ) {
50
50
let name = INTERNER . intern_string ( package. name ) ;
51
51
let mut path = PathBuf :: from ( package. manifest_path ) ;
@@ -74,9 +74,9 @@ pub fn build(build: &mut Build) {
74
74
///
75
75
/// Note that `src/tools/cargo` is no longer a workspace member but we still
76
76
/// treat it as one here, by invoking an additional `cargo metadata` command.
77
- pub ( crate ) fn workspace_members ( build : & Build ) -> impl Iterator < Item = Package > {
77
+ pub ( crate ) fn workspace_members ( config : & Config ) -> impl Iterator < Item = Package > {
78
78
let collect_metadata = |manifest_path| {
79
- let mut cargo = Command :: new ( & build . initial_cargo ) ;
79
+ let mut cargo = Command :: new ( & config . initial_cargo ) ;
80
80
cargo
81
81
// Will read the libstd Cargo.toml
82
82
// which uses the unstable `public-dependency` feature.
@@ -86,7 +86,7 @@ pub(crate) fn workspace_members(build: &Build) -> impl Iterator<Item = Package>
86
86
. arg ( "1" )
87
87
. arg ( "--no-deps" )
88
88
. arg ( "--manifest-path" )
89
- . arg ( build . src . join ( manifest_path) ) ;
89
+ . arg ( config . src . join ( manifest_path) ) ;
90
90
let metadata_output = output ( & mut cargo) ;
91
91
let Output { packages, .. } = t ! ( serde_json:: from_str( & metadata_output) ) ;
92
92
packages
@@ -105,9 +105,9 @@ pub(crate) fn workspace_members(build: &Build) -> impl Iterator<Item = Package>
105
105
}
106
106
107
107
/// Invokes `cargo metadata` to get package metadata of whole workspace including the dependencies.
108
- pub ( crate ) fn project_metadata ( build : & Build ) -> impl Iterator < Item = Package > {
108
+ pub ( crate ) fn project_metadata ( config : & Config ) -> impl Iterator < Item = Package > {
109
109
let collect_metadata = |manifest_path| {
110
- let mut cargo = Command :: new ( & build . initial_cargo ) ;
110
+ let mut cargo = Command :: new ( & config . initial_cargo ) ;
111
111
cargo
112
112
// Will read the libstd Cargo.toml
113
113
// which uses the unstable `public-dependency` feature.
@@ -116,7 +116,7 @@ pub(crate) fn project_metadata(build: &Build) -> impl Iterator<Item = Package> {
116
116
. arg ( "--format-version" )
117
117
. arg ( "1" )
118
118
. arg ( "--manifest-path" )
119
- . arg ( build . src . join ( manifest_path) ) ;
119
+ . arg ( config . src . join ( manifest_path) ) ;
120
120
let metadata_output = output ( & mut cargo) ;
121
121
let Output { packages, .. } = t ! ( serde_json:: from_str( & metadata_output) ) ;
122
122
packages
0 commit comments