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
094179e8
Unverified
Commit
094179e8
authored
May 07, 2021
by
Emmanuel Garcia
Committed by
GitHub
May 07, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enable Dart plugin registrant on Desktop only (#81586)
parent
59b406c7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
60 additions
and
5 deletions
+60
-5
dart_plugin_registrant.dart
.../lib/src/build_system/targets/dart_plugin_registrant.dart
+16
-1
dart_plugin_registrant_test.dart
...ard/build_system/targets/dart_plugin_registrant_test.dart
+44
-4
No files found.
packages/flutter_tools/lib/src/build_system/targets/dart_plugin_registrant.dart
View file @
094179e8
...
...
@@ -8,6 +8,7 @@ import 'package:meta/meta.dart';
import
'package:package_config/package_config.dart'
;
import
'../../base/file_system.dart'
;
import
'../../build_info.dart'
;
import
'../../dart/package_map.dart'
;
import
'../../flutter_plugins.dart'
;
import
'../../project.dart'
;
...
...
@@ -63,7 +64,21 @@ class DartPluginRegistrantTarget extends Target {
@override
bool
canSkip
(
Environment
environment
)
{
return
!
environment
.
generateDartPluginRegistry
;
if
(!
environment
.
generateDartPluginRegistry
)
{
return
true
;
}
final
String
platformName
=
environment
.
defines
[
kTargetPlatform
];
if
(
platformName
==
null
)
{
return
true
;
}
final
TargetPlatform
targetPlatform
=
getTargetPlatformForName
(
platformName
);
// TODO(egarciad): Support Android and iOS.
// https://github.com/flutter/flutter/issues/52267
return
targetPlatform
!=
TargetPlatform
.
darwin
&&
targetPlatform
!=
TargetPlatform
.
linux_x64
&&
targetPlatform
!=
TargetPlatform
.
linux_arm64
&&
targetPlatform
!=
TargetPlatform
.
windows_x64
&&
targetPlatform
!=
TargetPlatform
.
windows_uwp_x64
;
}
@override
...
...
packages/flutter_tools/test/general.shard/build_system/targets/dart_plugin_registrant_test.dart
View file @
094179e8
...
...
@@ -104,9 +104,12 @@ void main() {
fileSystem:
fileSystem
,
logger:
BufferLogger
.
test
(),
processManager:
FakeProcessManager
.
any
(),
generateDartPluginRegistry:
false
);
generateDartPluginRegistry:
false
,
defines:
<
String
,
String
>{
kTargetPlatform:
'darwin-x64'
,
});
expect
(
const
DartPluginRegistrantTarget
().
canSkip
(
environment
),
t
rue
);
expect
(
const
DartPluginRegistrantTarget
().
canSkip
(
environment
),
isT
rue
);
final
Environment
environment2
=
Environment
.
test
(
fileSystem
.
currentDirectory
,
...
...
@@ -114,9 +117,46 @@ void main() {
fileSystem:
fileSystem
,
logger:
BufferLogger
.
test
(),
processManager:
FakeProcessManager
.
any
(),
generateDartPluginRegistry:
true
);
generateDartPluginRegistry:
true
,
defines:
<
String
,
String
>{
kTargetPlatform:
'darwin-x64'
,
});
expect
(
const
DartPluginRegistrantTarget
().
canSkip
(
environment2
),
isFalse
);
});
expect
(
const
DartPluginRegistrantTarget
().
canSkip
(
environment2
),
false
);
testWithoutContext
(
'skipped based on platform'
,
()
async
{
const
Map
<
String
,
bool
>
canSkip
=
<
String
,
bool
>{
'darwin-x64'
:
false
,
'linux-x64'
:
false
,
'linux-arm64'
:
false
,
'windows-x64'
:
false
,
'windows-uwp-x64'
:
false
,
'web-javascript'
:
true
,
'ios'
:
true
,
'android'
:
true
,
'fuchsia-arm64'
:
true
,
'fuchsia-x64'
:
true
,
};
for
(
final
String
targetPlatform
in
canSkip
.
keys
)
{
expect
(
const
DartPluginRegistrantTarget
().
canSkip
(
Environment
.
test
(
fileSystem
.
currentDirectory
,
artifacts:
null
,
fileSystem:
fileSystem
,
logger:
BufferLogger
.
test
(),
processManager:
FakeProcessManager
.
any
(),
generateDartPluginRegistry:
true
,
defines:
<
String
,
String
>{
kTargetPlatform:
targetPlatform
,
},
),
),
canSkip
[
targetPlatform
],
);
}
});
testUsingContext
(
"doesn't generate generated_main.dart if there aren't Dart plugins"
,
()
async
{
...
...
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