Skip to content

Commit 0e7da1d

Browse files
authored
Remove deprecated AssetManifest.json file (flutter#172594)
Closes flutter#143577.
1 parent 476d998 commit 0e7da1d

File tree

15 files changed

+10
-164
lines changed

15 files changed

+10
-164
lines changed

dev/devicelab/lib/framework/apk_utils.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import 'task_result.dart';
1010
import 'utils.dart';
1111

1212
final List<String> flutterAssets = <String>[
13-
'assets/flutter_assets/AssetManifest.json',
13+
'assets/flutter_assets/AssetManifest.bin',
1414
'assets/flutter_assets/NOTICES.Z',
1515
'assets/flutter_assets/fonts/MaterialIcons-Regular.otf',
1616
'assets/flutter_assets/packages/cupertino_icons/assets/CupertinoIcons.ttf',

packages/flutter_test/test/bindings_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ void main() {
125125
) async {
126126
bool responded = false;
127127
// The particular asset does not matter, as long as it exists.
128-
rootBundle.load('AssetManifest.json').then((ByteData data) {
128+
rootBundle.load('AssetManifest.bin').then((ByteData data) {
129129
responded = true;
130130
});
131131
expect(responded, true);

packages/flutter_tools/lib/src/asset.dart

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,6 @@ class ManifestAssetBundle implements AssetBundle {
189189
DateTime? _lastBuildTimestamp;
190190

191191
// We assume the main asset is designed for a device pixel ratio of 1.0.
192-
static const _kAssetManifestJsonFilename = 'AssetManifest.json';
193192
static const _kAssetManifestBinFilename = 'AssetManifest.bin';
194193
static const _kAssetManifestBinJsonFilename = 'AssetManifest.bin.json';
195194

@@ -258,11 +257,6 @@ class ManifestAssetBundle implements AssetBundle {
258257
// device.
259258
_lastBuildTimestamp = DateTime.now();
260259
if (flutterManifest.isEmpty) {
261-
entries[_kAssetManifestJsonFilename] = AssetBundleEntry(
262-
DevFSStringContent('{}'),
263-
kind: AssetKind.regular,
264-
transformers: const <AssetTransformerEntry>[],
265-
);
266260
final ByteData emptyAssetManifest = const StandardMessageCodec().encodeMessage(
267261
<dynamic, dynamic>{},
268262
)!;
@@ -528,7 +522,6 @@ class ManifestAssetBundle implements AssetBundle {
528522
deferredComponentsAssetVariants,
529523
);
530524
final DevFSByteContent assetManifestBinary = _createAssetManifestBinary(assetManifest);
531-
final assetManifestJson = DevFSStringContent(json.encode(assetManifest));
532525
final fontManifest = DevFSStringContent(json.encode(fonts));
533526
final LicenseResult licenseResult = _licenseCollector.obtainLicenses(
534527
packageConfig,
@@ -556,7 +549,6 @@ class ManifestAssetBundle implements AssetBundle {
556549
);
557550
}
558551

559-
_setIfChanged(_kAssetManifestJsonFilename, assetManifestJson, AssetKind.regular);
560552
_setIfChanged(_kAssetManifestBinFilename, assetManifestBinary, AssetKind.regular);
561553
// Create .bin.json on web builds.
562554
if (targetPlatform == TargetPlatform.web_javascript) {

packages/flutter_tools/lib/src/build_system/targets/assets.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import 'native_assets.dart';
2727
/// Throws [Exception] if [AssetBundle.build] returns a non-zero exit code.
2828
///
2929
/// [additionalContent] may contain additional DevFS entries that will be
30-
/// included in the final bundle, but not the AssetManifest.json file.
30+
/// included in the final bundle, but not the AssetManifest.bin file.
3131
///
3232
/// Returns a [Depfile] containing all assets used in the build.
3333
Future<Depfile> copyAssets(

packages/flutter_tools/templates/widget_preview_scaffold/lib/src/widget_preview_rendering.dart.tmpl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -726,7 +726,6 @@ class PreviewAssetBundle extends PlatformAssetBundle {
726726
// actually located in the parent project, meaning their paths did not need
727727
// to be modified.
728728
if (key == 'AssetManifest.bin' ||
729-
key == 'AssetManifest.json' ||
730729
key == 'FontManifest.json' ||
731730
key.startsWith(_kPackagesPrefix) ||
732731
packageName == null) {

packages/flutter_tools/test/general.shard/android/android_gradle_builder_test.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -840,7 +840,6 @@ void main() {
840840
/base/assets/flutter_assets/NativeAssetsManifest.json
841841
/base/assets/flutter_assets/NOTICES.Z
842842
/base/assets/flutter_assets/FontManifest.json
843-
/base/assets/flutter_assets/AssetManifest.json
844843
/base/assets/flutter_assets/AssetManifest.bin
845844
/base/assets.pb
846845
/BundleConfig.pb

packages/flutter_tools/test/general.shard/asset_bundle_package_fonts_test.dart

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,12 +117,7 @@ $fontsSection
117117
await bundle.build(packageConfigPath: '.dart_tool/package_config.json');
118118
expect(
119119
bundle.entries.keys,
120-
unorderedEquals(<String>[
121-
'AssetManifest.bin',
122-
'AssetManifest.json',
123-
'FontManifest.json',
124-
'NOTICES.Z',
125-
]),
120+
unorderedEquals(<String>['AssetManifest.bin', 'FontManifest.json', 'NOTICES.Z']),
126121
);
127122
},
128123
overrides: <Type, Generator>{

packages/flutter_tools/test/general.shard/asset_bundle_package_test.dart

Lines changed: 4 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -76,16 +76,6 @@ $assetsSection
7676
''');
7777
}
7878

79-
Map<Object, Object> assetManifestBinToJson(Map<Object, Object> manifest) {
80-
List<Object> convertList(List<Object> variants) =>
81-
variants.map((Object variant) => (variant as Map<Object?, Object?>)['asset']!).toList();
82-
83-
return manifest.map(
84-
(Object key, Object value) =>
85-
MapEntry<Object, Object>(key, convertList(value as List<Object>)),
86-
);
87-
}
88-
8979
Future<void> buildAndVerifyAssets(
9080
List<String> assets,
9181
List<String> packages,
@@ -111,10 +101,6 @@ $assetsSection
111101
)
112102
as Map<Object?, Object?>;
113103

114-
expect(
115-
json.decode(utf8.decode(await bundle.entries['AssetManifest.json']!.contentsAsBytes())),
116-
assetManifestBinToJson(expectedAssetManifest),
117-
);
118104
expect(assetManifest, expectedAssetManifest);
119105
}
120106

@@ -155,17 +141,7 @@ $assetsSection
155141
await bundle.build(packageConfigPath: '.dart_tool/package_config.json');
156142
expect(
157143
bundle.entries.keys,
158-
unorderedEquals(<String>[
159-
'NOTICES.Z',
160-
'AssetManifest.json',
161-
'AssetManifest.bin',
162-
'FontManifest.json',
163-
]),
164-
);
165-
const expectedAssetManifest = '{}';
166-
expect(
167-
utf8.decode(await bundle.entries['AssetManifest.json']!.contentsAsBytes()),
168-
expectedAssetManifest,
144+
unorderedEquals(<String>['NOTICES.Z', 'AssetManifest.bin', 'FontManifest.json']),
169145
);
170146
expect(utf8.decode(await bundle.entries['FontManifest.json']!.contentsAsBytes()), '[]');
171147
},
@@ -193,17 +169,7 @@ $assetsSection
193169
await bundle.build(packageConfigPath: '.dart_tool/package_config.json');
194170
expect(
195171
bundle.entries.keys,
196-
unorderedEquals(<String>[
197-
'NOTICES.Z',
198-
'AssetManifest.json',
199-
'AssetManifest.bin',
200-
'FontManifest.json',
201-
]),
202-
);
203-
const expectedAssetManifest = '{}';
204-
expect(
205-
utf8.decode(await bundle.entries['AssetManifest.json']!.contentsAsBytes()),
206-
expectedAssetManifest,
172+
unorderedEquals(<String>['NOTICES.Z', 'AssetManifest.bin', 'FontManifest.json']),
207173
);
208174
expect(utf8.decode(await bundle.entries['FontManifest.json']!.contentsAsBytes()), '[]');
209175
},
@@ -702,9 +668,9 @@ $assetsSection
702668
await bundle.build(packageConfigPath: '.dart_tool/package_config.json');
703669

704670
expect(
705-
bundle.entries['AssetManifest.json'],
671+
bundle.entries['AssetManifest.bin'],
706672
isNull,
707-
reason: 'Invalid pubspec.yaml should not generate AssetManifest.json',
673+
reason: 'Invalid pubspec.yaml should not generate AssetManifest.bin',
708674
);
709675
},
710676
overrides: <Type, Generator>{

packages/flutter_tools/test/general.shard/asset_bundle_test.dart

Lines changed: 2 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -63,16 +63,8 @@ void main() {
6363

6464
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
6565
await bundle.build(packageConfigPath: '.dart_tool/package_config.json');
66-
expect(
67-
bundle.entries.keys,
68-
unorderedEquals(<String>['AssetManifest.json', 'AssetManifest.bin']),
69-
);
70-
const expectedJsonAssetManifest = '{}';
66+
expect(bundle.entries.keys, unorderedEquals(<String>['AssetManifest.bin']));
7167
const expectedBinAssetManifest = <Object, Object>{};
72-
expect(
73-
utf8.decode(await bundle.entries['AssetManifest.json']!.contentsAsBytes()),
74-
expectedJsonAssetManifest,
75-
);
7668
expect(
7769
const StandardMessageCodec().decodeMessage(
7870
ByteData.sublistView(
@@ -122,7 +114,6 @@ flutter:
122114
expect(
123115
bundle.entries.keys,
124116
unorderedEquals(<String>[
125-
'AssetManifest.json',
126117
'AssetManifest.bin',
127118
'FontManifest.json',
128119
'NOTICES.Z',
@@ -162,7 +153,6 @@ flutter:
162153
expect(
163154
bundle.entries.keys,
164155
unorderedEquals(<String>[
165-
'AssetManifest.json',
166156
'AssetManifest.bin',
167157
'FontManifest.json',
168158
'NOTICES.Z',
@@ -179,7 +169,6 @@ flutter:
179169
expect(
180170
bundle.entries.keys,
181171
unorderedEquals(<String>[
182-
'AssetManifest.json',
183172
'AssetManifest.bin',
184173
'FontManifest.json',
185174
'NOTICES.Z',
@@ -218,7 +207,6 @@ flutter:
218207
expect(
219208
bundle.entries.keys,
220209
unorderedEquals(<String>[
221-
'AssetManifest.json',
222210
'AssetManifest.bin',
223211
'FontManifest.json',
224212
'NOTICES.Z',
@@ -247,7 +235,6 @@ name: my_app''')
247235
expect(
248236
bundle.entries.keys,
249237
unorderedEquals(<String>[
250-
'AssetManifest.json',
251238
'AssetManifest.bin',
252239
'FontManifest.json',
253240
'NOTICES.Z',
@@ -286,7 +273,6 @@ flutter:
286273
expect(
287274
bundle.entries.keys,
288275
unorderedEquals(<String>[
289-
'AssetManifest.json',
290276
'AssetManifest.bin',
291277
'FontManifest.json',
292278
'NOTICES.Z',
@@ -341,7 +327,6 @@ flutter:
341327
expect(
342328
bundle.entries.keys,
343329
unorderedEquals(<String>[
344-
'AssetManifest.json',
345330
'AssetManifest.bin',
346331
'FontManifest.json',
347332
'NOTICES.Z',
@@ -393,7 +378,6 @@ flutter:
393378
'assets/foo/bar.txt',
394379
'assets/bar/barbie.txt',
395380
'assets/wild/dash.txt',
396-
'AssetManifest.json',
397381
'AssetManifest.bin',
398382
'FontManifest.json',
399383
'NOTICES.Z',
@@ -452,7 +436,6 @@ flutter:
452436
bundle.entries.keys,
453437
unorderedEquals(<String>[
454438
'assets/foo/bar.txt',
455-
'AssetManifest.json',
456439
'AssetManifest.bin',
457440
'FontManifest.json',
458441
'NOTICES.Z',
@@ -477,7 +460,6 @@ flutter:
477460
bundle.entries.keys,
478461
unorderedEquals(<String>[
479462
'assets/foo/bar.txt',
480-
'AssetManifest.json',
481463
'AssetManifest.bin',
482464
'FontManifest.json',
483465
'NOTICES.Z',
@@ -679,13 +661,8 @@ flutter:
679661

680662
expect(
681663
bundle.entries.keys,
682-
unorderedEquals(<String>[
683-
'AssetManifest.json',
684-
'AssetManifest.bin',
685-
'AssetManifest.bin.json',
686-
]),
664+
unorderedEquals(<String>['AssetManifest.bin', 'AssetManifest.bin.json']),
687665
);
688-
expect(utf8.decode(await bundle.entries['AssetManifest.json']!.contentsAsBytes()), '{}');
689666
expect(
690667
utf8.decode(await bundle.entries['AssetManifest.bin.json']!.contentsAsBytes()),
691668
'""',
@@ -724,19 +701,13 @@ flutter:
724701
expect(
725702
bundle.entries.keys,
726703
unorderedEquals(<String>[
727-
'AssetManifest.json',
728704
'AssetManifest.bin',
729705
'AssetManifest.bin.json',
730706
'FontManifest.json',
731707
'NOTICES', // not .Z
732708
'assets/bar/lizard.png',
733709
]),
734710
);
735-
final manifestJson =
736-
json.decode(utf8.decode(await bundle.entries['AssetManifest.json']!.contentsAsBytes()))
737-
as Map<Object?, Object?>;
738-
expect(manifestJson, isNotEmpty);
739-
expect(manifestJson['assets/bar/lizard.png'], isNotNull);
740711

741712
final Uint8List manifestBinJsonBytes = base64.decode(
742713
json.decode(
@@ -806,13 +777,11 @@ assets:
806777
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
807778
await bundle.build(packageConfigPath: '.dart_tool/package_config.json');
808779

809-
final AssetBundleEntry? assetManifest = bundle.entries['AssetManifest.json'];
810780
final AssetBundleEntry? fontManifest = bundle.entries['FontManifest.json'];
811781
final AssetBundleEntry? license = bundle.entries['NOTICES'];
812782

813783
await bundle.build(packageConfigPath: '.dart_tool/package_config.json');
814784

815-
expect(assetManifest, bundle.entries['AssetManifest.json']);
816785
expect(fontManifest, bundle.entries['FontManifest.json']);
817786
expect(license, bundle.entries['NOTICES']);
818787
},
@@ -1181,7 +1150,6 @@ flutter:
11811150
bundle.entries.keys,
11821151
unorderedEquals(<String>[
11831152
'packages/foo/bar/fizz.txt',
1184-
'AssetManifest.json',
11851153
'AssetManifest.bin',
11861154
'FontManifest.json',
11871155
'NOTICES.Z',
@@ -1299,7 +1267,6 @@ flutter:
12991267

13001268
expect(await bundle.build(packageConfigPath: '.dart_tool/package_config.json'), 0);
13011269
expect((bundle.entries['FontManifest.json']!.content as DevFSStringContent).string, '[]');
1302-
expect((bundle.entries['AssetManifest.json']!.content as DevFSStringContent).string, '{}');
13031270
expect(testLogger.errorText, contains('package:foo has `uses-material-design: true` set'));
13041271
},
13051272
overrides: <Type, Generator>{
@@ -1339,7 +1306,6 @@ flutter:
13391306
bundle.entries.keys,
13401307
unorderedEquals(<String>[
13411308
'assets/foo.txt',
1342-
'AssetManifest.json',
13431309
'AssetManifest.bin',
13441310
'FontManifest.json',
13451311
'NOTICES.Z',
@@ -1381,12 +1347,6 @@ flutter:
13811347

13821348
expect(await bundle.build(packageConfigPath: '.dart_tool/package_config.json'), 0);
13831349
expect((bundle.entries['FontManifest.json']!.content as DevFSStringContent).string, '[]');
1384-
// The assets from deferred components and regular assets
1385-
// are both included in alphabetical order
1386-
expect(
1387-
(bundle.entries['AssetManifest.json']!.content as DevFSStringContent).string,
1388-
'{"assets/apple.jpg":["assets/apple.jpg"],"assets/bar.jpg":["assets/bar.jpg"],"assets/foo.jpg":["assets/foo.jpg"],"assets/zebra.jpg":["assets/zebra.jpg"]}',
1389-
);
13901350
},
13911351
overrides: <Type, Generator>{
13921352
FileSystem: () => MemoryFileSystem.test(),

0 commit comments

Comments
 (0)