File tree Expand file tree Collapse file tree 2 files changed +27
-3
lines changed
lib/src/build_system/targets
test/general.shard/build_system/targets Expand file tree Collapse file tree 2 files changed +27
-3
lines changed Original file line number Diff line number Diff line change @@ -494,8 +494,8 @@ class WebReleaseBundle extends Target {
494
494
/// Static assets provided by the Flutter SDK that do not change, such as
495
495
/// CanvasKit.
496
496
///
497
- /// These assets can be cached forever and are only invalidated when the
498
- /// Flutter SDK is upgraded to a new version .
497
+ /// These assets can be cached until a new version of the flutter web sdk is
498
+ /// downloaded .
499
499
class WebBuiltInAssets extends Target {
500
500
const WebBuiltInAssets (this .fileSystem, {required this .isWasm});
501
501
@@ -512,7 +512,9 @@ class WebBuiltInAssets extends Target {
512
512
List <String > get depfiles => const < String > [];
513
513
514
514
@override
515
- List <Source > get inputs => const < Source > [];
515
+ List <Source > get inputs => const < Source > [
516
+ Source .hostArtifact (HostArtifact .flutterWebSdk),
517
+ ];
516
518
517
519
@override
518
520
List <Source > get outputs => const < Source > [];
Original file line number Diff line number Diff line change @@ -946,4 +946,26 @@ void main() {
946
946
.childFile ('canvaskit.wasm' )
947
947
.existsSync (), true );
948
948
}));
949
+
950
+ test ('wasm copies over canvaskit again if the web sdk changes' , () => testbed.run (() async {
951
+ final File canvasKitInput = globals.fs.file ('bin/cache/flutter_web_sdk/canvaskit/canvaskit.wasm' )
952
+ ..createSync (recursive: true );
953
+ canvasKitInput.writeAsStringSync ('foo' , flush: true );
954
+
955
+ await WebBuiltInAssets (globals.fs, isWasm: true ).build (environment);
956
+
957
+ final File canvasKitOutputBefore = environment.outputDir.childDirectory ('canvaskit' )
958
+ .childFile ('canvaskit.wasm' );
959
+ expect (canvasKitOutputBefore.existsSync (), true );
960
+ expect (canvasKitOutputBefore.readAsStringSync (), 'foo' );
961
+
962
+ canvasKitInput.writeAsStringSync ('bar' , flush: true );
963
+
964
+ await WebBuiltInAssets (globals.fs, isWasm: true ).build (environment);
965
+
966
+ final File canvasKitOutputAfter = environment.outputDir.childDirectory ('canvaskit' )
967
+ .childFile ('canvaskit.wasm' );
968
+ expect (canvasKitOutputAfter.existsSync (), true );
969
+ expect (canvasKitOutputAfter.readAsStringSync (), 'bar' );
970
+ }));
949
971
}
You can’t perform that action at this time.
0 commit comments