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
d0d9da83
Unverified
Commit
d0d9da83
authored
May 19, 2020
by
Jonah Williams
Committed by
GitHub
May 19, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] prevent wildcard assets from causing build invalidation issues (#56472)
parent
4fd4a7ed
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
90 additions
and
0 deletions
+90
-0
asset.dart
packages/flutter_tools/lib/src/asset.dart
+13
-0
asset_bundle_test.dart
...s/flutter_tools/test/general.shard/asset_bundle_test.dart
+77
-0
No files found.
packages/flutter_tools/lib/src/asset.dart
View file @
d0d9da83
...
...
@@ -272,6 +272,19 @@ class ManifestAssetBundle implements AssetBundle {
final
DevFSStringContent
licenses
=
DevFSStringContent
(
licenseResult
.
combinedLicenses
);
additionalDependencies
=
licenseResult
.
dependencies
;
if
(
wildcardDirectories
.
isNotEmpty
)
{
// Force the depfile to contain missing files so that Gradle does not skip
// the task. Wildcard directories are not compatible with full incremental
// builds. For more context see https://github.com/flutter/flutter/issues/56466 .
globals
.
printTrace
(
'Manifest contained wildcard assets. Inserting missing file into '
'build graph to force rerun. for more information see #56466.'
);
final
int
suffix
=
Object
().
hashCode
;
additionalDependencies
.
add
(
globals
.
fs
.
file
(
'DOES_NOT_EXIST_RERUN_FOR_WILDCARD
$suffix
'
).
absolute
);
}
_setIfChanged
(
_assetManifestJson
,
assetManifest
);
_setIfChanged
(
kFontManifestJson
,
fontManifest
);
_setIfChanged
(
_license
,
licenses
);
...
...
packages/flutter_tools/test/general.shard/asset_bundle_test.dart
View file @
d0d9da83
...
...
@@ -224,6 +224,83 @@ assets:
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
testUsingContext
(
'inserts dummy file into additionalDependencies when '
'wildcards are used'
,
()
async
{
globals
.
fs
.
file
(
'.packages'
).
createSync
();
globals
.
fs
.
file
(
globals
.
fs
.
path
.
join
(
'assets'
,
'bar.txt'
)).
createSync
(
recursive:
true
);
globals
.
fs
.
file
(
'pubspec.yaml'
)
..
createSync
()
..
writeAsStringSync
(
r''
'
name: example
flutter:
assets:
- assets/
'''
);
final
AssetBundle
bundle
=
AssetBundleFactory
.
instance
.
createBundle
();
expect
(
await
bundle
.
build
(
manifestPath:
'pubspec.yaml'
),
0
);
expect
(
bundle
.
additionalDependencies
.
single
.
path
,
contains
(
'DOES_NOT_EXIST_RERUN_FOR_WILDCARD'
));
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
MemoryFileSystem
.
test
(),
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
testUsingContext
(
'Does not insert dummy file into additionalDependencies '
'when wildcards are not used'
,
()
async
{
globals
.
fs
.
file
(
'.packages'
).
createSync
();
globals
.
fs
.
file
(
globals
.
fs
.
path
.
join
(
'assets'
,
'bar.txt'
)).
createSync
(
recursive:
true
);
globals
.
fs
.
file
(
'pubspec.yaml'
)
..
createSync
()
..
writeAsStringSync
(
r''
'
name: example
flutter:
assets:
- assets/bar.txt
'''
);
final
AssetBundle
bundle
=
AssetBundleFactory
.
instance
.
createBundle
();
expect
(
await
bundle
.
build
(
manifestPath:
'pubspec.yaml'
),
0
);
expect
(
bundle
.
additionalDependencies
,
isEmpty
);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
MemoryFileSystem
.
test
(),
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
testUsingContext
(
'Does not insert dummy file into additionalDependencies '
'when wildcards are used by dependencies'
,
()
async
{
globals
.
fs
.
file
(
'.packages'
).
writeAsStringSync
(
r''
'
example:lib/
foo:foo/lib/
'''
);
globals
.
fs
.
file
(
globals
.
fs
.
path
.
join
(
'assets'
,
'foo'
,
'bar.txt'
))
.
createSync
(
recursive:
true
);
globals
.
fs
.
file
(
'pubspec.yaml'
)
..
createSync
()
..
writeAsStringSync
(
r''
'
name: example
dependencies:
foo: any
'''
);
globals
.
fs
.
file
(
'foo/pubspec.yaml'
)
..
createSync
(
recursive:
true
)
..
writeAsStringSync
(
r''
'
name: foo
flutter:
assets:
- bar/
'''
);
final
AssetBundle
bundle
=
AssetBundleFactory
.
instance
.
createBundle
();
globals
.
fs
.
file
(
'foo/bar/fizz.txt'
).
createSync
(
recursive:
true
);
expect
(
await
bundle
.
build
(
manifestPath:
'pubspec.yaml'
),
0
);
expect
(
bundle
.
additionalDependencies
,
isEmpty
);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
MemoryFileSystem
.
test
(),
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
Platform:
()
=>
FakePlatform
(
operatingSystem:
'linux'
),
});
testUsingContext
(
'does not track wildcard directories from dependencies'
,
()
async
{
globals
.
fs
.
file
(
'.packages'
).
writeAsStringSync
(
r''
'
example:lib/
...
...
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