@@ -335,6 +335,30 @@ Future<String> _buildAotSnapshot(
335
335
]);
336
336
}
337
337
338
+ final String genSnapshotInputFile = previewDart2 ? kApplicationKernelPath : mainPath;
339
+ final SnapshotType snapshotType = new SnapshotType (platform, buildMode);
340
+ final File fingerprintFile = fs.file ('$dependencies .fingerprint' );
341
+ final List <File > fingerprintFiles = < File > [fingerprintFile, fs.file (dependencies)]
342
+ ..addAll (inputPaths.map (fs.file))
343
+ ..addAll (outputPaths.map (fs.file));
344
+ if (fingerprintFiles.every ((File file) => file.existsSync ())) {
345
+ try {
346
+ final String json = await fingerprintFile.readAsString ();
347
+ final Fingerprint oldFingerprint = new Fingerprint .fromJson (json);
348
+ final Set <String > snapshotInputPaths = await readDepfile (dependencies)
349
+ ..add (genSnapshotInputFile)
350
+ ..addAll (outputPaths);
351
+ final Fingerprint newFingerprint = Snapshotter .createFingerprint (snapshotType, genSnapshotInputFile, snapshotInputPaths);
352
+ if (oldFingerprint == newFingerprint) {
353
+ printStatus ('Skipping AOT snapshot build. Fingerprint match.' );
354
+ return outputPath;
355
+ }
356
+ } catch (e) {
357
+ // Log exception and continue, this step is a performance improvement only.
358
+ printTrace ('Rebuilding snapshot due to fingerprint check error: $e ' );
359
+ }
360
+ }
361
+
338
362
if (previewDart2) {
339
363
mainPath = await compile (
340
364
sdkRoot: artifacts.getArtifactPath (Artifact .flutterPatchedSdkPath),
@@ -358,29 +382,6 @@ Future<String> _buildAotSnapshot(
358
382
359
383
genSnapshotCmd.add (mainPath);
360
384
361
- final SnapshotType snapshotType = new SnapshotType (platform, buildMode);
362
- final File fingerprintFile = fs.file ('$dependencies .fingerprint' );
363
- final List <File > fingerprintFiles = < File > [fingerprintFile, fs.file (dependencies)]
364
- ..addAll (inputPaths.map (fs.file))
365
- ..addAll (outputPaths.map (fs.file));
366
- if (fingerprintFiles.every ((File file) => file.existsSync ())) {
367
- try {
368
- final String json = await fingerprintFile.readAsString ();
369
- final Fingerprint oldFingerprint = new Fingerprint .fromJson (json);
370
- final Set <String > snapshotInputPaths = await readDepfile (dependencies)
371
- ..add (mainPath)
372
- ..addAll (outputPaths);
373
- final Fingerprint newFingerprint = Snapshotter .createFingerprint (snapshotType, mainPath, snapshotInputPaths);
374
- if (oldFingerprint == newFingerprint) {
375
- printStatus ('Skipping AOT snapshot build. Fingerprint match.' );
376
- return outputPath;
377
- }
378
- } catch (e) {
379
- // Log exception and continue, this step is a performance improvement only.
380
- printTrace ('Rebuilding snapshot due to fingerprint check error: $e ' );
381
- }
382
- }
383
-
384
385
final RunResult results = await runAsync (genSnapshotCmd);
385
386
if (results.exitCode != 0 ) {
386
387
printError ('Dart snapshot generator failed with exit code ${results .exitCode }' );
0 commit comments