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
377f4451
Unverified
Commit
377f4451
authored
Mar 21, 2019
by
Jonah Williams
Committed by
GitHub
Mar 21, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix asset reloading (#29469)
parent
4e796415
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
22 additions
and
30 deletions
+22
-30
asset.dart
packages/flutter_tools/lib/src/asset.dart
+2
-2
devfs.dart
packages/flutter_tools/lib/src/devfs.dart
+17
-23
resident_runner.dart
packages/flutter_tools/lib/src/resident_runner.dart
+0
-1
run_hot.dart
packages/flutter_tools/lib/src/run_hot.dart
+3
-3
hot_test.dart
packages/flutter_tools/test/hot_test.dart
+0
-1
No files found.
packages/flutter_tools/lib/src/asset.dart
View file @
377f4451
...
...
@@ -193,7 +193,7 @@ class _ManifestAssetBundle implements AssetBundle {
}
for
(
_Asset
variant
in
assetVariants
[
asset
])
{
assert
(
variant
.
assetFileExists
);
entries
[
variant
.
entryUri
.
path
]
=
DevFSFileContent
(
variant
.
assetFile
);
entries
[
variant
.
entryUri
.
path
]
??
=
DevFSFileContent
(
variant
.
assetFile
);
}
}
...
...
@@ -203,7 +203,7 @@ class _ManifestAssetBundle implements AssetBundle {
}
for
(
_Asset
asset
in
materialAssets
)
{
assert
(
asset
.
assetFileExists
);
entries
[
asset
.
entryUri
.
path
]
=
DevFSFileContent
(
asset
.
assetFile
);
entries
[
asset
.
entryUri
.
path
]
??
=
DevFSFileContent
(
asset
.
assetFile
);
}
entries
[
_assetManifestJson
]
=
_createAssetManifest
(
assetVariants
);
...
...
packages/flutter_tools/lib/src/devfs.dart
View file @
377f4451
...
...
@@ -385,7 +385,6 @@ class DevFS {
final
String
fsName
;
final
Directory
rootDirectory
;
String
_packagesFilePath
;
final
Map
<
Uri
,
DevFSContent
>
_entries
=
<
Uri
,
DevFSContent
>{};
final
Set
<
String
>
assetPathsToEvict
=
<
String
>{};
List
<
Uri
>
sources
=
<
Uri
>[];
DateTime
lastCompiled
;
...
...
@@ -434,7 +433,6 @@ class DevFS {
AssetBundle
bundle
,
DateTime
firstBuildTime
,
bool
bundleFirstUpload
=
false
,
bool
bundleDirty
=
false
,
@required
ResidentCompiler
generator
,
String
dillOutputPath
,
@required
bool
trackWidgetCreation
,
...
...
@@ -446,6 +444,11 @@ class DevFS {
assert
(
trackWidgetCreation
!=
null
);
assert
(
generator
!=
null
);
// Update modified files
final
String
assetBuildDirPrefix
=
_asUriPath
(
getAssetBuildDirectory
());
final
Map
<
Uri
,
DevFSContent
>
dirtyEntries
=
<
Uri
,
DevFSContent
>{};
int
syncedBytes
=
0
;
if
(
bundle
!=
null
)
{
printTrace
(
'Scanning asset files'
);
// We write the assets into the AssetBundle working dir so that they
...
...
@@ -453,29 +456,20 @@ class DevFS {
final
String
assetDirectory
=
getAssetBuildDirectory
();
bundle
.
entries
.
forEach
((
String
archivePath
,
DevFSContent
content
)
{
final
Uri
deviceUri
=
fs
.
path
.
toUri
(
fs
.
path
.
join
(
assetDirectory
,
archivePath
));
_entries
[
deviceUri
]
=
content
;
if
(
deviceUri
.
path
.
startsWith
(
assetBuildDirPrefix
))
{
archivePath
=
deviceUri
.
path
.
substring
(
assetBuildDirPrefix
.
length
);
}
// Only update assets if they have been modified, or if this is the
// first upload of the asset bundle.
if
(
content
.
isModified
||
(
bundleFirstUpload
&&
archivePath
!=
null
))
{
dirtyEntries
[
deviceUri
]
=
content
;
syncedBytes
+=
content
.
size
;
if
(
archivePath
!=
null
&&
!
bundleFirstUpload
)
{
assetPathsToEvict
.
add
(
archivePath
);
}
}
});
}
// Update modified files
final
String
assetBuildDirPrefix
=
_asUriPath
(
getAssetBuildDirectory
());
final
Map
<
Uri
,
DevFSContent
>
dirtyEntries
=
<
Uri
,
DevFSContent
>{};
int
syncedBytes
=
0
;
_entries
.
forEach
((
Uri
deviceUri
,
DevFSContent
content
)
{
String
archivePath
;
if
(
deviceUri
.
path
.
startsWith
(
assetBuildDirPrefix
))
archivePath
=
deviceUri
.
path
.
substring
(
assetBuildDirPrefix
.
length
);
// When doing full restart, copy content so that isModified does not
// reset last check timestamp because we want to report all modified
// files to incremental compiler next time user does hot reload.
if
(
content
.
isModified
||
((
bundleDirty
||
bundleFirstUpload
)
&&
archivePath
!=
null
))
{
dirtyEntries
[
deviceUri
]
=
content
;
syncedBytes
+=
content
.
size
;
if
(
archivePath
!=
null
&&
(!
bundleFirstUpload
||
content
.
isModifiedAfter
(
firstBuildTime
)))
assetPathsToEvict
.
add
(
archivePath
);
}
});
if
(
fullRestart
)
{
generator
.
reset
();
}
...
...
packages/flutter_tools/lib/src/resident_runner.dart
View file @
377f4451
...
...
@@ -455,7 +455,6 @@ class FlutterDevice {
bundle:
bundle
,
firstBuildTime:
firstBuildTime
,
bundleFirstUpload:
bundleFirstUpload
,
bundleDirty:
bundleDirty
,
generator:
generator
,
fullRestart:
fullRestart
,
dillOutputPath:
dillOutputPath
,
...
...
packages/flutter_tools/lib/src/run_hot.dart
View file @
377f4451
...
...
@@ -936,7 +936,7 @@ class HotRunner extends ResidentRunner {
}
class
ProjectFileInvalidator
{
static
const
String
_pubCachePathLinuxAnd
Windows
=
'.pub-cache'
;
static
const
String
_pubCachePathLinuxAnd
Mac
=
'.pub-cache'
;
static
const
String
_pubCachePathWindows
=
'Pub/Cache'
;
static
List
<
Uri
>
findInvalidated
({
@required
DateTime
lastCompiled
,
...
...
@@ -946,7 +946,7 @@ class ProjectFileInvalidator {
final
Stopwatch
stopwatch
=
Stopwatch
()..
start
();
for
(
Uri
uri
in
urisToMonitor
)
{
if
((
platform
.
isWindows
&&
uri
.
path
.
contains
(
_pubCachePathWindows
))
||
uri
.
path
.
contains
(
_pubCachePathLinuxAnd
Windows
))
{
||
uri
.
path
.
contains
(
_pubCachePathLinuxAnd
Mac
))
{
// Don't watch pub cache directories to speed things up a little.
continue
;
}
...
...
@@ -963,4 +963,4 @@ class ProjectFileInvalidator {
printTrace
(
'Scanned through
$scanned
files in
${stopwatch.elapsedMilliseconds}
ms'
);
return
invalidatedFiles
;
}
}
\ No newline at end of file
}
packages/flutter_tools/test/hot_test.dart
View file @
377f4451
...
...
@@ -104,7 +104,6 @@ void main() {
bundle:
anyNamed
(
'bundle'
),
firstBuildTime:
anyNamed
(
'firstBuildTime'
),
bundleFirstUpload:
anyNamed
(
'bundleFirstUpload'
),
bundleDirty:
anyNamed
(
'bundleDirty'
),
generator:
anyNamed
(
'generator'
),
fullRestart:
anyNamed
(
'fullRestart'
),
dillOutputPath:
anyNamed
(
'dillOutputPath'
),
...
...
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