Avoid rebuilding snapshots if no change to source (#11551)
This change re-introduces skipping snapshot builds if input sources (and
outputs) have not changed since the last snapshot build, with a bugfix
to include the entry-point source in the checksum used to check whether
rebuild can be skipped. This ensures that the following sequence
invalidates the cached build, resulting in two snapshot builds:
flutter build ios lib/foo.dart
flutter build ios lib/bar.dart
This reverts commit 3d5afb5a81.
This commit is contained in:
@@ -64,4 +64,43 @@ void main() {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
group('readDepfile', () {
|
||||
MemoryFileSystem fs;
|
||||
|
||||
setUp(() {
|
||||
fs = new MemoryFileSystem();
|
||||
});
|
||||
|
||||
testUsingContext('returns one file if only one is listed', () async {
|
||||
await fs.file('a.d').writeAsString('snapshot.d: /foo/a.dart');
|
||||
expect(await readDepfile('a.d'), unorderedEquals(<String>['/foo/a.dart']));
|
||||
}, overrides: <Type, Generator>{ FileSystem: () => fs});
|
||||
|
||||
testUsingContext('returns multiple files', () async {
|
||||
await fs.file('a.d').writeAsString('snapshot.d: /foo/a.dart /foo/b.dart');
|
||||
expect(await readDepfile('a.d'), unorderedEquals(<String>[
|
||||
'/foo/a.dart',
|
||||
'/foo/b.dart',
|
||||
]));
|
||||
}, overrides: <Type, Generator>{ FileSystem: () => fs});
|
||||
|
||||
testUsingContext('trims extra spaces between files', () async {
|
||||
await fs.file('a.d').writeAsString('snapshot.d: /foo/a.dart /foo/b.dart /foo/c.dart');
|
||||
expect(await readDepfile('a.d'), unorderedEquals(<String>[
|
||||
'/foo/a.dart',
|
||||
'/foo/b.dart',
|
||||
'/foo/c.dart',
|
||||
]));
|
||||
}, overrides: <Type, Generator>{ FileSystem: () => fs});
|
||||
|
||||
testUsingContext('returns files with spaces and backslashes', () async {
|
||||
await fs.file('a.d').writeAsString(r'snapshot.d: /foo/a\ a.dart /foo/b\\b.dart /foo/c\\ c.dart');
|
||||
expect(await readDepfile('a.d'), unorderedEquals(<String>[
|
||||
r'/foo/a a.dart',
|
||||
r'/foo/b\b.dart',
|
||||
r'/foo/c\ c.dart',
|
||||
]));
|
||||
}, overrides: <Type, Generator>{ FileSystem: () => fs});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user