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
27a67962
Unverified
Commit
27a67962
authored
May 27, 2021
by
Lau Ching Jun
Committed by
GitHub
May 27, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix benchmark regression from #83427 (#83437)
parent
1bdf65c6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
4 deletions
+42
-4
run_hot.dart
packages/flutter_tools/lib/src/run_hot.dart
+10
-4
project_file_invalidator_test.dart
...ols/test/general.shard/project_file_invalidator_test.dart
+32
-0
No files found.
packages/flutter_tools/lib/src/run_hot.dart
View file @
27a67962
...
...
@@ -1241,9 +1241,11 @@ class ProjectFileInvalidator {
final
List
<
Future
<
void
>>
waitList
=
<
Future
<
void
>>[];
for
(
final
Uri
uri
in
urisToScan
)
{
waitList
.
add
(
pool
.
withResource
<
void
>(
()
=>
_fileSystem
.
file
(
uri
)
.
stat
()
// Calling fs.stat() is more performant than fs.file().stat(), but
// uri.toFilePath() does not work with MultiRootFileSystem.
()
=>
(
uri
.
hasScheme
&&
uri
.
scheme
!=
'file'
?
_fileSystem
.
file
(
uri
).
stat
()
:
_fileSystem
.
stat
(
uri
.
toFilePath
(
windows:
_platform
.
isWindows
)))
.
then
((
FileStat
stat
)
{
final
DateTime
updatedAt
=
stat
.
modified
;
if
(
updatedAt
!=
null
&&
updatedAt
.
isAfter
(
lastCompiled
))
{
...
...
@@ -1255,7 +1257,11 @@ class ProjectFileInvalidator {
await
Future
.
wait
<
void
>(
waitList
);
}
else
{
for
(
final
Uri
uri
in
urisToScan
)
{
final
DateTime
updatedAt
=
_fileSystem
.
file
(
uri
).
statSync
().
modified
;
// Calling fs.statSync() is more performant than fs.file().statSync(), but
// uri.toFilePath() does not work with MultiRootFileSystem.
final
DateTime
updatedAt
=
uri
.
hasScheme
&&
uri
.
scheme
!=
'file'
?
_fileSystem
.
file
(
uri
).
statSync
().
modified
:
_fileSystem
.
statSync
(
uri
.
toFilePath
(
windows:
_platform
.
isWindows
)).
modified
;
if
(
updatedAt
!=
null
&&
updatedAt
.
isAfter
(
lastCompiled
))
{
invalidatedFiles
.
add
(
uri
);
}
...
...
packages/flutter_tools/test/general.shard/project_file_invalidator_test.dart
View file @
27a67962
...
...
@@ -7,6 +7,7 @@
import
'package:file/memory.dart'
;
import
'package:flutter_tools/src/base/file_system.dart'
;
import
'package:flutter_tools/src/base/logger.dart'
;
import
'package:flutter_tools/src/base/multi_root_file_system.dart'
;
import
'package:flutter_tools/src/base/platform.dart'
;
import
'package:flutter_tools/src/convert.dart'
;
import
'package:flutter_tools/src/run_hot.dart'
;
...
...
@@ -164,5 +165,36 @@ void main() {
expect
(
nextInvalidationResult
.
packageConfig
,
isNot
(
invalidationResult
.
packageConfig
));
});
testWithoutContext
(
'Works with MultiRootFileSystem uris, asyncScanning:
$asyncScanning
'
,
()
async
{
final
FileSystem
fileSystem
=
MemoryFileSystem
.
test
();
final
FileSystem
multiRootFileSystem
=
MultiRootFileSystem
(
delegate:
fileSystem
,
scheme:
'scheme'
,
roots:
<
String
>[
'/root'
,
],
);
final
ProjectFileInvalidator
projectFileInvalidator
=
ProjectFileInvalidator
(
fileSystem:
multiRootFileSystem
,
platform:
FakePlatform
(),
logger:
BufferLogger
.
test
(),
);
expect
(
(
await
projectFileInvalidator
.
findInvalidated
(
lastCompiled:
inFuture
,
urisToMonitor:
<
Uri
>[
Uri
.
parse
(
'file1'
),
Uri
.
parse
(
'file:///file2'
),
Uri
.
parse
(
'scheme:///file3'
),
],
packagesPath:
'.packages'
,
asyncScanning:
asyncScanning
,
packageConfig:
PackageConfig
.
empty
,
)).
uris
,
isEmpty
,
);
});
}
}
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