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
d2446937
Unverified
Commit
d2446937
authored
Apr 12, 2021
by
Jonah Williams
Committed by
GitHub
Apr 12, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] symlink win32 plugins as UWP plugins (#80242)
parent
7c78a057
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
5 deletions
+42
-5
plugins.dart
packages/flutter_tools/lib/src/plugins.dart
+6
-5
plugins_test.dart
...lutter_tools/test/general.shard/windows/plugins_test.dart
+36
-0
No files found.
packages/flutter_tools/lib/src/plugins.dart
View file @
d2446937
...
@@ -1088,7 +1088,8 @@ Future<void> _writeWebPluginRegistrant(FlutterProject project, List<Plugin> plug
...
@@ -1088,7 +1088,8 @@ Future<void> _writeWebPluginRegistrant(FlutterProject project, List<Plugin> plug
///
///
/// This uses [project.flutterPluginsDependenciesFile], so it should only be
/// This uses [project.flutterPluginsDependenciesFile], so it should only be
/// run after refreshPluginList has been run since the last plugin change.
/// run after refreshPluginList has been run since the last plugin change.
void
createPluginSymlinks
(
FlutterProject
project
,
{
bool
force
=
false
})
{
void
createPluginSymlinks
(
FlutterProject
project
,
{
bool
force
=
false
,
@visibleForTesting
FeatureFlags
featureFlagsOverride
})
{
final
FeatureFlags
localFeatureFlags
=
featureFlagsOverride
??
featureFlags
;
Map
<
String
,
dynamic
>
platformPlugins
;
Map
<
String
,
dynamic
>
platformPlugins
;
final
String
pluginFileContent
=
_readFileContent
(
project
.
flutterPluginsDependenciesFile
);
final
String
pluginFileContent
=
_readFileContent
(
project
.
flutterPluginsDependenciesFile
);
if
(
pluginFileContent
!=
null
)
{
if
(
pluginFileContent
!=
null
)
{
...
@@ -1097,24 +1098,24 @@ void createPluginSymlinks(FlutterProject project, {bool force = false}) {
...
@@ -1097,24 +1098,24 @@ void createPluginSymlinks(FlutterProject project, {bool force = false}) {
}
}
platformPlugins
??=
<
String
,
dynamic
>{};
platformPlugins
??=
<
String
,
dynamic
>{};
if
(
f
eatureFlags
.
isWindowsEnabled
&&
project
.
windows
.
existsSync
())
{
if
(
localF
eatureFlags
.
isWindowsEnabled
&&
project
.
windows
.
existsSync
())
{
_createPlatformPluginSymlinks
(
_createPlatformPluginSymlinks
(
project
.
windows
.
pluginSymlinkDirectory
,
project
.
windows
.
pluginSymlinkDirectory
,
platformPlugins
[
project
.
windows
.
pluginConfigKey
]
as
List
<
dynamic
>,
platformPlugins
[
project
.
windows
.
pluginConfigKey
]
as
List
<
dynamic
>,
force:
force
,
force:
force
,
);
);
}
}
if
(
f
eatureFlags
.
isLinuxEnabled
&&
project
.
linux
.
existsSync
())
{
if
(
localF
eatureFlags
.
isLinuxEnabled
&&
project
.
linux
.
existsSync
())
{
_createPlatformPluginSymlinks
(
_createPlatformPluginSymlinks
(
project
.
linux
.
pluginSymlinkDirectory
,
project
.
linux
.
pluginSymlinkDirectory
,
platformPlugins
[
project
.
linux
.
pluginConfigKey
]
as
List
<
dynamic
>,
platformPlugins
[
project
.
linux
.
pluginConfigKey
]
as
List
<
dynamic
>,
force:
force
,
force:
force
,
);
);
}
}
if
(
f
eatureFlags
.
isWindowsUwpEnabled
&&
project
.
windowsUwp
.
existsSync
())
{
if
(
localF
eatureFlags
.
isWindowsUwpEnabled
&&
project
.
windowsUwp
.
existsSync
())
{
_createPlatformPluginSymlinks
(
_createPlatformPluginSymlinks
(
project
.
windowsUwp
.
pluginSymlinkDirectory
,
project
.
windowsUwp
.
pluginSymlinkDirectory
,
<
dynamic
>[]
,
platformPlugins
[
project
.
windows
.
pluginConfigKey
]
as
List
<
dynamic
>
,
force:
force
,
force:
force
,
);
);
}
}
...
...
packages/flutter_tools/test/general.shard/windows/plugins_test.dart
View file @
d2446937
...
@@ -14,9 +14,24 @@ import 'package:flutter_tools/src/plugins.dart';
...
@@ -14,9 +14,24 @@ import 'package:flutter_tools/src/plugins.dart';
import
'package:flutter_tools/src/project.dart'
;
import
'package:flutter_tools/src/project.dart'
;
import
'../../src/common.dart'
;
import
'../../src/common.dart'
;
import
'../../src/fakes.dart'
;
const
TemplateRenderer
renderer
=
MustacheTemplateRenderer
();
const
TemplateRenderer
renderer
=
MustacheTemplateRenderer
();
const
String
kPluginDependencies
=
r''
'
{
"info":"This is a generated file; do not edit or check into version control.",
"plugins":{
"windows":[
{
"name":"example","path":"C:
\\\\
example
\\\\
",
"dependencies":[]
}
]
}
}
'''
;
void
main
(
)
{
void
main
(
)
{
testWithoutContext
(
'injects Win32 plugins'
,
()
async
{
testWithoutContext
(
'injects Win32 plugins'
,
()
async
{
...
@@ -64,10 +79,31 @@ void main() {
...
@@ -64,10 +79,31 @@ void main() {
contains
(
'#include <test/foo.h>'
),
contains
(
'#include <test/foo.h>'
),
);
);
});
});
testWithoutContext
(
'Symlink injection treats UWP as Win32'
,
()
{
final
FileSystem
fileSystem
=
MemoryFileSystem
.
test
();
setUpProject
(
fileSystem
);
final
FlutterProject
flutterProject
=
FlutterProject
.
fromDirectoryTest
(
fileSystem
.
currentDirectory
);
flutterProject
.
flutterPluginsDependenciesFile
.
writeAsStringSync
(
kPluginDependencies
);
createPluginSymlinks
(
flutterProject
,
featureFlagsOverride:
TestFeatureFlags
(
isWindowsUwpEnabled:
true
),
);
expect
(
flutterProject
.
windowsUwp
.
pluginSymlinkDirectory
,
exists
);
final
Link
link
=
flutterProject
.
windowsUwp
.
pluginSymlinkDirectory
.
listSync
().
single
as
Link
;
expect
(
link
.
path
,
'/winuwp/flutter/ephemeral/.plugin_symlinks/example'
);
expect
(
link
.
targetSync
(),
r'C:\\example\\'
);
});
}
}
void
setUpProject
(
FileSystem
fileSystem
)
{
void
setUpProject
(
FileSystem
fileSystem
)
{
fileSystem
.
file
(
'pubspec.yaml'
).
createSync
();
fileSystem
.
file
(
'pubspec.yaml'
).
createSync
();
fileSystem
.
file
(
'winuwp/CMakeLists.txt'
)
.
createSync
(
recursive:
true
);
fileSystem
.
file
(
'winuwp/project_version'
)
fileSystem
.
file
(
'winuwp/project_version'
)
..
createSync
(
recursive:
true
)
..
createSync
(
recursive:
true
)
..
writeAsStringSync
(
'0'
);
..
writeAsStringSync
(
'0'
);
...
...
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