@@ -5,7 +5,7 @@ use serde_derive::Deserialize;
55
66use crate :: utils:: cache:: INTERNER ;
77use crate :: utils:: helpers:: output;
8- use crate :: { t, Build , Crate } ;
8+ use crate :: { t, Build , Config , Crate } ;
99
1010/// For more information, see the output of
1111/// <https://doc.rust-lang.org/nightly/cargo/commands/cargo-metadata.html>
@@ -45,7 +45,7 @@ pub(crate) struct Target {
4545/// Collects and stores package metadata of each workspace members into `build`,
4646/// by executing `cargo metadata` commands.
4747pub fn build ( build : & mut Build ) {
48- for package in workspace_members ( build) {
48+ for package in workspace_members ( & build. config ) {
4949 if package. source . is_none ( ) {
5050 let name = INTERNER . intern_string ( package. name ) ;
5151 let mut path = PathBuf :: from ( package. manifest_path ) ;
@@ -74,9 +74,9 @@ pub fn build(build: &mut Build) {
7474///
7575/// Note that `src/tools/cargo` is no longer a workspace member but we still
7676/// 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 > {
7878 let collect_metadata = |manifest_path| {
79- let mut cargo = Command :: new ( & build . initial_cargo ) ;
79+ let mut cargo = Command :: new ( & config . initial_cargo ) ;
8080 cargo
8181 // Will read the libstd Cargo.toml
8282 // which uses the unstable `public-dependency` feature.
@@ -86,7 +86,7 @@ pub(crate) fn workspace_members(build: &Build) -> impl Iterator<Item = Package>
8686 . arg ( "1" )
8787 . arg ( "--no-deps" )
8888 . arg ( "--manifest-path" )
89- . arg ( build . src . join ( manifest_path) ) ;
89+ . arg ( config . src . join ( manifest_path) ) ;
9090 let metadata_output = output ( & mut cargo) ;
9191 let Output { packages, .. } = t ! ( serde_json:: from_str( & metadata_output) ) ;
9292 packages
@@ -105,9 +105,9 @@ pub(crate) fn workspace_members(build: &Build) -> impl Iterator<Item = Package>
105105}
106106
107107/// 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 > {
109109 let collect_metadata = |manifest_path| {
110- let mut cargo = Command :: new ( & build . initial_cargo ) ;
110+ let mut cargo = Command :: new ( & config . initial_cargo ) ;
111111 cargo
112112 // Will read the libstd Cargo.toml
113113 // which uses the unstable `public-dependency` feature.
@@ -116,7 +116,7 @@ pub(crate) fn project_metadata(build: &Build) -> impl Iterator<Item = Package> {
116116 . arg ( "--format-version" )
117117 . arg ( "1" )
118118 . arg ( "--manifest-path" )
119- . arg ( build . src . join ( manifest_path) ) ;
119+ . arg ( config . src . join ( manifest_path) ) ;
120120 let metadata_output = output ( & mut cargo) ;
121121 let Output { packages, .. } = t ! ( serde_json:: from_str( & metadata_output) ) ;
122122 packages
0 commit comments