Unverified Commit cfe4fedc authored by Andrew Kolos's avatar Andrew Kolos Committed by GitHub

rename generated asset manifest file back to `AssetManifest.bin` (from...

rename generated asset manifest file back to `AssetManifest.bin` (from `AssetManifest.smcbin`) (#128529)

Closes https://github.com/flutter/flutter/issues/128456, which is now linked to in a code comment in this change.
Reopens https://github.com/flutter/flutter/issues/124883.

This effectively reverts https://github.com/flutter/flutter/pull/126077 and is intended to be cherry-picked into stable.
parent af7a8f6b
...@@ -7,7 +7,12 @@ import 'package:flutter/foundation.dart'; ...@@ -7,7 +7,12 @@ import 'package:flutter/foundation.dart';
import 'asset_bundle.dart'; import 'asset_bundle.dart';
import 'message_codecs.dart'; import 'message_codecs.dart';
const String _kAssetManifestFilename = 'AssetManifest.smcbin'; // We use .bin as the extension since it is well-known to represent
// data in some arbitrary binary format. Using a well-known extension here
// is important for web, because some web servers will not serve files with
// unrecognized file extensions by default.
// See https://github.com/flutter/flutter/issues/128456.
const String _kAssetManifestFilename = 'AssetManifest.bin';
/// Contains details about available assets and their variants. /// Contains details about available assets and their variants.
/// See [Asset variants](https://docs.flutter.dev/development/ui/assets-and-images#asset-variants) /// See [Asset variants](https://docs.flutter.dev/development/ui/assets-and-images#asset-variants)
......
...@@ -18,7 +18,7 @@ class TestAssetBundle extends CachingAssetBundle { ...@@ -18,7 +18,7 @@ class TestAssetBundle extends CachingAssetBundle {
@override @override
Future<ByteData> load(String key) async { Future<ByteData> load(String key) async {
if (key == 'AssetManifest.smcbin') { if (key == 'AssetManifest.bin') {
return const StandardMessageCodec().encodeMessage(_assetBundleMap)!; return const StandardMessageCodec().encodeMessage(_assetBundleMap)!;
} }
......
...@@ -19,7 +19,7 @@ class TestAssetBundle extends CachingAssetBundle { ...@@ -19,7 +19,7 @@ class TestAssetBundle extends CachingAssetBundle {
return ByteData.view(Uint8List.fromList(const Utf8Encoder().convert('{"one": ["one"]}')).buffer); return ByteData.view(Uint8List.fromList(const Utf8Encoder().convert('{"one": ["one"]}')).buffer);
} }
if (key == 'AssetManifest.smcbin') { if (key == 'AssetManifest.bin') {
return const StandardMessageCodec().encodeMessage(<String, Object>{ return const StandardMessageCodec().encodeMessage(<String, Object>{
'one': <Object>[] 'one': <Object>[]
})!; })!;
...@@ -76,8 +76,8 @@ void main() { ...@@ -76,8 +76,8 @@ void main() {
expect(firstLoadStructuredDataResult, 'one'); expect(firstLoadStructuredDataResult, 'one');
expect(secondLoadStructuredDataResult, 'one'); expect(secondLoadStructuredDataResult, 'one');
final String firstLoadStructuredBinaryDataResult = await bundle.loadStructuredBinaryData('AssetManifest.smcbin', (ByteData value) => Future<String>.value('one')); final String firstLoadStructuredBinaryDataResult = await bundle.loadStructuredBinaryData('AssetManifest.bin', (ByteData value) => Future<String>.value('one'));
final String secondLoadStructuredBinaryDataResult = await bundle.loadStructuredBinaryData('AssetManifest.smcbin', (ByteData value) => Future<String>.value('two')); final String secondLoadStructuredBinaryDataResult = await bundle.loadStructuredBinaryData('AssetManifest.bin', (ByteData value) => Future<String>.value('two'));
expect(firstLoadStructuredBinaryDataResult, 'one'); expect(firstLoadStructuredBinaryDataResult, 'one');
expect(secondLoadStructuredBinaryDataResult, 'one'); expect(secondLoadStructuredBinaryDataResult, 'one');
}); });
...@@ -95,9 +95,9 @@ void main() { ...@@ -95,9 +95,9 @@ void main() {
final String secondLoadStructuredDataResult = await bundle.loadStructuredData('AssetManifest.json', (String value) => Future<String>.value('two')); final String secondLoadStructuredDataResult = await bundle.loadStructuredData('AssetManifest.json', (String value) => Future<String>.value('two'));
expect(secondLoadStructuredDataResult, 'two'); expect(secondLoadStructuredDataResult, 'two');
await bundle.loadStructuredBinaryData('AssetManifest.smcbin', (ByteData value) => Future<String>.value('one')); await bundle.loadStructuredBinaryData('AssetManifest.bin', (ByteData value) => Future<String>.value('one'));
bundle.clear(); bundle.clear();
final String secondLoadStructuredBinaryDataResult = await bundle.loadStructuredBinaryData('AssetManifest.smcbin', (ByteData value) => Future<String>.value('two')); final String secondLoadStructuredBinaryDataResult = await bundle.loadStructuredBinaryData('AssetManifest.bin', (ByteData value) => Future<String>.value('two'));
expect(secondLoadStructuredBinaryDataResult, 'two'); expect(secondLoadStructuredBinaryDataResult, 'two');
}); });
...@@ -114,9 +114,9 @@ void main() { ...@@ -114,9 +114,9 @@ void main() {
final String secondLoadStructuredDataResult = await bundle.loadStructuredData('AssetManifest.json', (String value) => Future<String>.value('two')); final String secondLoadStructuredDataResult = await bundle.loadStructuredData('AssetManifest.json', (String value) => Future<String>.value('two'));
expect(secondLoadStructuredDataResult, 'two'); expect(secondLoadStructuredDataResult, 'two');
await bundle.loadStructuredBinaryData('AssetManifest.smcbin', (ByteData value) => Future<String>.value('one')); await bundle.loadStructuredBinaryData('AssetManifest.bin', (ByteData value) => Future<String>.value('one'));
bundle.evict('AssetManifest.smcbin'); bundle.evict('AssetManifest.bin');
final String secondLoadStructuredBinaryDataResult = await bundle.loadStructuredBinaryData('AssetManifest.smcbin', (ByteData value) => Future<String>.value('two')); final String secondLoadStructuredBinaryDataResult = await bundle.loadStructuredBinaryData('AssetManifest.bin', (ByteData value) => Future<String>.value('two'));
expect(secondLoadStructuredBinaryDataResult, 'two'); expect(secondLoadStructuredBinaryDataResult, 'two');
}); });
...@@ -191,7 +191,7 @@ void main() { ...@@ -191,7 +191,7 @@ void main() {
test('loadStructuredBinaryData correctly loads ByteData', () async { test('loadStructuredBinaryData correctly loads ByteData', () async {
final TestAssetBundle bundle = TestAssetBundle(); final TestAssetBundle bundle = TestAssetBundle();
final Map<Object?, Object?> assetManifest = final Map<Object?, Object?> assetManifest =
await bundle.loadStructuredBinaryData('AssetManifest.smcbin', (ByteData data) => const StandardMessageCodec().decodeMessage(data) as Map<Object?, Object?>); await bundle.loadStructuredBinaryData('AssetManifest.bin', (ByteData data) => const StandardMessageCodec().decodeMessage(data) as Map<Object?, Object?>);
expect(assetManifest.keys.toList(), equals(<String>['one'])); expect(assetManifest.keys.toList(), equals(<String>['one']));
expect(assetManifest['one'], <Object>[]); expect(assetManifest['one'], <Object>[]);
}); });
......
...@@ -10,7 +10,7 @@ import 'package:flutter_test/flutter_test.dart'; ...@@ -10,7 +10,7 @@ import 'package:flutter_test/flutter_test.dart';
class TestAssetBundle extends AssetBundle { class TestAssetBundle extends AssetBundle {
@override @override
Future<ByteData> load(String key) async { Future<ByteData> load(String key) async {
if (key == 'AssetManifest.smcbin') { if (key == 'AssetManifest.bin') {
final Map<String, List<Object>> binManifestData = <String, List<Object>>{ final Map<String, List<Object>> binManifestData = <String, List<Object>>{
'assets/foo.png': <Object>[ 'assets/foo.png': <Object>[
<String, Object>{ <String, Object>{
......
...@@ -40,7 +40,7 @@ class TestAssetBundle extends CachingAssetBundle { ...@@ -40,7 +40,7 @@ class TestAssetBundle extends CachingAssetBundle {
Future<ByteData> load(String key) { Future<ByteData> load(String key) {
late ByteData data; late ByteData data;
switch (key) { switch (key) {
case 'AssetManifest.smcbin': case 'AssetManifest.bin':
data = manifest; data = manifest;
case 'assets/image.png': case 'assets/image.png':
data = testByteData(1.0); data = testByteData(1.0);
......
...@@ -167,7 +167,7 @@ class ManifestAssetBundle implements AssetBundle { ...@@ -167,7 +167,7 @@ class ManifestAssetBundle implements AssetBundle {
// We assume the main asset is designed for a device pixel ratio of 1.0. // We assume the main asset is designed for a device pixel ratio of 1.0.
static const String _kAssetManifestJsonFilename = 'AssetManifest.json'; static const String _kAssetManifestJsonFilename = 'AssetManifest.json';
static const String _kAssetManifestBinFilename = 'AssetManifest.smcbin'; static const String _kAssetManifestBinFilename = 'AssetManifest.bin';
static const String _kNoticeFile = 'NOTICES'; static const String _kNoticeFile = 'NOTICES';
// Comically, this can't be name with the more common .gz file extension // Comically, this can't be name with the more common .gz file extension
......
...@@ -541,7 +541,11 @@ class TestCommand extends FlutterCommand with DeviceBasedDevelopmentArtifacts { ...@@ -541,7 +541,11 @@ class TestCommand extends FlutterCommand with DeviceBasedDevelopmentArtifacts {
} }
bool _needRebuild(Map<String, DevFSContent> entries) { bool _needRebuild(Map<String, DevFSContent> entries) {
final File manifest = globals.fs.file(globals.fs.path.join('build', 'unit_test_assets', 'AssetManifest.json')); // TODO(andrewkolos): This logic might fail in the future if we change the
// schema of the contents of the asset manifest file and the user does not
// perform a `flutter clean` after upgrading.
// See https://github.com/flutter/flutter/issues/128563.
final File manifest = globals.fs.file(globals.fs.path.join('build', 'unit_test_assets', 'AssetManifest.bin'));
if (!manifest.existsSync()) { if (!manifest.existsSync()) {
return true; return true;
} }
......
...@@ -743,7 +743,7 @@ dev_dependencies: ...@@ -743,7 +743,7 @@ dev_dependencies:
'--no-pub', '--no-pub',
]); ]);
final bool fileExists = await fs.isFile(globals.fs.path.join('build', 'unit_test_assets', 'AssetManifest.json')); final bool fileExists = await fs.isFile(globals.fs.path.join('build', 'unit_test_assets', 'AssetManifest.bin'));
expect(fileExists, true); expect(fileExists, true);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
...@@ -764,7 +764,7 @@ dev_dependencies: ...@@ -764,7 +764,7 @@ dev_dependencies:
'--no-test-assets', '--no-test-assets',
]); ]);
final bool fileExists = await fs.isFile(globals.fs.path.join('build', 'unit_test_assets', 'AssetManifest.json')); final bool fileExists = await fs.isFile(globals.fs.path.join('build', 'unit_test_assets', 'AssetManifest.bin'));
expect(fileExists, false); expect(fileExists, false);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
......
...@@ -111,7 +111,7 @@ $fontsSection ...@@ -111,7 +111,7 @@ $fontsSection
final AssetBundle bundle = AssetBundleFactory.instance.createBundle(); final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
await bundle.build(packagesPath: '.packages'); await bundle.build(packagesPath: '.packages');
expect(bundle.entries.keys, unorderedEquals(<String>['AssetManifest.smcbin', expect(bundle.entries.keys, unorderedEquals(<String>['AssetManifest.bin',
'AssetManifest.json', 'FontManifest.json', 'NOTICES.Z'])); 'AssetManifest.json', 'FontManifest.json', 'NOTICES.Z']));
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => testFileSystem, FileSystem: () => testFileSystem,
......
...@@ -95,7 +95,7 @@ $assetsSection ...@@ -95,7 +95,7 @@ $assetsSection
final Map<Object?, Object?> assetManifest = const StandardMessageCodec().decodeMessage( final Map<Object?, Object?> assetManifest = const StandardMessageCodec().decodeMessage(
ByteData.sublistView( ByteData.sublistView(
Uint8List.fromList( Uint8List.fromList(
await bundle.entries['AssetManifest.smcbin']!.contentsAsBytes() await bundle.entries['AssetManifest.bin']!.contentsAsBytes()
) )
) )
) as Map<Object?, Object?>; ) as Map<Object?, Object?>;
...@@ -140,7 +140,7 @@ $assetsSection ...@@ -140,7 +140,7 @@ $assetsSection
final AssetBundle bundle = AssetBundleFactory.instance.createBundle(); final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
await bundle.build(packagesPath: '.packages'); await bundle.build(packagesPath: '.packages');
expect(bundle.entries.keys, unorderedEquals( expect(bundle.entries.keys, unorderedEquals(
<String>['NOTICES.Z', 'AssetManifest.json', 'AssetManifest.smcbin', 'FontManifest.json'])); <String>['NOTICES.Z', 'AssetManifest.json', 'AssetManifest.bin', 'FontManifest.json']));
const String expectedAssetManifest = '{}'; const String expectedAssetManifest = '{}';
expect( expect(
utf8.decode(await bundle.entries['AssetManifest.json']!.contentsAsBytes()), utf8.decode(await bundle.entries['AssetManifest.json']!.contentsAsBytes()),
...@@ -166,7 +166,7 @@ $assetsSection ...@@ -166,7 +166,7 @@ $assetsSection
final AssetBundle bundle = AssetBundleFactory.instance.createBundle(); final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
await bundle.build(packagesPath: '.packages'); await bundle.build(packagesPath: '.packages');
expect(bundle.entries.keys, unorderedEquals( expect(bundle.entries.keys, unorderedEquals(
<String>['NOTICES.Z', 'AssetManifest.json', 'AssetManifest.smcbin', 'FontManifest.json'])); <String>['NOTICES.Z', 'AssetManifest.json', 'AssetManifest.bin', 'FontManifest.json']));
const String expectedAssetManifest = '{}'; const String expectedAssetManifest = '{}';
expect( expect(
utf8.decode(await bundle.entries['AssetManifest.json']!.contentsAsBytes()), utf8.decode(await bundle.entries['AssetManifest.json']!.contentsAsBytes()),
......
...@@ -51,7 +51,7 @@ void main() { ...@@ -51,7 +51,7 @@ void main() {
final AssetBundle bundle = AssetBundleFactory.instance.createBundle(); final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
await bundle.build(packagesPath: '.packages'); await bundle.build(packagesPath: '.packages');
expect(bundle.entries.keys, expect(bundle.entries.keys,
unorderedEquals(<String>['AssetManifest.json', 'AssetManifest.smcbin']) unorderedEquals(<String>['AssetManifest.json', 'AssetManifest.bin'])
); );
const String expectedJsonAssetManifest = '{}'; const String expectedJsonAssetManifest = '{}';
const Map<Object, Object> expectedBinAssetManifest = <Object, Object>{}; const Map<Object, Object> expectedBinAssetManifest = <Object, Object>{};
...@@ -60,7 +60,7 @@ void main() { ...@@ -60,7 +60,7 @@ void main() {
expectedJsonAssetManifest, expectedJsonAssetManifest,
); );
expect( expect(
const StandardMessageCodec().decodeMessage(ByteData.sublistView(Uint8List.fromList(await bundle.entries['AssetManifest.smcbin']!.contentsAsBytes()))), const StandardMessageCodec().decodeMessage(ByteData.sublistView(Uint8List.fromList(await bundle.entries['AssetManifest.bin']!.contentsAsBytes()))),
expectedBinAssetManifest expectedBinAssetManifest
); );
...@@ -103,7 +103,7 @@ flutter: ...@@ -103,7 +103,7 @@ flutter:
expect(bundle.entries.keys, unorderedEquals(<String>[ expect(bundle.entries.keys, unorderedEquals(<String>[
'AssetManifest.json', 'AssetManifest.json',
'AssetManifest.smcbin', 'AssetManifest.bin',
'FontManifest.json', 'FontManifest.json',
'NOTICES.Z', 'NOTICES.Z',
'assets/foo/dog.png', 'assets/foo/dog.png',
...@@ -128,7 +128,7 @@ flutter: ...@@ -128,7 +128,7 @@ flutter:
final AssetBundle bundle = AssetBundleFactory.instance.createBundle(); final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
await bundle.build(packagesPath: '.packages'); await bundle.build(packagesPath: '.packages');
expect(bundle.entries.keys, unorderedEquals(<String>['AssetManifest.json', expect(bundle.entries.keys, unorderedEquals(<String>['AssetManifest.json',
'AssetManifest.smcbin', 'FontManifest.json', 'NOTICES.Z', 'assets/foo/bar.txt'])); 'AssetManifest.bin', 'FontManifest.json', 'NOTICES.Z', 'assets/foo/bar.txt']));
// Simulate modifying the files by updating the filestat time manually. // Simulate modifying the files by updating the filestat time manually.
globals.fs.file(globals.fs.path.join('assets', 'foo', 'fizz.txt')) globals.fs.file(globals.fs.path.join('assets', 'foo', 'fizz.txt'))
..createSync(recursive: true) ..createSync(recursive: true)
...@@ -137,7 +137,7 @@ flutter: ...@@ -137,7 +137,7 @@ flutter:
expect(bundle.needsBuild(), true); expect(bundle.needsBuild(), true);
await bundle.build(packagesPath: '.packages'); await bundle.build(packagesPath: '.packages');
expect(bundle.entries.keys, unorderedEquals(<String>['AssetManifest.json', expect(bundle.entries.keys, unorderedEquals(<String>['AssetManifest.json',
'AssetManifest.smcbin', 'FontManifest.json', 'NOTICES.Z', 'assets/foo/bar.txt', 'AssetManifest.bin', 'FontManifest.json', 'NOTICES.Z', 'assets/foo/bar.txt',
'assets/foo/fizz.txt'])); 'assets/foo/fizz.txt']));
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => testFileSystem, FileSystem: () => testFileSystem,
...@@ -158,7 +158,7 @@ flutter: ...@@ -158,7 +158,7 @@ flutter:
final AssetBundle bundle = AssetBundleFactory.instance.createBundle(); final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
await bundle.build(packagesPath: '.packages'); await bundle.build(packagesPath: '.packages');
expect(bundle.entries.keys, unorderedEquals(<String>['AssetManifest.json', expect(bundle.entries.keys, unorderedEquals(<String>['AssetManifest.json',
'AssetManifest.smcbin', 'FontManifest.json', 'NOTICES.Z', 'assets/foo/bar.txt'])); 'AssetManifest.bin', 'FontManifest.json', 'NOTICES.Z', 'assets/foo/bar.txt']));
expect(bundle.needsBuild(), false); expect(bundle.needsBuild(), false);
// Delete the wildcard directory and update pubspec file. // Delete the wildcard directory and update pubspec file.
...@@ -180,7 +180,7 @@ name: example''') ...@@ -180,7 +180,7 @@ name: example''')
expect(bundle.needsBuild(), true); expect(bundle.needsBuild(), true);
await bundle.build(packagesPath: '.packages'); await bundle.build(packagesPath: '.packages');
expect(bundle.entries.keys, unorderedEquals(<String>['AssetManifest.json', expect(bundle.entries.keys, unorderedEquals(<String>['AssetManifest.json',
'AssetManifest.smcbin', 'FontManifest.json', 'NOTICES.Z', 'assets/foo/bar.txt'])); 'AssetManifest.bin', 'FontManifest.json', 'NOTICES.Z', 'assets/foo/bar.txt']));
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => testFileSystem, FileSystem: () => testFileSystem,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager.any(),
...@@ -204,7 +204,7 @@ flutter: ...@@ -204,7 +204,7 @@ flutter:
final AssetBundle bundle = AssetBundleFactory.instance.createBundle(); final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
await bundle.build(packagesPath: '.packages'); await bundle.build(packagesPath: '.packages');
expect(bundle.entries.keys, unorderedEquals(<String>['AssetManifest.json', expect(bundle.entries.keys, unorderedEquals(<String>['AssetManifest.json',
'AssetManifest.smcbin', 'FontManifest.json', 'NOTICES.Z', 'assets/foo/bar.txt'])); 'AssetManifest.bin', 'FontManifest.json', 'NOTICES.Z', 'assets/foo/bar.txt']));
expect(bundle.needsBuild(), false); expect(bundle.needsBuild(), false);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => testFileSystem, FileSystem: () => testFileSystem,
...@@ -237,7 +237,7 @@ flutter: ...@@ -237,7 +237,7 @@ flutter:
).createBundle(); ).createBundle();
await bundle.build(packagesPath: '.packages', deferredComponentsEnabled: true); await bundle.build(packagesPath: '.packages', deferredComponentsEnabled: true);
expect(bundle.entries.keys, unorderedEquals(<String>['AssetManifest.json', expect(bundle.entries.keys, unorderedEquals(<String>['AssetManifest.json',
'AssetManifest.smcbin', 'FontManifest.json', 'NOTICES.Z', 'assets/foo/bar.txt'])); 'AssetManifest.bin', 'FontManifest.json', 'NOTICES.Z', 'assets/foo/bar.txt']));
expect(bundle.deferredComponentsEntries.length, 1); expect(bundle.deferredComponentsEntries.length, 1);
expect(bundle.deferredComponentsEntries['component1']!.length, 2); expect(bundle.deferredComponentsEntries['component1']!.length, 2);
expect(bundle.needsBuild(), false); expect(bundle.needsBuild(), false);
...@@ -268,7 +268,7 @@ flutter: ...@@ -268,7 +268,7 @@ flutter:
await bundle.build(packagesPath: '.packages'); await bundle.build(packagesPath: '.packages');
expect(bundle.entries.keys, unorderedEquals(<String>['assets/foo/bar.txt', expect(bundle.entries.keys, unorderedEquals(<String>['assets/foo/bar.txt',
'assets/bar/barbie.txt', 'assets/wild/dash.txt', 'AssetManifest.json', 'assets/bar/barbie.txt', 'assets/wild/dash.txt', 'AssetManifest.json',
'AssetManifest.smcbin', 'FontManifest.json', 'NOTICES.Z'])); 'AssetManifest.bin', 'FontManifest.json', 'NOTICES.Z']));
expect(bundle.deferredComponentsEntries.isEmpty, true); expect(bundle.deferredComponentsEntries.isEmpty, true);
expect(bundle.needsBuild(), false); expect(bundle.needsBuild(), false);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
...@@ -302,7 +302,7 @@ flutter: ...@@ -302,7 +302,7 @@ flutter:
).createBundle(); ).createBundle();
await bundle.build(packagesPath: '.packages', deferredComponentsEnabled: true); await bundle.build(packagesPath: '.packages', deferredComponentsEnabled: true);
expect(bundle.entries.keys, unorderedEquals(<String>['assets/foo/bar.txt', expect(bundle.entries.keys, unorderedEquals(<String>['assets/foo/bar.txt',
'AssetManifest.json', 'AssetManifest.smcbin', 'FontManifest.json', 'NOTICES.Z'])); 'AssetManifest.json', 'AssetManifest.bin', 'FontManifest.json', 'NOTICES.Z']));
expect(bundle.deferredComponentsEntries.length, 1); expect(bundle.deferredComponentsEntries.length, 1);
expect(bundle.deferredComponentsEntries['component1']!.length, 2); expect(bundle.deferredComponentsEntries['component1']!.length, 2);
expect(bundle.needsBuild(), false); expect(bundle.needsBuild(), false);
...@@ -316,7 +316,7 @@ flutter: ...@@ -316,7 +316,7 @@ flutter:
await bundle.build(packagesPath: '.packages', deferredComponentsEnabled: true); await bundle.build(packagesPath: '.packages', deferredComponentsEnabled: true);
expect(bundle.entries.keys, unorderedEquals(<String>['assets/foo/bar.txt', expect(bundle.entries.keys, unorderedEquals(<String>['assets/foo/bar.txt',
'AssetManifest.json', 'AssetManifest.smcbin', 'FontManifest.json', 'NOTICES.Z'])); 'AssetManifest.json', 'AssetManifest.bin', 'FontManifest.json', 'NOTICES.Z']));
expect(bundle.deferredComponentsEntries.length, 1); expect(bundle.deferredComponentsEntries.length, 1);
expect(bundle.deferredComponentsEntries['component1']!.length, 3); expect(bundle.deferredComponentsEntries['component1']!.length, 3);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
...@@ -663,7 +663,7 @@ flutter: ...@@ -663,7 +663,7 @@ flutter:
await bundle.build(packagesPath: '.packages'); await bundle.build(packagesPath: '.packages');
expect(bundle.entries.keys, unorderedEquals(<String>['packages/foo/bar/fizz.txt', expect(bundle.entries.keys, unorderedEquals(<String>['packages/foo/bar/fizz.txt',
'AssetManifest.json', 'AssetManifest.smcbin', 'FontManifest.json', 'NOTICES.Z'])); 'AssetManifest.json', 'AssetManifest.bin', 'FontManifest.json', 'NOTICES.Z']));
expect(bundle.needsBuild(), false); expect(bundle.needsBuild(), false);
// Does not track dependency's wildcard directories. // Does not track dependency's wildcard directories.
...@@ -799,7 +799,7 @@ flutter: ...@@ -799,7 +799,7 @@ flutter:
expect(await bundle.build(packagesPath: '.packages'), 0); expect(await bundle.build(packagesPath: '.packages'), 0);
expect(bundle.entries.keys, unorderedEquals(<String>['assets/foo.txt', expect(bundle.entries.keys, unorderedEquals(<String>['assets/foo.txt',
'AssetManifest.json', 'AssetManifest.smcbin', 'FontManifest.json', 'NOTICES.Z'])); 'AssetManifest.json', 'AssetManifest.bin', 'FontManifest.json', 'NOTICES.Z']));
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem.test(), FileSystem: () => MemoryFileSystem.test(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager.any(),
......
...@@ -33,7 +33,7 @@ void main() { ...@@ -33,7 +33,7 @@ void main() {
} }
Future<Map<Object?, Object?>> extractAssetManifestSmcBinFromBundle(ManifestAssetBundle bundle) async { Future<Map<Object?, Object?>> extractAssetManifestSmcBinFromBundle(ManifestAssetBundle bundle) async {
final List<int> manifest = await bundle.entries['AssetManifest.smcbin']!.contentsAsBytes(); final List<int> manifest = await bundle.entries['AssetManifest.bin']!.contentsAsBytes();
final ByteData asByteData = ByteData.view(Uint8List.fromList(manifest).buffer); final ByteData asByteData = ByteData.view(Uint8List.fromList(manifest).buffer);
final Map<Object?, Object?> decoded = const StandardMessageCodec().decodeMessage(asByteData)! as Map<Object?, Object?>; final Map<Object?, Object?> decoded = const StandardMessageCodec().decodeMessage(asByteData)! as Map<Object?, Object?>;
return decoded; return decoded;
......
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