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
098ece52
Unverified
Commit
098ece52
authored
Feb 23, 2021
by
Emmanuel Garcia
Committed by
GitHub
Feb 23, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Disable warnings for the dart plugin registrant (#76561)
parent
b5139515
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
67 additions
and
26 deletions
+67
-26
compile.dart
packages/flutter_tools/lib/src/compile.dart
+2
-0
plugins.dart
packages/flutter_tools/lib/src/plugins.dart
+33
-26
plugins_test.dart
packages/flutter_tools/test/general.shard/plugins_test.dart
+32
-0
No files found.
packages/flutter_tools/lib/src/compile.dart
View file @
098ece52
...
...
@@ -250,6 +250,8 @@ class KernelCompiler {
mainUri
,
newMainDart
,
mainFile
,
// TODO(egarciad): Turn this on when the plugins are fixed.
throwOnPluginPubspecError:
false
,
))
{
mainUri
=
newMainDart
.
path
;
}
...
...
packages/flutter_tools/lib/src/plugins.dart
View file @
098ece52
...
...
@@ -539,22 +539,24 @@ List<PluginInterfaceResolution> resolvePlatformImplementation(
if
(
plugin
.
implementsPackage
==
null
||
plugin
.
implementsPackage
.
isEmpty
)
{
final
String
defaultImplementation
=
plugin
.
defaultPackagePlatforms
[
platform
];
if
(
defaultImplementation
==
null
)
{
globals
.
printError
(
'Plugin `
${plugin.name}
` doesn
\'
t implement a plugin interface, nor sets '
'a default implementation in pubspec.yaml.
\n\n
'
'To set a default implementation, use:
\n
'
'flutter:
\n
'
' plugin:
\n
'
' platforms:
\n
'
'
$platform
:
\n
'
'
$kDefaultPackage
: <plugin-implementation>
\n
'
'
\n
'
'To implement an interface, use:
\n
'
'flutter:
\n
'
' plugin:
\n
'
' implements: <plugin-interface>'
'
\n
'
);
if
(
throwOnPluginPubspecError
)
{
globals
.
printError
(
'Plugin `
${plugin.name}
` doesn
\'
t implement a plugin interface, nor sets '
'a default implementation in pubspec.yaml.
\n\n
'
'To set a default implementation, use:
\n
'
'flutter:
\n
'
' plugin:
\n
'
' platforms:
\n
'
'
$platform
:
\n
'
'
$kDefaultPackage
: <plugin-implementation>
\n
'
'
\n
'
'To implement an interface, use:
\n
'
'flutter:
\n
'
' plugin:
\n
'
' implements: <plugin-interface>'
'
\n
'
);
}
didFindError
=
true
;
continue
;
}
...
...
@@ -569,12 +571,14 @@ List<PluginInterfaceResolution> resolvePlatformImplementation(
if
(
directDependencyResolutions
.
containsKey
(
resolutionKey
))
{
final
PluginInterfaceResolution
currResolution
=
directDependencyResolutions
[
resolutionKey
];
if
(
currResolution
.
plugin
.
isDirectDependency
&&
plugin
.
isDirectDependency
)
{
globals
.
printError
(
'Plugin `
${plugin.name}
` implements an interface for `
$platform
`, which was already '
'implemented by plugin `
${currResolution.plugin.name}
`.
\n
'
'To fix this issue, remove either dependency from pubspec.yaml.'
'
\n\n
'
);
if
(
throwOnPluginPubspecError
)
{
globals
.
printError
(
'Plugin `
${plugin.name}
` implements an interface for `
$platform
`, which was already '
'implemented by plugin `
${currResolution.plugin.name}
`.
\n
'
'To fix this issue, remove either dependency from pubspec.yaml.'
'
\n\n
'
);
}
didFindError
=
true
;
}
if
(
currResolution
.
plugin
.
isDirectDependency
)
{
...
...
@@ -931,19 +935,22 @@ Future<void> _writeAndroidPluginRegistrant(FlutterProject project, List<Plugin>
/// Returns [true] if it's necessary to create a plugin registrant, and
/// if the new entrypoint was written to disk.
///
/// This method also validates each plugin's pubspec.yaml, but errors are only
/// reported if [throwOnPluginPubspecError] is [true].
///
/// For more details, see https://flutter.dev/go/federated-plugins.
Future
<
bool
>
generateMainDartWithPluginRegistrant
(
FlutterProject
rootProject
,
PackageConfig
packageConfig
,
String
currentMainUri
,
File
newMainDart
,
File
mainFile
,
)
async
{
File
mainFile
,
{
bool
throwOnPluginPubspecError
,
})
async
{
final
List
<
Plugin
>
plugins
=
await
findPlugins
(
rootProject
);
final
List
<
PluginInterfaceResolution
>
resolutions
=
resolvePlatformImplementation
(
plugins
,
// TODO(egarciad): Turn this on after fixing the pubspec.yaml of the plugins used in tests.
throwOnPluginPubspecError:
false
,
throwOnPluginPubspecError:
throwOnPluginPubspecError
,
);
final
LanguageVersion
entrypointVersion
=
determineLanguageVersion
(
mainFile
,
...
...
packages/flutter_tools/test/general.shard/plugins_test.dart
View file @
098ece52
...
...
@@ -1915,6 +1915,7 @@ void main() {
'package:app/main.dart'
,
flutterBuild
,
mainFile
,
throwOnPluginPubspecError:
true
,
);
expect
(
didGenerate
,
isTrue
);
expect
(
flutterBuild
.
readAsStringSync
(),
...
...
@@ -2000,6 +2001,7 @@ void main() {
'package:app/main.dart'
,
flutterBuild
,
mainFile
,
throwOnPluginPubspecError:
true
,
),
throwsToolExit
(
message:
'Invalid plugin specification url_launcher_macos.
\n
'
'Invalid "macos" plugin specification.'
...
...
@@ -2055,6 +2057,7 @@ void main() {
'package:app/main.dart'
,
flutterBuild
,
mainFile
,
throwOnPluginPubspecError:
true
,
),
throwsToolExit
(
message:
'Invalid plugin specification url_launcher_macos.
\n
'
'Cannot find the `flutter.plugin.platforms` key in the `pubspec.yaml` file. '
...
...
@@ -2066,6 +2069,35 @@ void main() {
FileSystem:
()
=>
fs
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
testUsingContext
(
'Does not show error messages if throwOnPluginPubspecError is false'
,
()
async
{
final
FileSystem
fs
=
MemoryFileSystem
();
final
Set
<
String
>
directDependencies
=
<
String
>{
'url_launcher_windows'
,
};
resolvePlatformImplementation
(<
Plugin
>[
Plugin
.
fromYaml
(
'url_launcher_windows'
,
''
,
YamlMap
.
wrap
(<
String
,
dynamic
>{
'platforms'
:
<
String
,
dynamic
>{
'windows'
:
<
String
,
dynamic
>{
'dartPluginClass'
:
'UrlLauncherPluginWindows'
,
},
},
}),
<
String
>[],
fileSystem:
fs
,
appDependencies:
directDependencies
,
),
],
throwOnPluginPubspecError:
false
,
);
expect
(
testLogger
.
errorText
,
''
);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fs
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
});
group
(
'pubspec'
,
()
{
...
...
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