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
04e04ffa
Unverified
Commit
04e04ffa
authored
Oct 14, 2019
by
Jonah Williams
Committed by
GitHub
Oct 14, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Deflake wildcard asset test (#42597)
parent
e7ffac2d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
15 deletions
+22
-15
asset.dart
packages/flutter_tools/lib/src/asset.dart
+10
-5
asset_bundle_test.dart
...s/flutter_tools/test/general.shard/asset_bundle_test.dart
+12
-10
No files found.
packages/flutter_tools/lib/src/asset.dart
View file @
04e04ffa
...
...
@@ -91,12 +91,17 @@ class _ManifestAssetBundle implements AssetBundle {
}
for
(
Directory
directory
in
_wildcardDirectories
.
values
)
{
final
DateTime
dateTime
=
directory
.
statSync
().
modified
;
if
(
dateTime
==
null
)
{
continue
;
if
(!
directory
.
existsSync
())
{
return
true
;
// directory was deleted.
}
if
(
dateTime
.
isAfter
(
_lastBuildTimestamp
))
{
return
true
;
for
(
File
file
in
directory
.
listSync
())
{
final
DateTime
dateTime
=
file
.
statSync
().
modified
;
if
(
dateTime
==
null
)
{
continue
;
}
if
(
dateTime
.
isAfter
(
_lastBuildTimestamp
))
{
return
true
;
}
}
}
...
...
packages/flutter_tools/test/general.shard/asset_bundle_test.dart
View file @
04e04ffa
...
...
@@ -60,7 +60,7 @@ void main() {
});
testUsingContext
(
'wildcard directories are updated when filesystem changes'
,
()
async
{
f
s
.
file
(
'.packages'
)
.
createSync
();
f
inal
File
packageFile
=
fs
.
file
(
'.packages'
).
.
createSync
();
fs
.
file
(
fs
.
path
.
join
(
'assets'
,
'foo'
,
'bar.txt'
)).
createSync
(
recursive:
true
);
fs
.
file
(
'pubspec.yaml'
)
..
createSync
()
...
...
@@ -80,11 +80,10 @@ flutter:
expect
(
bundle
.
entries
.
length
,
4
);
expect
(
bundle
.
needsBuild
(
manifestPath:
'pubspec.yaml'
),
false
);
// Adding a file should update the stat of the directory, but instead
// we need to fully recreate it.
fs
.
directory
(
fs
.
path
.
join
(
'assets'
,
'foo'
)).
deleteSync
(
recursive:
true
);
fs
.
file
(
fs
.
path
.
join
(
'assets'
,
'foo'
,
'fizz.txt'
)).
createSync
(
recursive:
true
);
fs
.
file
(
fs
.
path
.
join
(
'assets'
,
'foo'
,
'bar.txt'
)).
createSync
();
// Simulate modifying the files by updating the filestat time manually.
fs
.
file
(
fs
.
path
.
join
(
'assets'
,
'foo'
,
'fizz.txt'
))
..
createSync
(
recursive:
true
)
..
setLastModifiedSync
(
packageFile
.
lastModifiedSync
().
add
(
const
Duration
(
hours:
1
)));
expect
(
bundle
.
needsBuild
(
manifestPath:
'pubspec.yaml'
),
true
);
await
bundle
.
build
(
manifestPath:
'pubspec.yaml'
);
...
...
@@ -102,7 +101,7 @@ flutter:
testUsingContext
(
'handle removal of wildcard directories'
,
()
async
{
fs
.
file
(
fs
.
path
.
join
(
'assets'
,
'foo'
,
'bar.txt'
)).
createSync
(
recursive:
true
);
fs
.
file
(
'pubspec.yaml'
)
f
inal
File
pubspec
=
f
s
.
file
(
'pubspec.yaml'
)
..
createSync
()
..
writeAsStringSync
(
r''
'
name: example
...
...
@@ -122,14 +121,17 @@ flutter:
expect
(
bundle
.
needsBuild
(
manifestPath:
'pubspec.yaml'
),
false
);
// Delete the wildcard directory and update pubspec file.
final
DateTime
modifiedTime
=
pubspec
.
lastModifiedSync
().
add
(
const
Duration
(
hours:
1
));
fs
.
directory
(
fs
.
path
.
join
(
'assets'
,
'foo'
)).
deleteSync
(
recursive:
true
);
fs
.
file
(
'pubspec.yaml'
)
..
createSync
()
..
writeAsStringSync
(
r''
'
name: example'''
);
name: example'''
)
..
setLastModifiedSync
(
modifiedTime
);
// touch .packages to make sure its change time is after pubspec.yaml's
fs
.
file
(
'.packages'
).
createSync
();
fs
.
file
(
'.packages'
)
..
setLastModifiedSync
(
modifiedTime
);
// Even though the previous file was removed, it is left in the
// asset manifest and not updated. This is due to the devfs not
...
...
@@ -145,7 +147,7 @@ name: example''');
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
testFileSystem
,
ProcessManager:
()
=>
FakeProcessManager
(<
FakeCommand
>[]),
}
,
skip:
true
);
// https://github.com/flutter/flutter/issues/34446
}
);
});
}
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