@@ -434,15 +434,17 @@ async fn do_wrap_rustc(
434
434
// --mount=type=bind,source=Cargo.toml,target=Cargo.toml \
435
435
// --mount=type=bind,source=Cargo.lock,target=Cargo.lock \
436
436
437
- let cwd = Temp :: new_dir ( ) . map_err ( |e| anyhow ! ( "Failed to create tmpdir 'cwd': {e}" ) ) ?;
437
+ // let cwd = Temp::new_dir().map_err(|e| anyhow!("Failed to create tmpdir 'cwd': {e}"))?;
438
+ let cwd = std:: env:: temp_dir ( ) . join ( & metadata) ;
439
+ std:: fs:: create_dir_all ( & cwd) . unwrap ( ) ;
438
440
let Some ( cwd_path) = Utf8Path :: from_path ( cwd. as_path ( ) ) else {
439
441
bail ! ( "Path's UTF-8 encoding is corrupted: {cwd:?}" )
440
442
} ;
441
443
442
444
// TODO: use tmpfs when on *NIX
443
445
// TODO: cache these folders
444
446
if pwd. join ( ".git" ) . is_dir ( ) {
445
- log:: info!( target: & krate, "copying all git files under {}" , pwd . join ( ".git" ) ) ;
447
+ log:: info!( target: & krate, "copying all git files under {pwd} to {cwd_path}" ) ;
446
448
// TODO: rust git crate?
447
449
// TODO: --mount=bind each file one by one => drop temp dir ctx
448
450
let mut cmd = Command :: new ( "git" ) ;
@@ -463,7 +465,7 @@ async fn do_wrap_rustc(
463
465
copy_files ( f, cwd_path) ?;
464
466
}
465
467
} else {
466
- log:: info!( target: & krate, "copying all files under {pwd}" ) ;
468
+ log:: info!( target: & krate, "copying all files under {pwd} to {cwd_path} " ) ;
467
469
copy_files ( & pwd, cwd_path) ?;
468
470
}
469
471
@@ -478,6 +480,7 @@ async fn do_wrap_rustc(
478
480
// 0 0s debug HEAD λ cat rustcbuildx.d
479
481
// $target_dir/debug/rustcbuildx: $cwd/src/cli.rs $cwd/src/cratesio.rs $cwd/src/envs.rs $cwd/src/main.rs $cwd/src/md.rs $cwd/src/parse.rs $cwd/src/pops.rs $cwd/src/runner.rs $cwd/src/stage.rs
480
482
rustc_block. push_str ( & format ! ( "WORKDIR {pwd}\n " ) ) ;
483
+ // rustc_block.push_str("COPY --from={rustc_stage} / .\n");
481
484
rustc_block. push_str ( "COPY --from=cwd / .\n " ) ;
482
485
rustc_block. push_str ( "RUN \\ \n " ) ;
483
486
@@ -494,13 +497,18 @@ async fn do_wrap_rustc(
494
497
input_mount. and_then ( |( name, src, target) | {
495
498
src. is_none ( ) . then_some ( ( name. to_string ( ) , target. to_string ( ) ) )
496
499
} ) ,
500
+ // cwd.as_ref().map(|(_, cwd_path)| (rustc_stage.to_string(), cwd_path.to_string())),
497
501
cwd. as_ref ( ) . map ( |( _, cwd) | ( "cwd" . to_owned ( ) , cwd. to_string ( ) ) ) ,
498
502
crate_out. map ( |crate_out| ( crate_out_name ( & crate_out) , crate_out) ) ,
499
503
]
500
504
. into_iter ( )
501
505
. flatten ( )
502
506
. map ( |( name, uri) | BuildContext { name, uri } )
503
507
. collect ( ) ;
508
+ log:: info!( target: & krate, "loading {} Docker contexts" , md. contexts. len( ) ) ;
509
+ for BuildContext { name, uri } in & md. contexts {
510
+ log:: info!( target: & krate, "loading {name:?}: {uri}" ) ;
511
+ }
504
512
505
513
log:: debug!( target: & krate, "all_externs = {all_externs:?}" ) ;
506
514
if externs. len ( ) > all_externs. len ( ) {
0 commit comments