Unverified Commit b57c59b4 authored by Jackson Gardner's avatar Jackson Gardner Committed by GitHub

Invalidate the `WebStaticAssets` target if the web sdk changes. (#123739)

Invalidate the `WebStaticAssets` target if the web sdk changes.
parent 06f015a8
......@@ -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');
}));
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment