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
3744b82d
Unverified
Commit
3744b82d
authored
Jun 11, 2020
by
Jenn Magder
Committed by
GitHub
Jun 11, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support .flutter-plugins-dependencies (#59209)
parent
802ba9ac
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
100 additions
and
29 deletions
+100
-29
plugin_lint_mac.dart
dev/devicelab/bin/tasks/plugin_lint_mac.dart
+69
-4
utils.dart
dev/devicelab/lib/framework/utils.dart
+7
-0
podhelper.rb
packages/flutter_tools/bin/podhelper.rb
+24
-25
No files found.
dev/devicelab/bin/tasks/plugin_lint_mac.dart
View file @
3744b82d
...
...
@@ -106,12 +106,12 @@ Future<void> main() async {
final
String
swiftPluginPath
=
path
.
join
(
tempDir
.
path
,
swiftPluginName
);
final
File
objcPubspec
=
File
(
path
.
join
(
objcAppPath
,
'pubspec.yaml'
));
String
p
od
specContent
=
objcPubspec
.
readAsStringSync
();
p
odspecContent
=
pod
specContent
.
replaceFirst
(
String
p
ub
specContent
=
objcPubspec
.
readAsStringSync
();
p
ubspecContent
=
pub
specContent
.
replaceFirst
(
'
\n
dependencies:
\n
'
,
'
\n
dependencies:
\n
$objcPluginName
:
\n
path:
$objcPluginPath
\n
$swiftPluginName
:
\n
path:
$swiftPluginPath
\n
device_info:
\n
'
,
);
objcPubspec
.
writeAsStringSync
(
p
od
specContent
,
flush:
true
);
objcPubspec
.
writeAsStringSync
(
p
ub
specContent
,
flush:
true
);
await
inDirectory
(
objcAppPath
,
()
async
{
await
flutter
(
...
...
@@ -167,7 +167,7 @@ Future<void> main() async {
final
String
swiftAppPath
=
path
.
join
(
tempDir
.
path
,
swiftAppName
);
final
File
swiftPubspec
=
File
(
path
.
join
(
swiftAppPath
,
'pubspec.yaml'
));
swiftPubspec
.
writeAsStringSync
(
p
od
specContent
,
flush:
true
);
swiftPubspec
.
writeAsStringSync
(
p
ub
specContent
,
flush:
true
);
await
inDirectory
(
swiftAppPath
,
()
async
{
await
flutter
(
...
...
@@ -202,6 +202,71 @@ Future<void> main() async {
_validatePodfile
(
swiftAppPath
);
section
(
'Remove iOS support from plugin'
);
Directory
(
path
.
join
(
objcPluginPath
,
'ios'
)).
deleteSync
(
recursive:
true
);
const
String
iosPlatformMap
=
'''
ios:
pluginClass: TestPluginObjcPlugin'''
;
final
File
pluginPubspec
=
File
(
path
.
join
(
objcPluginPath
,
'pubspec.yaml'
));
String
pluginPubspecContent
=
pluginPubspec
.
readAsStringSync
();
if
(!
pluginPubspecContent
.
contains
(
iosPlatformMap
))
{
return
TaskResult
.
failure
(
'Plugin pubspec.yaml missing iOS platform map'
);
}
pluginPubspecContent
=
pluginPubspecContent
.
replaceFirst
(
iosPlatformMap
,
''
);
pluginPubspec
.
writeAsStringSync
(
pluginPubspecContent
,
flush:
true
);
await
inDirectory
(
swiftAppPath
,
()
async
{
await
flutter
(
'clean'
);
await
flutter
(
'build'
,
options:
<
String
>[
'ios'
,
'--no-codesign'
],
);
});
section
(
'Validate plugin without iOS platform'
);
final
File
podfileLockFile
=
File
(
path
.
join
(
swiftAppPath
,
'ios'
,
'Podfile.lock'
));
final
String
podfileLockOutput
=
podfileLockFile
.
readAsStringSync
();
if
(!
podfileLockOutput
.
contains
(
':path: ".symlinks/plugins/device_info/ios"'
)
||
!
podfileLockOutput
.
contains
(
':path: Flutter'
)
// test_plugin_objc no longer supports iOS, shouldn't be present.
||
podfileLockOutput
.
contains
(
':path: ".symlinks/plugins/test_plugin_objc/ios"'
)
||
!
podfileLockOutput
.
contains
(
':path: ".symlinks/plugins/test_plugin_swift/ios"'
))
{
return
TaskResult
.
failure
(
'Podfile.lock does not contain expected pods'
);
}
final
String
pluginSymlinks
=
path
.
join
(
swiftAppPath
,
'ios'
,
'.symlinks'
,
'plugins'
,
);
checkDirectoryExists
(
path
.
join
(
pluginSymlinks
,
'device_info'
,
'ios'
,
));
checkDirectoryExists
(
path
.
join
(
pluginSymlinks
,
'test_plugin_swift'
,
'ios'
,
));
// test_plugin_objc no longer supports iOS, shouldn't exist!
checkDirectoryNotExists
(
path
.
join
(
pluginSymlinks
,
'test_plugin_objc'
,
));
return
TaskResult
.
success
(
null
);
}
catch
(
e
)
{
return
TaskResult
.
failure
(
e
.
toString
());
...
...
dev/devicelab/lib/framework/utils.dart
View file @
3744b82d
...
...
@@ -693,6 +693,13 @@ void checkDirectoryExists(String directory) {
}
}
/// Checks that the directory does not exist, otherwise throws a [FileSystemException].
void
checkDirectoryNotExists
(
String
directory
)
{
if
(
exists
(
Directory
(
directory
)))
{
throw
FileSystemException
(
'Expected directory to not exist.'
,
directory
);
}
}
/// Check that `collection` contains all entries in `values`.
void
checkCollectionContains
<
T
>(
Iterable
<
T
>
values
,
Iterable
<
T
>
collection
)
{
for
(
final
T
value
in
values
)
{
...
...
packages/flutter_tools/bin/podhelper.rb
View file @
3744b82d
...
...
@@ -2,6 +2,8 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
require
'json'
# Minimum CocoaPods Ruby version is 2.0.
# Don't depend on features newer than that.
...
...
@@ -105,35 +107,32 @@ def flutter_install_ios_plugin_pods(ios_application_path = nil)
symlink_plugins_dir
=
File
.
expand_path
(
'plugins'
,
symlink_dir
)
system
(
'mkdir'
,
'-p'
,
symlink_plugins_dir
)
plugins_file
=
File
.
join
(
ios_application_path
,
'..'
,
'.flutter-plugins'
)
plugins_file
=
File
.
join
(
ios_application_path
,
'..'
,
'.flutter-plugins
-dependencies
'
)
plugin_pods
=
flutter_parse_plugins_file
(
plugins_file
)
plugin_pods
.
each
do
|
name
,
path
|
symlink
=
File
.
join
(
symlink_plugins_dir
,
name
)
File
.
symlink
(
path
,
symlink
)
# Keep pod path relative so it can be checked into Podfile.lock.
pod
name
,
:path
=>
File
.
join
(
'.symlinks'
,
'plugins'
,
name
,
'ios'
)
plugin_pods
.
each
do
|
plugin_hash
|
plugin_name
=
plugin_hash
[
'name'
]
plugin_path
=
plugin_hash
[
'path'
]
if
(
plugin_name
&&
plugin_path
)
symlink
=
File
.
join
(
symlink_plugins_dir
,
plugin_name
)
File
.
symlink
(
plugin_path
,
symlink
)
# Keep pod path relative so it can be checked into Podfile.lock.
pod
plugin_name
,
:path
=>
File
.
join
(
'.symlinks'
,
'plugins'
,
plugin_name
,
'ios'
)
end
end
end
# .flutter-plugins-dependencies format documented at
# https://flutter.dev/go/plugins-list-migration
def
flutter_parse_plugins_file
(
file
)
file_path
=
File
.
expand_path
(
file
)
unless
File
.
exists?
file_path
return
{};
end
generated_key_values
=
{}
skip_line_start_symbols
=
[
"#"
,
"/"
]
File
.
foreach
(
file_path
)
do
|
line
|
next
if
skip_line_start_symbols
.
any?
{
|
symbol
|
line
=~
/^\s*
#{
symbol
}
/
}
plugin
=
line
.
split
(
'='
)
if
plugin
.
length
==
2
podname
=
plugin
[
0
].
strip
path
=
plugin
[
1
].
strip
podpath
=
File
.
expand_path
(
path
,
file_path
)
generated_key_values
[
podname
]
=
File
.
expand_path
(
path
,
file_path
)
else
puts
"Invalid plugin specification:
#{
line
}
"
end
end
generated_key_values
return
[]
unless
File
.
exists?
file_path
dependencies_file
=
File
.
read
(
file
)
dependencies_hash
=
JSON
.
parse
(
dependencies_file
)
# dependencies_hash.dig('plugins', 'ios') not available until Ruby 2.3
return
[]
unless
dependencies_hash
.
has_key?
(
'plugins'
)
return
[]
unless
dependencies_hash
[
'plugins'
].
has_key?
(
'ios'
)
dependencies_hash
[
'plugins'
][
'ios'
]
||
[]
end
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