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
9a0a0d99
Commit
9a0a0d99
authored
Aug 12, 2016
by
John McCutchan
Committed by
GitHub
Aug 12, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix package:<project_package> imports in hot reload mode (#5372)
parent
3e82d328
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
7 deletions
+32
-7
devfs.dart
packages/flutter_tools/lib/src/devfs.dart
+32
-7
No files found.
packages/flutter_tools/lib/src/devfs.dart
View file @
9a0a0d99
...
...
@@ -306,18 +306,26 @@ class DevFS {
for
(
String
packageName
in
packageMap
.
map
.
keys
)
{
Uri
uri
=
packageMap
.
map
[
packageName
];
// Ignore self-references.
if
(
uri
.
toString
()
==
'lib/'
)
continue
;
// This project's own package.
final
bool
isProjectPackage
=
uri
.
toString
()
==
'lib/'
;
final
String
directoryName
=
isProjectPackage
?
'lib'
:
'packages/
$packageName
'
;
// If this is the project's package, we need to pass both
// package:<package_name> and lib/ as paths to be checked against
// the filter because we must support both package: imports and relative
// path imports within the project's own code.
final
String
packagesDirectoryName
=
isProjectPackage
?
'packages/
$packageName
'
:
null
;
Directory
directory
=
new
Directory
.
fromUri
(
uri
);
bool
packageExists
=
await
_scanDirectory
(
directory
,
directoryName:
'packages/
$packageName
'
,
directoryName:
directoryName
,
recursive:
true
,
packagesDirectoryName:
packagesDirectoryName
,
fileFilter:
fileFilter
);
if
(
packageExists
)
{
sb
??=
new
StringBuffer
();
sb
.
writeln
(
'
$packageName
:
packages/
$package
Name
'
);
sb
.
writeln
(
'
$packageName
:
$directory
Name
'
);
}
}
}
...
...
@@ -460,6 +468,7 @@ class DevFS {
{
String
directoryName
,
bool
recursive:
false
,
bool
ignoreDotFiles:
true
,
String
packagesDirectoryName
,
Set
<
String
>
fileFilter
})
async
{
String
prefix
=
directoryName
;
if
(
prefix
==
null
)
{
...
...
@@ -479,10 +488,26 @@ class DevFS {
// Skip dot files.
continue
;
}
final
String
devicePath
=
path
.
join
(
prefix
,
path
.
relative
(
file
.
path
,
from:
directory
.
path
));
final
String
relativePath
=
path
.
relative
(
file
.
path
,
from:
directory
.
path
);
final
String
devicePath
=
path
.
join
(
prefix
,
relativePath
);
bool
filtered
=
false
;
if
((
fileFilter
!=
null
)
&&
!
fileFilter
.
contains
(
devicePath
))
{
if
(
packagesDirectoryName
!=
null
)
{
// Double check the filter for packages/packagename/
final
String
packagesDevicePath
=
path
.
join
(
packagesDirectoryName
,
relativePath
);
if
(!
fileFilter
.
contains
(
packagesDevicePath
))
{
// File was not in the filter set.
filtered
=
true
;
}
}
else
{
// File was not in the filter set.
filtered
=
true
;
}
}
if
(
filtered
)
{
// Skip files that are not included in the filter.
continue
;
}
...
...
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