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
546b521f
Unverified
Commit
546b521f
authored
Jan 13, 2021
by
Claire Davis
Committed by
GitHub
Jan 13, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] Sort plugins alphabetically when refreshed (#73803)
parent
1cb0a24a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
3 deletions
+15
-3
plugins.dart
packages/flutter_tools/lib/src/plugins.dart
+2
-1
plugins_test.dart
packages/flutter_tools/test/general.shard/plugins_test.dart
+13
-2
No files found.
packages/flutter_tools/lib/src/plugins.dart
View file @
546b521f
...
...
@@ -1139,7 +1139,8 @@ Future<void> refreshPluginsList(
bool
macOSPlatform
=
false
,
})
async
{
final
List
<
Plugin
>
plugins
=
await
findPlugins
(
project
);
// Sort the plugins by name to keep ordering stable in generated files.
plugins
.
sort
((
Plugin
left
,
Plugin
right
)
=>
left
.
name
.
compareTo
(
right
.
name
));
// TODO(franciscojma): Remove once migration is complete.
// Write the legacy plugin files to avoid breaking existing apps.
final
bool
legacyChanged
=
_writeFlutterPluginsListLegacy
(
project
,
plugins
);
...
...
packages/flutter_tools/test/general.shard/plugins_test.dart
View file @
546b521f
...
...
@@ -390,14 +390,25 @@ dependencies:
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
testUsingContext
(
'Refreshing the plugin list creates a plugin directory when there are plugins'
,
()
async
{
createFakePlugin
(
fs
);
testUsingContext
(
'Refreshing the plugin list creates a sorted plugin directory when there are plugins'
,
()
async
{
createFakePlugins
(
fs
,
<
String
>[
'plugin_d'
,
'plugin_a'
,
'/local_plugins/plugin_c'
,
'/local_plugins/plugin_b'
]);
when
(
iosProject
.
existsSync
()).
thenReturn
(
true
);
await
refreshPluginsList
(
flutterProject
);
expect
(
flutterProject
.
flutterPluginsFile
.
existsSync
(),
true
);
expect
(
flutterProject
.
flutterPluginsDependenciesFile
.
existsSync
(),
true
);
final
String
pluginsFileContents
=
flutterProject
.
flutterPluginsFile
.
readAsStringSync
();
expect
(
pluginsFileContents
.
indexOf
(
'plugin_a'
),
lessThan
(
pluginsFileContents
.
indexOf
(
'plugin_b'
)));
expect
(
pluginsFileContents
.
indexOf
(
'plugin_b'
),
lessThan
(
pluginsFileContents
.
indexOf
(
'plugin_c'
)));
expect
(
pluginsFileContents
.
indexOf
(
'plugin_c'
),
lessThan
(
pluginsFileContents
.
indexOf
(
'plugin_d'
)));
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fs
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
...
...
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