Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
6d1966ef
Unverified
Commit
6d1966ef
authored
May 04, 2020
by
Jonah Williams
Committed by
GitHub
May 04, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] make gallery hot reload 5x faster with one neat trick (#56224)
parent
c8c55b40
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
2 deletions
+47
-2
asset.dart
packages/flutter_tools/lib/src/asset.dart
+4
-2
asset_bundle_test.dart
...s/flutter_tools/test/general.shard/asset_bundle_test.dart
+43
-0
No files found.
packages/flutter_tools/lib/src/asset.dart
View file @
6d1966ef
...
...
@@ -74,7 +74,8 @@ class ManifestAssetBundle implements AssetBundle {
final
Map
<
String
,
DevFSContent
>
entries
=
<
String
,
DevFSContent
>{};
// If an asset corresponds to a wildcard directory, then it may have been
// updated without changes to the manifest.
// updated without changes to the manifest. These are only tracked for
// the current project.
final
Map
<
Uri
,
Directory
>
_wildcardDirectories
=
<
Uri
,
Directory
>{};
final
LicenseCollector
licenseCollector
=
LicenseCollector
(
fileSystem:
globals
.
fs
);
...
...
@@ -203,7 +204,8 @@ class ManifestAssetBundle implements AssetBundle {
final
Map
<
_Asset
,
List
<
_Asset
>>
packageAssets
=
_parseAssets
(
packageConfig
,
packageFlutterManifest
,
wildcardDirectories
,
// Do not track wildcard directories for dependencies.
<
Uri
>[],
packageBasePath
,
packageName:
package
.
name
,
);
...
...
packages/flutter_tools/test/general.shard/asset_bundle_test.dart
View file @
6d1966ef
...
...
@@ -14,6 +14,7 @@ import 'package:flutter_tools/src/cache.dart';
import
'package:flutter_tools/src/devfs.dart'
;
import
'package:flutter_tools/src/globals.dart'
as
globals
;
import
'package:mockito/mockito.dart'
;
import
'package:platform/platform.dart'
;
import
'../src/common.dart'
;
import
'../src/context.dart'
;
...
...
@@ -223,6 +224,48 @@ assets:
FileSystem:
()
=>
MemoryFileSystem
.
test
(),
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
testUsingContext
(
'does not track wildcard directories from dependencies'
,
()
async
{
globals
.
fs
.
file
(
'.packages'
).
writeAsStringSync
(
r''
'
example:lib/
foo:foo/lib/
'''
);
globals
.
fs
.
file
(
globals
.
fs
.
path
.
join
(
'assets'
,
'foo'
,
'bar.txt'
))
.
createSync
(
recursive:
true
);
globals
.
fs
.
file
(
'pubspec.yaml'
)
..
createSync
()
..
writeAsStringSync
(
r''
'
name: example
dependencies:
foo: any
'''
);
globals
.
fs
.
file
(
'foo/pubspec.yaml'
)
..
createSync
(
recursive:
true
)
..
writeAsStringSync
(
r''
'
name: foo
flutter:
assets:
- bar/
'''
);
final
AssetBundle
bundle
=
AssetBundleFactory
.
instance
.
createBundle
();
globals
.
fs
.
file
(
'foo/bar/fizz.txt'
).
createSync
(
recursive:
true
);
await
bundle
.
build
(
manifestPath:
'pubspec.yaml'
);
expect
(
bundle
.
entries
,
hasLength
(
4
));
expect
(
bundle
.
needsBuild
(
manifestPath:
'pubspec.yaml'
),
false
);
// Does not track dependency's wildcard directories.
globals
.
fs
.
file
(
globals
.
fs
.
path
.
join
(
'assets'
,
'foo'
,
'bar.txt'
))
.
deleteSync
();
expect
(
bundle
.
needsBuild
(
manifestPath:
'pubspec.yaml'
),
false
);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
MemoryFileSystem
.
test
(),
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
Platform:
()
=>
FakePlatform
(
operatingSystem:
'linux'
),
});
}
class
MockDirectory
extends
Mock
implements
Directory
{}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment