@@ -305,7 +305,7 @@ async function deleteFiles(previousFiles, updatedFiles, sandbox) {
305
305
}
306
306
307
307
// Sync list of files to the sandbox
308
- async function syncFiles ( files , sandbox , writePerm ) {
308
+ async function syncFiles ( files , sandbox , writePerm , directSync ) {
309
309
console . error ( `+ Syncing ${ files . length } files & folders...` )
310
310
const startTime = perf_hooks . performance . now ( )
311
311
@@ -327,10 +327,15 @@ async function syncFiles(files, sandbox, writePerm) {
327
327
)
328
328
}
329
329
330
+ let otherFilesSrcDir = RUNFILES_ROOT
331
+ if ( directSync ) {
332
+ otherFilesSrcDir = process . env . BUILD_WORKSPACE_DIRECTORY
333
+ }
334
+
330
335
let totalSynced = (
331
336
await Promise . all (
332
337
otherFiles . map ( async ( file ) => {
333
- const src = path . join ( RUNFILES_ROOT , file )
338
+ const src = path . join ( otherFilesSrcDir , file )
334
339
const dst = path . join ( sandbox , file )
335
340
return await syncRecursive ( src , dst , sandbox , writePerm )
336
341
} )
@@ -460,11 +465,13 @@ async function main(args, sandbox) {
460
465
async function processChunk ( chunk ) {
461
466
try {
462
467
const chunkString = chunk . toString ( )
463
- if ( chunkString . includes ( 'IBAZEL_BUILD_COMPLETED SUCCESS' ) ) {
464
- if ( process . env . JS_BINARY__LOG_DEBUG ) {
465
- console . error ( 'IBAZEL_BUILD_COMPLETED SUCCESS' )
466
- }
467
-
468
+ const triggerSync = chunkString . includes ( 'IBAZEL_BUILD_COMPLETED SUCCESS' ) || ( chunkString . includes ( 'IBAZEL_BUILD_STARTED' ) && config . direct_sync )
469
+
470
+ if ( process . env . JS_BINARY__LOG_DEBUG ) {
471
+ console . error ( chunkString )
472
+ }
473
+
474
+ if ( triggerSync ) {
468
475
const oldFiles = config . data_files
469
476
470
477
// Re-parse the config file to get the latest list of data files to copy
@@ -483,16 +490,13 @@ async function main(args, sandbox) {
483
490
syncFiles (
484
491
updatedDataFiles ,
485
492
sandbox ,
486
- config . grant_sandbox_write_permissions
493
+ config . grant_sandbox_write_permissions ,
494
+ config . direct_sync ,
487
495
) ,
488
496
] )
489
497
490
498
// The latest state of copied data files
491
499
config . data_files = updatedDataFiles
492
- } else if ( chunkString . includes ( 'IBAZEL_BUILD_STARTED' ) ) {
493
- if ( process . env . JS_BINARY__LOG_DEBUG ) {
494
- console . error ( 'IBAZEL_BUILD_STARTED' )
495
- }
496
500
}
497
501
498
502
// Forward stdin to the subprocess. See comment about
0 commit comments