diff --git a/packages/flutter/lib/src/services/asset_manifest.dart b/packages/flutter/lib/src/services/asset_manifest.dart index 3249909f224..dd62c7d0b84 100644 --- a/packages/flutter/lib/src/services/asset_manifest.dart +++ b/packages/flutter/lib/src/services/asset_manifest.dart @@ -7,7 +7,7 @@ import 'package:flutter/foundation.dart'; import 'asset_bundle.dart'; import 'message_codecs.dart'; -const String _kAssetManifestFilename = 'AssetManifest.bin'; +const String _kAssetManifestFilename = 'AssetManifest.smcbin'; /// Contains details about available assets and their variants. /// See [Asset variants](https://docs.flutter.dev/development/ui/assets-and-images#asset-variants) diff --git a/packages/flutter/test/painting/image_resolution_test.dart b/packages/flutter/test/painting/image_resolution_test.dart index 79ea58f074e..fd64c06bd01 100644 --- a/packages/flutter/test/painting/image_resolution_test.dart +++ b/packages/flutter/test/painting/image_resolution_test.dart @@ -18,7 +18,7 @@ class TestAssetBundle extends CachingAssetBundle { @override Future load(String key) async { - if (key == 'AssetManifest.bin') { + if (key == 'AssetManifest.smcbin') { return const StandardMessageCodec().encodeMessage(_assetBundleMap)!; } diff --git a/packages/flutter/test/services/asset_bundle_test.dart b/packages/flutter/test/services/asset_bundle_test.dart index efa2f7d7cc0..961482d0cb6 100644 --- a/packages/flutter/test/services/asset_bundle_test.dart +++ b/packages/flutter/test/services/asset_bundle_test.dart @@ -19,7 +19,7 @@ class TestAssetBundle extends CachingAssetBundle { return ByteData.view(Uint8List.fromList(const Utf8Encoder().convert('{"one": ["one"]}')).buffer); } - if (key == 'AssetManifest.bin') { + if (key == 'AssetManifest.smcbin') { return const StandardMessageCodec().encodeMessage({ 'one': [] })!; @@ -76,8 +76,8 @@ void main() { expect(firstLoadStructuredDataResult, 'one'); expect(secondLoadStructuredDataResult, 'one'); - final String firstLoadStructuredBinaryDataResult = await bundle.loadStructuredBinaryData('AssetManifest.bin', (ByteData value) => Future.value('one')); - final String secondLoadStructuredBinaryDataResult = await bundle.loadStructuredBinaryData('AssetManifest.bin', (ByteData value) => Future.value('two')); + final String firstLoadStructuredBinaryDataResult = await bundle.loadStructuredBinaryData('AssetManifest.smcbin', (ByteData value) => Future.value('one')); + final String secondLoadStructuredBinaryDataResult = await bundle.loadStructuredBinaryData('AssetManifest.smcbin', (ByteData value) => Future.value('two')); expect(firstLoadStructuredBinaryDataResult, 'one'); expect(secondLoadStructuredBinaryDataResult, 'one'); }); @@ -95,9 +95,9 @@ void main() { final String secondLoadStructuredDataResult = await bundle.loadStructuredData('AssetManifest.json', (String value) => Future.value('two')); expect(secondLoadStructuredDataResult, 'two'); - await bundle.loadStructuredBinaryData('AssetManifest.bin', (ByteData value) => Future.value('one')); + await bundle.loadStructuredBinaryData('AssetManifest.smcbin', (ByteData value) => Future.value('one')); bundle.clear(); - final String secondLoadStructuredBinaryDataResult = await bundle.loadStructuredBinaryData('AssetManifest.bin', (ByteData value) => Future.value('two')); + final String secondLoadStructuredBinaryDataResult = await bundle.loadStructuredBinaryData('AssetManifest.smcbin', (ByteData value) => Future.value('two')); expect(secondLoadStructuredBinaryDataResult, 'two'); }); @@ -114,9 +114,9 @@ void main() { final String secondLoadStructuredDataResult = await bundle.loadStructuredData('AssetManifest.json', (String value) => Future.value('two')); expect(secondLoadStructuredDataResult, 'two'); - await bundle.loadStructuredBinaryData('AssetManifest.bin', (ByteData value) => Future.value('one')); - bundle.evict('AssetManifest.bin'); - final String secondLoadStructuredBinaryDataResult = await bundle.loadStructuredBinaryData('AssetManifest.bin', (ByteData value) => Future.value('two')); + await bundle.loadStructuredBinaryData('AssetManifest.smcbin', (ByteData value) => Future.value('one')); + bundle.evict('AssetManifest.smcbin'); + final String secondLoadStructuredBinaryDataResult = await bundle.loadStructuredBinaryData('AssetManifest.smcbin', (ByteData value) => Future.value('two')); expect(secondLoadStructuredBinaryDataResult, 'two'); }); @@ -191,7 +191,7 @@ void main() { test('loadStructuredBinaryData correctly loads ByteData', () async { final TestAssetBundle bundle = TestAssetBundle(); final Map assetManifest = - await bundle.loadStructuredBinaryData('AssetManifest.bin', (ByteData data) => const StandardMessageCodec().decodeMessage(data) as Map); + await bundle.loadStructuredBinaryData('AssetManifest.smcbin', (ByteData data) => const StandardMessageCodec().decodeMessage(data) as Map); expect(assetManifest.keys.toList(), equals(['one'])); expect(assetManifest['one'], []); }); diff --git a/packages/flutter/test/services/asset_manifest_test.dart b/packages/flutter/test/services/asset_manifest_test.dart index c37fbd50073..e715ba6b352 100644 --- a/packages/flutter/test/services/asset_manifest_test.dart +++ b/packages/flutter/test/services/asset_manifest_test.dart @@ -8,7 +8,7 @@ import 'package:flutter_test/flutter_test.dart'; class TestAssetBundle extends AssetBundle { @override Future load(String key) async { - if (key == 'AssetManifest.bin') { + if (key == 'AssetManifest.smcbin') { final Map> binManifestData = >{ 'assets/foo.png': [ { diff --git a/packages/flutter/test/widgets/image_resolution_test.dart b/packages/flutter/test/widgets/image_resolution_test.dart index 8a931e55fc8..1ad586bb653 100644 --- a/packages/flutter/test/widgets/image_resolution_test.dart +++ b/packages/flutter/test/widgets/image_resolution_test.dart @@ -41,7 +41,7 @@ class TestAssetBundle extends CachingAssetBundle { Future load(String key) { late ByteData data; switch (key) { - case 'AssetManifest.bin': + case 'AssetManifest.smcbin': data = manifest; case 'assets/image.png': data = testByteData(1.0); diff --git a/packages/flutter_tools/lib/src/asset.dart b/packages/flutter_tools/lib/src/asset.dart index 1cd0d1d750f..5ae97796840 100644 --- a/packages/flutter_tools/lib/src/asset.dart +++ b/packages/flutter_tools/lib/src/asset.dart @@ -168,7 +168,7 @@ class ManifestAssetBundle implements AssetBundle { // We assume the main asset is designed for a device pixel ratio of 1.0. static const double _defaultResolution = 1.0; static const String _kAssetManifestJsonFilename = 'AssetManifest.json'; - static const String _kAssetManifestBinFilename = 'AssetManifest.bin'; + static const String _kAssetManifestBinFilename = 'AssetManifest.smcbin'; static const String _kNoticeFile = 'NOTICES'; // Comically, this can't be name with the more common .gz file extension diff --git a/packages/flutter_tools/test/general.shard/asset_bundle_package_fonts_test.dart b/packages/flutter_tools/test/general.shard/asset_bundle_package_fonts_test.dart index febaa31742e..de7afe549e6 100644 --- a/packages/flutter_tools/test/general.shard/asset_bundle_package_fonts_test.dart +++ b/packages/flutter_tools/test/general.shard/asset_bundle_package_fonts_test.dart @@ -111,7 +111,7 @@ $fontsSection final AssetBundle bundle = AssetBundleFactory.instance.createBundle(); await bundle.build(packagesPath: '.packages'); - expect(bundle.entries.keys, unorderedEquals(['AssetManifest.bin', + expect(bundle.entries.keys, unorderedEquals(['AssetManifest.smcbin', 'AssetManifest.json', 'FontManifest.json', 'NOTICES.Z'])); }, overrides: { FileSystem: () => testFileSystem, diff --git a/packages/flutter_tools/test/general.shard/asset_bundle_package_test.dart b/packages/flutter_tools/test/general.shard/asset_bundle_package_test.dart index 54c8092277d..c8bb1339efa 100644 --- a/packages/flutter_tools/test/general.shard/asset_bundle_package_test.dart +++ b/packages/flutter_tools/test/general.shard/asset_bundle_package_test.dart @@ -70,7 +70,7 @@ $assetsSection bool expectExists = true, }) async { Future extractAssetManifestBinFromBundleAsJson(AssetBundle bundle) async { - final List manifestBytes = await bundle.entries['AssetManifest.bin']!.contentsAsBytes(); + final List manifestBytes = await bundle.entries['AssetManifest.smcbin']!.contentsAsBytes(); return json.encode(const StandardMessageCodec().decodeMessage( ByteData.sublistView(Uint8List.fromList(manifestBytes)) )); @@ -135,7 +135,7 @@ $assetsSection final AssetBundle bundle = AssetBundleFactory.instance.createBundle(); await bundle.build(packagesPath: '.packages'); expect(bundle.entries.keys, unorderedEquals( - ['NOTICES.Z', 'AssetManifest.json', 'AssetManifest.bin', 'FontManifest.json'])); + ['NOTICES.Z', 'AssetManifest.json', 'AssetManifest.smcbin', 'FontManifest.json'])); const String expectedAssetManifest = '{}'; expect( utf8.decode(await bundle.entries['AssetManifest.json']!.contentsAsBytes()), @@ -161,7 +161,7 @@ $assetsSection final AssetBundle bundle = AssetBundleFactory.instance.createBundle(); await bundle.build(packagesPath: '.packages'); expect(bundle.entries.keys, unorderedEquals( - ['NOTICES.Z', 'AssetManifest.json', 'AssetManifest.bin', 'FontManifest.json'])); + ['NOTICES.Z', 'AssetManifest.json', 'AssetManifest.smcbin', 'FontManifest.json'])); const String expectedAssetManifest = '{}'; expect( utf8.decode(await bundle.entries['AssetManifest.json']!.contentsAsBytes()), diff --git a/packages/flutter_tools/test/general.shard/asset_bundle_test.dart b/packages/flutter_tools/test/general.shard/asset_bundle_test.dart index 11837c7fb25..77b4129749a 100644 --- a/packages/flutter_tools/test/general.shard/asset_bundle_test.dart +++ b/packages/flutter_tools/test/general.shard/asset_bundle_test.dart @@ -51,7 +51,7 @@ void main() { final AssetBundle bundle = AssetBundleFactory.instance.createBundle(); await bundle.build(packagesPath: '.packages'); expect(bundle.entries.keys, - unorderedEquals(['AssetManifest.json', 'AssetManifest.bin']) + unorderedEquals(['AssetManifest.json', 'AssetManifest.smcbin']) ); const String expectedJsonAssetManifest = '{}'; const Map expectedBinAssetManifest = {}; @@ -60,7 +60,7 @@ void main() { expectedJsonAssetManifest, ); expect( - const StandardMessageCodec().decodeMessage(ByteData.sublistView(Uint8List.fromList(await bundle.entries['AssetManifest.bin']!.contentsAsBytes()))), + const StandardMessageCodec().decodeMessage(ByteData.sublistView(Uint8List.fromList(await bundle.entries['AssetManifest.smcbin']!.contentsAsBytes()))), expectedBinAssetManifest ); @@ -103,7 +103,7 @@ flutter: expect(bundle.entries.keys, unorderedEquals([ 'AssetManifest.json', - 'AssetManifest.bin', + 'AssetManifest.smcbin', 'FontManifest.json', 'NOTICES.Z', 'assets/foo/dog.png', @@ -128,7 +128,7 @@ flutter: final AssetBundle bundle = AssetBundleFactory.instance.createBundle(); await bundle.build(packagesPath: '.packages'); expect(bundle.entries.keys, unorderedEquals(['AssetManifest.json', - 'AssetManifest.bin', 'FontManifest.json', 'NOTICES.Z', 'assets/foo/bar.txt'])); + 'AssetManifest.smcbin', 'FontManifest.json', 'NOTICES.Z', 'assets/foo/bar.txt'])); // Simulate modifying the files by updating the filestat time manually. globals.fs.file(globals.fs.path.join('assets', 'foo', 'fizz.txt')) ..createSync(recursive: true) @@ -137,7 +137,7 @@ flutter: expect(bundle.needsBuild(), true); await bundle.build(packagesPath: '.packages'); expect(bundle.entries.keys, unorderedEquals(['AssetManifest.json', - 'AssetManifest.bin', 'FontManifest.json', 'NOTICES.Z', 'assets/foo/bar.txt', + 'AssetManifest.smcbin', 'FontManifest.json', 'NOTICES.Z', 'assets/foo/bar.txt', 'assets/foo/fizz.txt'])); }, overrides: { FileSystem: () => testFileSystem, @@ -158,7 +158,7 @@ flutter: final AssetBundle bundle = AssetBundleFactory.instance.createBundle(); await bundle.build(packagesPath: '.packages'); expect(bundle.entries.keys, unorderedEquals(['AssetManifest.json', - 'AssetManifest.bin', 'FontManifest.json', 'NOTICES.Z', 'assets/foo/bar.txt'])); + 'AssetManifest.smcbin', 'FontManifest.json', 'NOTICES.Z', 'assets/foo/bar.txt'])); expect(bundle.needsBuild(), false); // Delete the wildcard directory and update pubspec file. @@ -180,7 +180,7 @@ name: example''') expect(bundle.needsBuild(), true); await bundle.build(packagesPath: '.packages'); expect(bundle.entries.keys, unorderedEquals(['AssetManifest.json', - 'AssetManifest.bin', 'FontManifest.json', 'NOTICES.Z', 'assets/foo/bar.txt'])); + 'AssetManifest.smcbin', 'FontManifest.json', 'NOTICES.Z', 'assets/foo/bar.txt'])); }, overrides: { FileSystem: () => testFileSystem, ProcessManager: () => FakeProcessManager.any(), @@ -204,7 +204,7 @@ flutter: final AssetBundle bundle = AssetBundleFactory.instance.createBundle(); await bundle.build(packagesPath: '.packages'); expect(bundle.entries.keys, unorderedEquals(['AssetManifest.json', - 'AssetManifest.bin', 'FontManifest.json', 'NOTICES.Z', 'assets/foo/bar.txt'])); + 'AssetManifest.smcbin', 'FontManifest.json', 'NOTICES.Z', 'assets/foo/bar.txt'])); expect(bundle.needsBuild(), false); }, overrides: { FileSystem: () => testFileSystem, @@ -237,7 +237,7 @@ flutter: ).createBundle(); await bundle.build(packagesPath: '.packages', deferredComponentsEnabled: true); expect(bundle.entries.keys, unorderedEquals(['AssetManifest.json', - 'AssetManifest.bin', 'FontManifest.json', 'NOTICES.Z', 'assets/foo/bar.txt'])); + 'AssetManifest.smcbin', 'FontManifest.json', 'NOTICES.Z', 'assets/foo/bar.txt'])); expect(bundle.deferredComponentsEntries.length, 1); expect(bundle.deferredComponentsEntries['component1']!.length, 2); expect(bundle.needsBuild(), false); @@ -268,7 +268,7 @@ flutter: await bundle.build(packagesPath: '.packages'); expect(bundle.entries.keys, unorderedEquals(['assets/foo/bar.txt', 'assets/bar/barbie.txt', 'assets/wild/dash.txt', 'AssetManifest.json', - 'AssetManifest.bin', 'FontManifest.json', 'NOTICES.Z'])); + 'AssetManifest.smcbin', 'FontManifest.json', 'NOTICES.Z'])); expect(bundle.deferredComponentsEntries.isEmpty, true); expect(bundle.needsBuild(), false); }, overrides: { @@ -302,7 +302,7 @@ flutter: ).createBundle(); await bundle.build(packagesPath: '.packages', deferredComponentsEnabled: true); expect(bundle.entries.keys, unorderedEquals(['assets/foo/bar.txt', - 'AssetManifest.json', 'AssetManifest.bin', 'FontManifest.json', 'NOTICES.Z'])); + 'AssetManifest.json', 'AssetManifest.smcbin', 'FontManifest.json', 'NOTICES.Z'])); expect(bundle.deferredComponentsEntries.length, 1); expect(bundle.deferredComponentsEntries['component1']!.length, 2); expect(bundle.needsBuild(), false); @@ -316,7 +316,7 @@ flutter: await bundle.build(packagesPath: '.packages', deferredComponentsEnabled: true); expect(bundle.entries.keys, unorderedEquals(['assets/foo/bar.txt', - 'AssetManifest.json', 'AssetManifest.bin', 'FontManifest.json', 'NOTICES.Z'])); + 'AssetManifest.json', 'AssetManifest.smcbin', 'FontManifest.json', 'NOTICES.Z'])); expect(bundle.deferredComponentsEntries.length, 1); expect(bundle.deferredComponentsEntries['component1']!.length, 3); }, overrides: { @@ -663,7 +663,7 @@ flutter: await bundle.build(packagesPath: '.packages'); expect(bundle.entries.keys, unorderedEquals(['packages/foo/bar/fizz.txt', - 'AssetManifest.json', 'AssetManifest.bin', 'FontManifest.json', 'NOTICES.Z'])); + 'AssetManifest.json', 'AssetManifest.smcbin', 'FontManifest.json', 'NOTICES.Z'])); expect(bundle.needsBuild(), false); // Does not track dependency's wildcard directories. @@ -799,7 +799,7 @@ flutter: expect(await bundle.build(packagesPath: '.packages'), 0); expect(bundle.entries.keys, unorderedEquals(['assets/foo.txt', - 'AssetManifest.json', 'AssetManifest.bin', 'FontManifest.json', 'NOTICES.Z'])); + 'AssetManifest.json', 'AssetManifest.smcbin', 'FontManifest.json', 'NOTICES.Z'])); }, overrides: { FileSystem: () => MemoryFileSystem.test(), ProcessManager: () => FakeProcessManager.any(),