File tree Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change 11use std:: io;
2+ use std:: path:: Path ;
23use std:: process:: ExitStatus ;
34
45use super :: shared:: * ;
6+ use crate :: cross_toml:: CargoConfigBehavior ;
57use crate :: errors:: Result ;
68use crate :: extensions:: CommandExt ;
79use crate :: file:: { PathExt , ToUtf8 } ;
@@ -66,6 +68,25 @@ pub(crate) fn run(
6668 ] ) ;
6769 }
6870
71+ // If we're using all config settings, we need to mount all `.cargo` dirs.
72+ // We've already mounted the CWD, so start at the parents.
73+ let mut host_cwd = paths. cwd . parent ( ) ;
74+ let mut mount_cwd = Path :: new ( & paths. directories . mount_cwd ) . parent ( ) ;
75+ if let CargoConfigBehavior :: Complete = options. cargo_config_behavior {
76+ while let ( Some ( host) , Some ( mount) ) = ( host_cwd, mount_cwd) {
77+ let host_cargo = host. join ( ".cargo" ) ;
78+ let mount_cargo = mount. join ( ".cargo" ) ;
79+ if host_cargo. exists ( ) {
80+ docker. args ( & [
81+ "-v" ,
82+ & format ! ( "{}:{}:Z" , host_cargo. to_utf8( ) ?, mount_cargo. as_posix( ) ?) ,
83+ ] ) ;
84+ }
85+ host_cwd = host. parent ( ) ;
86+ mount_cwd = mount. parent ( ) ;
87+ }
88+ }
89+
6990 if io:: Stdin :: is_atty ( ) {
7091 docker. arg ( "-i" ) ;
7192 if io:: Stdout :: is_atty ( ) && io:: Stderr :: is_atty ( ) {
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ use super::engine::Engine;
1111use super :: shared:: * ;
1212use crate :: cargo:: CargoMetadata ;
1313use crate :: config:: bool_from_envvar;
14+ use crate :: cross_toml:: CargoConfigBehavior ;
1415use crate :: errors:: Result ;
1516use crate :: extensions:: CommandExt ;
1617use crate :: file:: { self , PathExt , ToUtf8 } ;
@@ -1046,6 +1047,13 @@ pub(crate) fn run(
10461047 )
10471048 . wrap_err ( "when copying project" ) ?;
10481049
1050+ // If we're using all config settings, write the combined
1051+ // config file to a fixed location (to avoid it becoming stale).
1052+ if let CargoConfigBehavior :: Complete = options. cargo_config_behavior {
1053+ // TODO(ahuszagh) Need to write the file out.
1054+ todo ! ( ) ;
1055+ }
1056+
10491057 let mut copied = vec ! [
10501058 ( & dirs. xargo, mount_prefix_path. join( "xargo" ) ) ,
10511059 ( & dirs. cargo, mount_prefix_path. join( "cargo" ) ) ,
You can’t perform that action at this time.
0 commit comments