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
fc9f7dea
Unverified
Commit
fc9f7dea
authored
Mar 21, 2019
by
Jonah Williams
Committed by
GitHub
Mar 21, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allowing adding/updating packages during hot reload (#29747)
parent
c80366a1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
5 deletions
+22
-5
devfs.dart
packages/flutter_tools/lib/src/devfs.dart
+3
-0
run_hot.dart
packages/flutter_tools/lib/src/run_hot.dart
+15
-3
project_file_invalidator_test.dart
...ges/flutter_tools/test/project_file_invalidator_test.dart
+4
-2
No files found.
packages/flutter_tools/lib/src/devfs.dart
View file @
fc9f7dea
...
...
@@ -481,6 +481,9 @@ class DevFS {
outputPath:
dillOutputPath
??
getDefaultApplicationKernelPath
(
trackWidgetCreation:
trackWidgetCreation
),
packagesFilePath
:
_packagesFilePath
,
);
if
(
compilerOutput
==
null
)
{
return
UpdateFSReport
(
success:
false
);
}
// list of sources that needs to be monitored are in [compilerOutput.sources]
sources
=
compilerOutput
.
sources
;
//
...
...
packages/flutter_tools/lib/src/run_hot.dart
View file @
fc9f7dea
...
...
@@ -317,7 +317,9 @@ class HotRunner extends ResidentRunner {
// for all devices should be in sync.
final
List
<
Uri
>
invalidatedFiles
=
ProjectFileInvalidator
.
findInvalidated
(
lastCompiled:
flutterDevices
[
0
].
devFS
.
lastCompiled
,
urisToMonitor:
flutterDevices
[
0
].
devFS
.
sources
);
urisToMonitor:
flutterDevices
[
0
].
devFS
.
sources
,
packagesPath:
packagesFilePath
,
);
final
UpdateFSReport
results
=
UpdateFSReport
(
success:
true
);
for
(
FlutterDevice
device
in
flutterDevices
)
{
results
.
incorporateResults
(
await
device
.
updateDevFS
(
...
...
@@ -939,8 +941,11 @@ class ProjectFileInvalidator {
static
const
String
_pubCachePathLinuxAndMac
=
'.pub-cache'
;
static
const
String
_pubCachePathWindows
=
'Pub/Cache'
;
static
List
<
Uri
>
findInvalidated
({
@required
DateTime
lastCompiled
,
@required
List
<
Uri
>
urisToMonitor
})
{
static
List
<
Uri
>
findInvalidated
({
@required
DateTime
lastCompiled
,
@required
List
<
Uri
>
urisToMonitor
,
@required
String
packagesPath
,
})
{
final
List
<
Uri
>
invalidatedFiles
=
<
Uri
>[];
int
scanned
=
0
;
final
Stopwatch
stopwatch
=
Stopwatch
()..
start
();
...
...
@@ -960,6 +965,13 @@ class ProjectFileInvalidator {
invalidatedFiles
.
add
(
uri
);
}
}
// we need to check the .packages file too since it is not used in compilation.
final
DateTime
packagesUpdatedAt
=
fs
.
statSync
(
packagesPath
).
modified
;
if
(
lastCompiled
!=
null
&&
packagesUpdatedAt
!=
null
&&
packagesUpdatedAt
.
millisecondsSinceEpoch
>
lastCompiled
.
millisecondsSinceEpoch
)
{
invalidatedFiles
.
add
(
fs
.
file
(
packagesPath
).
uri
);
scanned
++;
}
printTrace
(
'Scanned through
$scanned
files in
${stopwatch.elapsedMilliseconds}
ms'
);
return
invalidatedFiles
;
}
...
...
packages/flutter_tools/test/project_file_invalidator_test.dart
View file @
fc9f7dea
...
...
@@ -14,7 +14,7 @@ void main() {
final
MemoryFileSystem
memoryFileSystem
=
MemoryFileSystem
();
testUsingContext
(
'Empty project'
,
()
async
{
expect
(
ProjectFileInvalidator
.
findInvalidated
(
lastCompiled:
DateTime
.
now
(),
urisToMonitor:
<
Uri
>[]),
ProjectFileInvalidator
.
findInvalidated
(
lastCompiled:
DateTime
.
now
(),
urisToMonitor:
<
Uri
>[]
,
packagesPath:
''
),
isEmpty
);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
memoryFileSystem
,
...
...
@@ -24,7 +24,9 @@ void main() {
expect
(
ProjectFileInvalidator
.
findInvalidated
(
lastCompiled:
DateTime
.
now
(),
urisToMonitor:
<
Uri
>[
Uri
.
parse
(
'/not-there-anymore'
)]),
urisToMonitor:
<
Uri
>[
Uri
.
parse
(
'/not-there-anymore'
),],
packagesPath:
''
,
),
isEmpty
);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
memoryFileSystem
,
...
...
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