Fix inputs and outputs for WebReleaseBundle (#143023)
Since `WebReleaseBundle` is responsible for copying over the outputs from the subtargets, so it needs to be reflected in inputs and outputs so that things will be recopied when something changes.
This commit is contained in:
@@ -220,6 +220,35 @@ void main() {
|
||||
));
|
||||
}));
|
||||
|
||||
test('WebReleaseBundle copies over output files when they change', () => testbed.run(() async {
|
||||
final Directory webResources = environment.projectDir.childDirectory('web');
|
||||
webResources.childFile('foo.txt')
|
||||
..createSync(recursive: true)
|
||||
..writeAsStringSync('A');
|
||||
|
||||
environment.buildDir.childFile('main.dart.wasm')..createSync()..writeAsStringSync('old wasm');
|
||||
environment.buildDir.childFile('main.dart.mjs')..createSync()..writeAsStringSync('old mjs');
|
||||
await WebReleaseBundle(<WebCompilerConfig>[
|
||||
const WasmCompilerConfig()
|
||||
]).build(environment);
|
||||
expect(environment.outputDir.childFile('main.dart.wasm')
|
||||
.readAsStringSync(), 'old wasm');
|
||||
expect(environment.outputDir.childFile('main.dart.mjs')
|
||||
.readAsStringSync(), 'old mjs');
|
||||
|
||||
environment.buildDir.childFile('main.dart.wasm')..createSync()..writeAsStringSync('new wasm');
|
||||
environment.buildDir.childFile('main.dart.mjs')..createSync()..writeAsStringSync('new mjs');
|
||||
|
||||
await WebReleaseBundle(<WebCompilerConfig>[
|
||||
const WasmCompilerConfig()
|
||||
]).build(environment);
|
||||
|
||||
expect(environment.outputDir.childFile('main.dart.wasm')
|
||||
.readAsStringSync(), 'new wasm');
|
||||
expect(environment.outputDir.childFile('main.dart.mjs')
|
||||
.readAsStringSync(), 'new mjs');
|
||||
}));
|
||||
|
||||
test('WebEntrypointTarget generates an entrypoint for a file outside of main', () => testbed.run(() async {
|
||||
final File mainFile = globals.fs.file(globals.fs.path.join('other', 'lib', 'main.dart'))
|
||||
..createSync(recursive: true)
|
||||
|
||||
Reference in New Issue
Block a user