forked from firka/flutter
ensure lastBuildTimestamp is set before early return (#25058)
This commit is contained in:
@@ -107,6 +107,10 @@ class _ManifestAssetBundle implements AssetBundle {
|
||||
if (flutterManifest == null)
|
||||
return 1;
|
||||
|
||||
// If the last build time isn't set before this early return, empty pubspecs will
|
||||
// hang on hot reload, as the incremental dill files will never be copied to the
|
||||
// device.
|
||||
_lastBuildTimestamp = DateTime.now();
|
||||
if (flutterManifest.isEmpty) {
|
||||
entries[_assetManifestJson] = DevFSStringContent('{}');
|
||||
return 0;
|
||||
@@ -114,8 +118,6 @@ class _ManifestAssetBundle implements AssetBundle {
|
||||
|
||||
final String assetBasePath = fs.path.dirname(fs.path.absolute(manifestPath));
|
||||
|
||||
_lastBuildTimestamp = DateTime.now();
|
||||
|
||||
final PackageMap packageMap = PackageMap(packagesPath);
|
||||
|
||||
// The _assetVariants map contains an entry for each asset listed
|
||||
|
||||
@@ -41,8 +41,26 @@ void main() {
|
||||
await getValueAsString('FontManifest.json', asset),
|
||||
'[{"family":"packages/font/test_font","fonts":[{"asset":"packages/font/test_font_file"}]}]',
|
||||
);
|
||||
expect(asset.wasBuiltOnce(), true);
|
||||
});
|
||||
|
||||
testUsingContext('handles empty pubspec with .packages', () async {
|
||||
final String dataPath = fs.path.join(
|
||||
getFlutterRoot(),
|
||||
'packages',
|
||||
'flutter_tools',
|
||||
'test',
|
||||
'data',
|
||||
'fuchsia_test',
|
||||
);
|
||||
final AssetBundle asset = AssetBundleFactory.instance.createBundle();
|
||||
await asset.build(
|
||||
manifestPath : fs.path.join(dataPath, 'main', 'pubspec.yaml'), // file doesn't exist
|
||||
packagesPath: fs.path.join(dataPath, 'main', '.packages'),
|
||||
includeDefaultFonts: false,
|
||||
);
|
||||
expect(asset.wasBuiltOnce(), true);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
1
packages/flutter_tools/test/data/fuchsia_test/main/.gitignore
vendored
Normal file
1
packages/flutter_tools/test/data/fuchsia_test/main/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
!.packages
|
||||
@@ -0,0 +1 @@
|
||||
testo:lib/
|
||||
Reference in New Issue
Block a user