mirror of
https://github.com/flutter/flutter
synced 2024-08-27 12:00:58 +00:00
Invalidate the WebStaticAssets
target if the web sdk changes. (#123739)
Invalidate the `WebStaticAssets` target if the web sdk changes.
This commit is contained in:
parent
06f015a8c0
commit
b57c59b4a7
|
@ -494,8 +494,8 @@ class WebReleaseBundle extends Target {
|
|||
/// Static assets provided by the Flutter SDK that do not change, such as
|
||||
/// CanvasKit.
|
||||
///
|
||||
/// These assets can be cached forever and are only invalidated when the
|
||||
/// Flutter SDK is upgraded to a new version.
|
||||
/// These assets can be cached until a new version of the flutter web sdk is
|
||||
/// downloaded.
|
||||
class WebBuiltInAssets extends Target {
|
||||
const WebBuiltInAssets(this.fileSystem, {required this.isWasm});
|
||||
|
||||
|
@ -512,7 +512,9 @@ class WebBuiltInAssets extends Target {
|
|||
List<String> get depfiles => const <String>[];
|
||||
|
||||
@override
|
||||
List<Source> get inputs => const <Source>[];
|
||||
List<Source> get inputs => const <Source>[
|
||||
Source.hostArtifact(HostArtifact.flutterWebSdk),
|
||||
];
|
||||
|
||||
@override
|
||||
List<Source> get outputs => const <Source>[];
|
||||
|
|
|
@ -946,4 +946,26 @@ void main() {
|
|||
.childFile('canvaskit.wasm')
|
||||
.existsSync(), true);
|
||||
}));
|
||||
|
||||
test('wasm copies over canvaskit again if the web sdk changes', () => testbed.run(() async {
|
||||
final File canvasKitInput = globals.fs.file('bin/cache/flutter_web_sdk/canvaskit/canvaskit.wasm')
|
||||
..createSync(recursive: true);
|
||||
canvasKitInput.writeAsStringSync('foo', flush: true);
|
||||
|
||||
await WebBuiltInAssets(globals.fs, isWasm: true).build(environment);
|
||||
|
||||
final File canvasKitOutputBefore = environment.outputDir.childDirectory('canvaskit')
|
||||
.childFile('canvaskit.wasm');
|
||||
expect(canvasKitOutputBefore.existsSync(), true);
|
||||
expect(canvasKitOutputBefore.readAsStringSync(), 'foo');
|
||||
|
||||
canvasKitInput.writeAsStringSync('bar', flush: true);
|
||||
|
||||
await WebBuiltInAssets(globals.fs, isWasm: true).build(environment);
|
||||
|
||||
final File canvasKitOutputAfter = environment.outputDir.childDirectory('canvaskit')
|
||||
.childFile('canvaskit.wasm');
|
||||
expect(canvasKitOutputAfter.existsSync(), true);
|
||||
expect(canvasKitOutputAfter.readAsStringSync(), 'bar');
|
||||
}));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue