@@ -96,7 +96,6 @@ class NativeAssetsBuildRunner {
96
96
required OS targetOS,
97
97
required BuildMode buildMode,
98
98
required Uri workingDirectory,
99
- required bool includeParentEnvironment,
100
99
PackageLayout ? packageLayout,
101
100
String ? runPackageName,
102
101
required List <String > supportedAssetTypes,
@@ -165,7 +164,6 @@ class NativeAssetsBuildRunner {
165
164
buildValidator (config as BuildConfig , output as BuildOutput ),
166
165
packageLayout.packageConfigUri,
167
166
workingDirectory,
168
- includeParentEnvironment,
169
167
null ,
170
168
packageLayout,
171
169
);
@@ -205,7 +203,6 @@ class NativeAssetsBuildRunner {
205
203
required BuildMode buildMode,
206
204
required Uri workingDirectory,
207
205
required ApplicationAssetValidator applicationAssetValidator,
208
- required bool includeParentEnvironment,
209
206
PackageLayout ? packageLayout,
210
207
Uri ? resourceIdentifiers,
211
208
String ? runPackageName,
@@ -269,7 +266,6 @@ class NativeAssetsBuildRunner {
269
266
linkValidator (config as LinkConfig , output as LinkOutput ),
270
267
packageLayout.packageConfigUri,
271
268
workingDirectory,
272
- includeParentEnvironment,
273
269
resourceIdentifiers,
274
270
packageLayout,
275
271
);
@@ -330,7 +326,6 @@ class NativeAssetsBuildRunner {
330
326
required OS targetOS,
331
327
required Uri workingDirectory,
332
328
required bool linkingEnabled,
333
- required bool includeParentEnvironment,
334
329
PackageLayout ? packageLayout,
335
330
String ? runPackageName,
336
331
required List <String > supportedAssetTypes,
@@ -341,7 +336,6 @@ class NativeAssetsBuildRunner {
341
336
validator: (HookConfig config, HookOutput output) =>
342
337
buildValidator (config as BuildConfig , output as BuildOutput ),
343
338
workingDirectory: workingDirectory,
344
- includeParentEnvironment: includeParentEnvironment,
345
339
packageLayout: packageLayout,
346
340
runPackageName: runPackageName,
347
341
supportedAssetTypes: supportedAssetTypes,
@@ -353,7 +347,6 @@ class NativeAssetsBuildRunner {
353
347
required _HookValidator validator,
354
348
required OS targetOS,
355
349
required Uri workingDirectory,
356
- required bool includeParentEnvironment,
357
350
PackageLayout ? packageLayout,
358
351
String ? runPackageName,
359
352
required bool linkingEnabled,
@@ -420,7 +413,6 @@ class NativeAssetsBuildRunner {
420
413
config.packageRoot.resolve ('hook/${hook .scriptName }' ),
421
414
packageConfigUri,
422
415
workingDirectory,
423
- includeParentEnvironment,
424
416
);
425
417
if (! compileSuccess) return null ;
426
418
@@ -438,7 +430,6 @@ class NativeAssetsBuildRunner {
438
430
validator,
439
431
packageConfigUri,
440
432
workingDirectory,
441
- includeParentEnvironment,
442
433
null ,
443
434
hookKernelFile,
444
435
packageLayout! ,
@@ -450,18 +441,16 @@ class NativeAssetsBuildRunner {
450
441
return hookResult;
451
442
}
452
443
453
- // TODO(https://github.com/dart-lang/native/issues/32): Rerun hook if
454
- // environment variables change.
455
444
Future <HookOutput ?> _runHookForPackageCached (
456
445
Hook hook,
457
446
HookConfig config,
458
447
_HookValidator validator,
459
448
Uri packageConfigUri,
460
449
Uri workingDirectory,
461
- bool includeParentEnvironment,
462
450
Uri ? resources,
463
451
PackageLayout packageLayout,
464
452
) async {
453
+ final environment = Platform .environment;
465
454
final outDir = config.outputDirectory;
466
455
return await runUnderDirectoriesLock (
467
456
[
@@ -481,7 +470,6 @@ class NativeAssetsBuildRunner {
481
470
config.packageRoot.resolve ('hook/${hook .scriptName }' ),
482
471
packageConfigUri,
483
472
workingDirectory,
484
- includeParentEnvironment,
485
473
);
486
474
if (! compileSuccess) {
487
475
return null ;
@@ -510,9 +498,10 @@ ${e.message}
510
498
''' );
511
499
return null ;
512
500
}
513
- final outdatedFile =
514
- await dependenciesHashes.findOutdatedFileSystemEntity ();
515
- if (outdatedFile == null ) {
501
+
502
+ final outdatedDependency =
503
+ await dependenciesHashes.findOutdatedDependency (environment);
504
+ if (outdatedDependency == null ) {
516
505
logger.info (
517
506
'Skipping ${hook .name } for ${config .packageName }'
518
507
' in ${outDir .toFilePath ()}.'
@@ -524,8 +513,7 @@ ${e.message}
524
513
}
525
514
logger.info (
526
515
'Rerunning ${hook .name } for ${config .packageName }'
527
- ' in ${outDir .toFilePath ()}.'
528
- ' ${outdatedFile .toFilePath ()} changed.' ,
516
+ ' in ${outDir .toFilePath ()}. $outdatedDependency ' ,
529
517
);
530
518
}
531
519
@@ -535,7 +523,6 @@ ${e.message}
535
523
validator,
536
524
packageConfigUri,
537
525
workingDirectory,
538
- includeParentEnvironment,
539
526
resources,
540
527
hookKernelFile,
541
528
packageLayout,
@@ -545,14 +532,14 @@ ${e.message}
545
532
await dependenciesHashFile.delete ();
546
533
}
547
534
} else {
548
- final modifiedDuringBuild =
549
- await dependenciesHashes.hashFilesAndDirectories (
535
+ final modifiedDuringBuild = await dependenciesHashes.hashDependencies (
550
536
[
551
537
...result.dependencies,
552
538
// Also depend on the hook source code.
553
539
hookHashesFile.uri,
554
540
],
555
- validBeforeLastModified: lastModifiedCutoffTime,
541
+ lastModifiedCutoffTime,
542
+ environment,
556
543
);
557
544
if (modifiedDuringBuild != null ) {
558
545
logger.severe ('File modified during build. Build must be rerun.' );
@@ -569,7 +556,6 @@ ${e.message}
569
556
_HookValidator validator,
570
557
Uri packageConfigUri,
571
558
Uri workingDirectory,
572
- bool includeParentEnvironment,
573
559
Uri ? resources,
574
560
File hookKernelFile,
575
561
PackageLayout packageLayout,
@@ -597,7 +583,6 @@ ${e.message}
597
583
executable: dartExecutable,
598
584
arguments: arguments,
599
585
logger: logger,
600
- includeParentEnvironment: includeParentEnvironment,
601
586
);
602
587
603
588
var deleteOutputIfExists = false ;
@@ -680,8 +665,8 @@ ${e.message}
680
665
Uri scriptUri,
681
666
Uri packageConfigUri,
682
667
Uri workingDirectory,
683
- bool includeParentEnvironment,
684
668
) async {
669
+ final environment = Platform .environment;
685
670
final kernelFile = File .fromUri (
686
671
outputDirectory.resolve ('../hook.dill' ),
687
672
);
@@ -697,13 +682,12 @@ ${e.message}
697
682
if (! await dependenciesHashFile.exists ()) {
698
683
mustCompile = true ;
699
684
} else {
700
- final outdatedFile =
701
- await dependenciesHashes.findOutdatedFileSystemEntity ( );
702
- if (outdatedFile != null ) {
685
+ final outdatedDependency =
686
+ await dependenciesHashes.findOutdatedDependency (environment );
687
+ if (outdatedDependency != null ) {
703
688
mustCompile = true ;
704
689
logger.info (
705
- 'Recompiling ${scriptUri .toFilePath ()}, '
706
- '${outdatedFile .toFilePath ()} changed.' ,
690
+ 'Recompiling ${scriptUri .toFilePath ()}. $outdatedDependency ' ,
707
691
);
708
692
}
709
693
}
@@ -717,7 +701,6 @@ ${e.message}
717
701
scriptUri,
718
702
packageConfigUri,
719
703
workingDirectory,
720
- includeParentEnvironment,
721
704
kernelFile,
722
705
depFile,
723
706
);
@@ -727,14 +710,14 @@ ${e.message}
727
710
}
728
711
729
712
final dartSources = await _readDepFile (depFile);
730
- final modifiedDuringBuild =
731
- await dependenciesHashes.hashFilesAndDirectories (
713
+ final modifiedDuringBuild = await dependenciesHashes.hashDependencies (
732
714
[
733
715
...dartSources,
734
716
// If the Dart version changed, recompile.
735
717
dartExecutable.resolve ('../version' ),
736
718
],
737
- validBeforeLastModified: lastModifiedCutoffTime,
719
+ lastModifiedCutoffTime,
720
+ environment,
738
721
);
739
722
if (modifiedDuringBuild != null ) {
740
723
logger.severe ('File modified during build. Build must be rerun.' );
@@ -760,7 +743,6 @@ ${e.message}
760
743
Uri scriptUri,
761
744
Uri packageConfigUri,
762
745
Uri workingDirectory,
763
- bool includeParentEnvironment,
764
746
File kernelFile,
765
747
File depFile,
766
748
) async {
@@ -777,7 +759,6 @@ ${e.message}
777
759
executable: dartExecutable,
778
760
arguments: compileArguments,
779
761
logger: logger,
780
- includeParentEnvironment: includeParentEnvironment,
781
762
);
782
763
var success = true ;
783
764
if (compileResult.exitCode != 0 ) {
0 commit comments