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
74dfc070
Unverified
Commit
74dfc070
authored
Sep 29, 2022
by
Jason Simmons
Committed by
GitHub
Sep 29, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Treat assets as variants only if they share the same filename (#112602)
parent
5c68452d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
5 deletions
+11
-5
asset.dart
packages/flutter_tools/lib/src/asset.dart
+3
-1
asset_bundle_package_test.dart
...r_tools/test/general.shard/asset_bundle_package_test.dart
+8
-4
No files found.
packages/flutter_tools/lib/src/asset.dart
View file @
74dfc070
...
@@ -1033,16 +1033,18 @@ class _AssetDirectoryCache {
...
@@ -1033,16 +1033,18 @@ class _AssetDirectoryCache {
final
List
<
FileSystemEntity
>
entitiesInDirectory
=
_fileSystem
.
directory
(
directory
).
listSync
();
final
List
<
FileSystemEntity
>
entitiesInDirectory
=
_fileSystem
.
directory
(
directory
).
listSync
();
final
File
assetFile
=
_fileSystem
.
file
(
assetPath
);
final
List
<
String
>
pathsOfVariants
=
<
String
>[
final
List
<
String
>
pathsOfVariants
=
<
String
>[
// It's possible that the user specifies only explicit variants (e.g. .../1x/asset.png),
// It's possible that the user specifies only explicit variants (e.g. .../1x/asset.png),
// so there does not necessarily need to be a file at the given path.
// so there does not necessarily need to be a file at the given path.
if
(
_fileSystem
.
file
(
assetPath
)
.
existsSync
())
if
(
assetFile
.
existsSync
())
assetPath
,
assetPath
,
...
entitiesInDirectory
...
entitiesInDirectory
.
whereType
<
Directory
>()
.
whereType
<
Directory
>()
.
where
((
Directory
dir
)
=>
_assetVariantDirectoryRegExp
.
hasMatch
(
dir
.
basename
))
.
where
((
Directory
dir
)
=>
_assetVariantDirectoryRegExp
.
hasMatch
(
dir
.
basename
))
.
expand
((
Directory
dir
)
=>
dir
.
listSync
())
.
expand
((
Directory
dir
)
=>
dir
.
listSync
())
.
whereType
<
File
>()
.
whereType
<
File
>()
.
where
((
File
file
)
=>
file
.
basename
==
assetFile
.
basename
)
.
map
((
File
file
)
=>
file
.
path
),
.
map
((
File
file
)
=>
file
.
path
),
];
];
...
...
packages/flutter_tools/test/general.shard/asset_bundle_package_test.dart
View file @
74dfc070
...
@@ -219,14 +219,18 @@ $assetsSection
...
@@ -219,14 +219,18 @@ $assetsSection
writePubspecFile
(
writePubspecFile
(
'p/p/pubspec.yaml'
,
'p/p/pubspec.yaml'
,
'test_package'
,
'test_package'
,
assets:
<
String
>[
'a/foo'
],
assets:
<
String
>[
'a/foo'
,
'a/bar'
],
);
);
final
List
<
String
>
assets
=
<
String
>[
'a/foo'
,
'a/2x/foo'
];
final
List
<
String
>
assets
=
<
String
>[
'a/foo'
,
'a/2x/foo'
,
'a/bar'
];
writeAssets
(
'p/p/'
,
assets
);
writeAssets
(
'p/p/'
,
assets
);
const
String
expectedManifest
=
'{"packages/test_package/a/foo":'
const
String
expectedManifest
=
'{'
'["packages/test_package/a/foo","packages/test_package/a/2x/foo"]}'
;
'"packages/test_package/a/bar":'
'["packages/test_package/a/bar"],'
'"packages/test_package/a/foo":'
'["packages/test_package/a/foo","packages/test_package/a/2x/foo"]'
'}'
;
await
buildAndVerifyAssets
(
await
buildAndVerifyAssets
(
assets
,
assets
,
...
...
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