Inline buildScriptSnapshot calls (#16940)

This commit is contained in:
Chris Bracken 2018-04-24 16:07:14 -07:00 committed by GitHub
parent 993f3947da
commit f570e046c9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -375,15 +375,6 @@ void main() {
}));
}
Future<Null> buildScriptSnapshot({ String mainPath = 'main.dart' }) {
return snapshotter.buildScriptSnapshot(
mainPath: mainPath,
snapshotPath: 'output.snapshot',
depfilePath: 'output.snapshot.d',
packagesPath: '.packages',
);
}
void expectFingerprintHas({
String entryPoint: 'main.dart',
Map<String, String> checksums = const <String, String>{},
@ -402,7 +393,12 @@ void main() {
await fs.file('main.dart').writeAsString('void main() {}');
await fs.file('output.snapshot').create();
await fs.file('output.snapshot.d').writeAsString('snapshot : main.dart');
await buildScriptSnapshot();
await snapshotter.buildScriptSnapshot(
mainPath: 'main.dart',
snapshotPath: 'output.snapshot',
depfilePath: 'output.snapshot.d',
packagesPath: '.packages',
);
expect(genSnapshot.callCount, 1);
expect(genSnapshot.snapshotType.platform, isNull);
@ -431,7 +427,12 @@ void main() {
'main.dart': '27f5ebf0f8c559b2af9419d190299a5e',
'output.snapshot': 'deadbeef000b204e9800998ecaaaaa',
});
await buildScriptSnapshot();
await snapshotter.buildScriptSnapshot(
mainPath: 'main.dart',
snapshotPath: 'output.snapshot',
depfilePath: 'output.snapshot.d',
packagesPath: '.packages',
);
expect(genSnapshot.callCount, 1);
expectFingerprintHas(checksums: <String, String>{
@ -447,7 +448,12 @@ void main() {
'main.dart': '27f5ebf0f8c559b2af9419d190299a5e',
'output.snapshot': 'd41d8cd98f00b204e9800998ecf8427e',
});
await buildScriptSnapshot();
await snapshotter.buildScriptSnapshot(
mainPath: 'main.dart',
snapshotPath: 'output.snapshot',
depfilePath: 'output.snapshot.d',
packagesPath: '.packages',
);
expect(genSnapshot.callCount, 1);
expectFingerprintHas(checksums: <String, String>{
@ -476,7 +482,12 @@ void main() {
'other.dart': 'e0c35f083f0ad76b2d87100ec678b516',
'output.snapshot': 'd41d8cd98f00b204e9800998ecf8427e',
});
await buildScriptSnapshot(mainPath: 'other.dart');
await snapshotter.buildScriptSnapshot(
mainPath: 'other.dart',
snapshotPath: 'output.snapshot',
depfilePath: 'output.snapshot.d',
packagesPath: '.packages',
);
expect(genSnapshot.callCount, 1);
expectFingerprintHas(
@ -499,7 +510,12 @@ void main() {
'main.dart': '27f5ebf0f8c559b2af9419d190299a5e',
'output.snapshot': 'd41d8cd98f00b204e9800998ecf8427e',
});
await buildScriptSnapshot();
await snapshotter.buildScriptSnapshot(
mainPath: 'main.dart',
snapshotPath: 'output.snapshot',
depfilePath: 'output.snapshot.d',
packagesPath: '.packages',
);
expect(genSnapshot.callCount, 0);
expectFingerprintHas(checksums: <String, String>{