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
8220f8f4
Unverified
Commit
8220f8f4
authored
Mar 29, 2019
by
Jonah Williams
Committed by
GitHub
Mar 29, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add missing test case and handle wildcard removal (#30205)
parent
6b2e9394
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
1 deletion
+48
-1
asset.dart
packages/flutter_tools/lib/src/asset.dart
+5
-1
asset_bundle_test.dart
packages/flutter_tools/test/asset_bundle_test.dart
+43
-0
No files found.
packages/flutter_tools/lib/src/asset.dart
View file @
8220f8f4
...
@@ -88,7 +88,11 @@ class _ManifestAssetBundle implements AssetBundle {
...
@@ -88,7 +88,11 @@ class _ManifestAssetBundle implements AssetBundle {
return
true
;
return
true
;
for
(
Directory
directory
in
_wildcardDirectories
.
values
)
{
for
(
Directory
directory
in
_wildcardDirectories
.
values
)
{
if
(
directory
.
statSync
().
modified
.
isAfter
(
_lastBuildTimestamp
))
{
final
DateTime
dateTime
=
directory
.
statSync
().
modified
;
if
(
dateTime
==
null
)
{
continue
;
}
if
(
dateTime
.
isAfter
(
_lastBuildTimestamp
))
{
return
true
;
return
true
;
}
}
}
}
...
...
packages/flutter_tools/test/asset_bundle_test.dart
View file @
8220f8f4
...
@@ -96,6 +96,49 @@ flutter:
...
@@ -96,6 +96,49 @@ flutter:
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
testFileSystem
,
FileSystem:
()
=>
testFileSystem
,
});
});
testUsingContext
(
'handle removal of wildcard directories'
,
()
async
{
fs
.
file
(
'.packages'
).
createSync
();
fs
.
file
(
fs
.
path
.
join
(
'assets'
,
'foo'
,
'bar.txt'
)).
createSync
(
recursive:
true
);
fs
.
file
(
'pubspec.yaml'
)
..
createSync
()
..
writeAsStringSync
(
r''
'
name: example
flutter:
assets:
- assets/foo/
'''
);
final
AssetBundle
bundle
=
AssetBundleFactory
.
instance
.
createBundle
();
await
bundle
.
build
(
manifestPath:
'pubspec.yaml'
);
// Expected assets:
// - asset manifest
// - font manifest
// - license file
// - assets/foo/bar.txt
expect
(
bundle
.
entries
.
length
,
4
);
expect
(
bundle
.
needsBuild
(
manifestPath:
'pubspec.yaml'
),
false
);
// Delete the wildcard directory and update pubspec file.
fs
.
directory
(
fs
.
path
.
join
(
'assets'
,
'foo'
)).
deleteSync
(
recursive:
true
);
fs
.
file
(
'pubspec.yaml'
)
..
createSync
()
..
writeAsStringSync
(
r''
'
name: example'''
);
// Even though the previous file was removed, it is left in the
// asset manifest and not updated. This is due to the devfs not
// supporting file deletion.
expect
(
bundle
.
needsBuild
(
manifestPath:
'pubspec.yaml'
),
true
);
await
bundle
.
build
(
manifestPath:
'pubspec.yaml'
);
// Expected assets:
// - asset manifest
// - font manifest
// - license file
// - assets/foo/bar.txt
expect
(
bundle
.
entries
.
length
,
4
);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
testFileSystem
,
});
});
});
}
}
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