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
66145fe6
Unverified
Commit
66145fe6
authored
Jan 11, 2021
by
Jenn Magder
Committed by
GitHub
Jan 11, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Force plugins to inherit minimum macOS version from Flutter app (#72764)
parent
4d5db889
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
49 additions
and
9 deletions
+49
-9
plugin_test_ios.dart
dev/devicelab/bin/tasks/plugin_test_ios.dart
+1
-0
plugin_tests.dart
dev/devicelab/lib/tasks/plugin_tests.dart
+35
-8
podhelper.rb
packages/flutter_tools/bin/podhelper.rb
+13
-1
No files found.
dev/devicelab/bin/tasks/plugin_test_ios.dart
View file @
66145fe6
...
...
@@ -9,5 +9,6 @@ Future<void> main() async {
await
task
(
combine
(<
TaskFunction
>[
PluginTest
(
'ios'
,
<
String
>[
'-i'
,
'objc'
,
'--platforms=ios'
]),
PluginTest
(
'ios'
,
<
String
>[
'-i'
,
'swift'
,
'--platforms=ios'
]),
PluginTest
(
'macos'
,
<
String
>[
'--platforms=macos'
]),
]));
}
dev/devicelab/lib/tasks/plugin_tests.dart
View file @
66145fe6
...
...
@@ -117,27 +117,31 @@ class _FlutterProject {
});
final
_FlutterProject
project
=
_FlutterProject
(
directory
,
name
);
if
(
template
==
'plugin'
&&
target
==
'ios'
)
{
project
.
_reduce
IOSPluginMinimumVersion
(
name
);
if
(
template
==
'plugin'
&&
(
target
==
'ios'
||
target
==
'macos'
)
)
{
project
.
_reduce
DarwinPluginMinimumVersion
(
name
,
target
);
}
return
project
;
}
// Make the platform version artificially low to test that the "deployment
// version too low" warning is never emitted.
void
_reduce
IOSPluginMinimumVersion
(
String
plugin
)
{
final
File
podspec
=
File
(
path
.
join
(
rootPath
,
'ios'
,
'
$plugin
.podspec'
));
void
_reduce
DarwinPluginMinimumVersion
(
String
plugin
,
String
target
)
{
final
File
podspec
=
File
(
path
.
join
(
rootPath
,
target
,
'
$plugin
.podspec'
));
if
(!
podspec
.
existsSync
())
{
throw
TaskResult
.
failure
(
'podspec file missing at
${podspec.path}
'
);
}
const
String
versionString
=
"s.platform = :ios, '8.0'"
;
final
String
versionString
=
target
==
'ios'
?
"s.platform = :ios, '8.0'"
:
"s.platform = :osx, '10.11'"
;
String
podspecContent
=
podspec
.
readAsStringSync
();
if
(!
podspecContent
.
contains
(
versionString
))
{
throw
TaskResult
.
failure
(
'Update this test to match plugin minimum
iOS
deployment version'
);
throw
TaskResult
.
failure
(
'Update this test to match plugin minimum
$target
deployment version'
);
}
podspecContent
=
podspecContent
.
replaceFirst
(
versionString
,
"s.platform = :ios, '7.0'"
,
target
==
'ios'
?
"s.platform = :ios, '7.0'"
:
"s.platform = :osx, '10.8'"
);
podspec
.
writeAsStringSync
(
podspecContent
,
flush:
true
);
}
...
...
@@ -146,14 +150,37 @@ class _FlutterProject {
await
inDirectory
(
Directory
(
rootPath
),
()
async
{
final
String
buildOutput
=
await
evalFlutter
(
'build'
,
options:
<
String
>[
target
,
'-v'
]);
if
(
target
==
'ios'
)
{
if
(
target
==
'ios'
||
target
==
'macos'
)
{
// This warning is confusing and shouldn't be emitted. Plugins often support lower versions than the
// Flutter app, but as long as they support the minimum it will work.
// warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0,
// but the range of supported deployment target versions is 9.0 to 14.0.99.
//
// (or "The macOS deployment target 'MACOSX_DEPLOYMENT_TARGET'"...)
if
(
buildOutput
.
contains
(
'the range of supported deployment target versions'
))
{
throw
TaskResult
.
failure
(
'Minimum plugin version warning present'
);
}
final
File
podsProject
=
File
(
path
.
join
(
rootPath
,
target
,
'Pods'
,
'Pods.xcodeproj'
,
'project.pbxproj'
));
if
(!
podsProject
.
existsSync
())
{
throw
TaskResult
.
failure
(
'Xcode Pods project file missing at
${podsProject.path}
'
);
}
final
String
podsProjectContent
=
podsProject
.
readAsStringSync
();
// This may be a bit brittle, IPHONEOS_DEPLOYMENT_TARGET appears in the
// Pods Xcode project file 6 times. If this number changes, make sure
// it's not a regression in the IPHONEOS_DEPLOYMENT_TARGET override logic.
// The plugintest target should not have IPHONEOS_DEPLOYMENT_TARGET set.
// See _reduceDarwinPluginMinimumVersion for details.
if
(
target
==
'ios'
&&
'IPHONEOS_DEPLOYMENT_TARGET'
.
allMatches
(
podsProjectContent
).
length
!=
6
)
{
throw
TaskResult
.
failure
(
'plugintest may contain IPHONEOS_DEPLOYMENT_TARGET'
);
}
// Same for macOS, but 12.
// The plugintest target should not have MACOSX_DEPLOYMENT_TARGET set.
if
(
target
==
'macos'
&&
'MACOSX_DEPLOYMENT_TARGET'
.
allMatches
(
podsProjectContent
).
length
!=
12
)
{
throw
TaskResult
.
failure
(
'plugintest may contain MACOSX_DEPLOYMENT_TARGET'
);
}
}
});
}
...
...
packages/flutter_tools/bin/podhelper.rb
View file @
66145fe6
...
...
@@ -73,9 +73,17 @@ end
# Same as flutter_ios_podfile_setup for macOS.
def
flutter_additional_macos_build_settings
(
target
)
print
target
.
platform_name
return
unless
target
.
platform_name
==
:osx
# [target.deployment_target] is a [String] formatted as "10.8".
deployment_target_major
,
deployment_target_minor
=
target
.
deployment_target
.
match
(
/(\d+).?(\d*)/
).
captures
# Suppress warning when pod supports a version lower than the minimum supported by the latest stable version of Xcode (currently 10.9).
# This warning is harmless but confusing--it's not a bad thing for dependencies to support a lower version.
inherit_deployment_target
=
!
target
.
deployment_target
.
blank?
&&
(
deployment_target_major
.
to_i
<
10
)
||
(
deployment_target_major
.
to_i
==
10
&&
deployment_target_minor
.
to_i
<
9
)
# This podhelper script is at $FLUTTER_ROOT/packages/flutter_tools/bin.
# Add search paths from $FLUTTER_ROOT/bin/cache/artifacts/engine.
artifacts_dir
=
File
.
join
(
'..'
,
'..'
,
'..'
,
'..'
,
'bin'
,
'cache'
,
'artifacts'
,
'engine'
)
...
...
@@ -89,6 +97,10 @@ def flutter_additional_macos_build_settings(target)
# ARM not yet supported https://github.com/flutter/flutter/issues/69221
build_configuration
.
build_settings
[
'EXCLUDED_ARCHS'
]
=
'arm64'
# When deleted, the deployment version will inherit from the higher version derived from the 'Runner' target.
# If the pod only supports a higher version, do not delete to correctly produce an error.
build_configuration
.
build_settings
.
delete
'MACOSX_DEPLOYMENT_TARGET'
if
inherit_deployment_target
end
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