Repository navigation
Force plugins to inherit minimum macOS version from Flutter app - #72764
Conversation
|
It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat. Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
006ff3f to
b158718
Compare
There was a problem hiding this comment.
should these *'s be +'s?
There was a problem hiding this comment.
should we validate that there are in fact two capture group matches?
There was a problem hiding this comment.
There was a problem hiding this comment.
/(\d+).?(\d*)/ might be more precise though; there does need to be a first number.
Aren't we trading a single relatively clear warning for an arbitrary set of deprecated API warnings (also unfixable by the user), which may be confusing if reported to the plugin author? Or do we get those regardless when it's out of range? |
You get the deprecated API warnings regardless of whether it's out of range. I just tested this. #import <Carbon/Carbon.h>
...
UpTime();
|
Actually that experiment didn't make sense, it should have been 10.7 when that API wasn't deprecated. You're right, the deprecation warning does go away. However I'd still trade avoiding a warning for 100% of our users vs causing deprecation warnings for the ones that with pods using APIs deprecated before 10.9. I really wish Xcode (it's not clang) didn't generate this warnings, or it was possible to turn it off. It's not very useful. |
There was a problem hiding this comment.
/(\d+).?(\d*)/ might be more precise though; there does need to be a first number.
There was a problem hiding this comment.
To make the source of these numbers as clear as possible to future readers/maintainers, how about "Check if this is less than the minimum OS version supported by the latest stable version of Xcode (currently 10.9)"
There was a problem hiding this comment.
The details are in the See MACOSX_DEPLOYMENT_TARGET note below. larger comment. I'll move it up.
There was a problem hiding this comment.
This logic isn't correct; it treats 11.[0-8] as older. Would be good to add an 11.0 test case that would have caught that.
There was a problem hiding this comment.
Well I failed the interview.
I guess that makes sense, given that a module developer who really wants to keep supporting old versions could do it with SDK ifdefs (although that's painful enough I'm not sure how many actually would). I do worry a bit about module developers getting reports of warnings they can't reproduce in their own builds, but hopefully it'll be clear enough. |
b158718 to
ae837c6
Compare
|
Was this ready for re-review? I thought it was waiting for a test update for the version comparison bug. |
I wasn't going to set up Ruby testing infrastructure for just this. The integration test covers the positive test but I don't have a negative test (which would have caught my silly mistake). Any suggestions? |
|
Agreed Ruby testing would be overkill; I was assuming that the effect of that Ruby code would be to cause |
ae837c6 to
f3231bd
Compare
| // 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) { |
There was a problem hiding this comment.
@stuartmorgan I started out actually parsing the Xcode project for the plugintest target's build settings but that got pretty confusing. This count check is a bit of a cheat but it would definitely fail if the behavior was wrong or regressed...
There was a problem hiding this comment.
Makes sense; I was thinking it wouldn't be in the project at all, so I didn't realize it would be non-trivial. Agreed that a full parser would be overkill here.
| // 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) { |
There was a problem hiding this comment.
Makes sense; I was thinking it wouldn't be in the project at all, so I didn't realize it would be non-trivial. Agreed that a full parser would be overkill here.


Background
macOS version of #66590
Xcode supports specific SDK ranges, and every release they drop the lowest. For example, Xcode 12 dropped support for 10.8.
Xcode emits a warning when build targets support a minimum version lower than the range to indicate it can't validate compilation against the older SDK.
This warning is benign: if the app supports a minimum of macOS 10.9, it doesn't cause any problems that a plugin framework embedded in the app supports macOS 10.8. These warnings concern users who think there's something wrong with their app, and there's no way for users to fix it (the plugin author would have to up their minimum supported version).
This warning was seen in flutter_gallery because the
Reachabilitypod supported 10.8.Description
If the plugin's minimum version is less than macOS 10.9, remove the version build setting. This will cause it to inherit from the minimum version set in the Flutter app (currently 10.11).
If the plugin minimum is higher than macOS 10.9, leave the build setting so if there is a versioning range issue (the plugin supports a minimum macOS 11 but the app needs 10.11) the correct error (not warning) will be emitted.
Related Issues
iOS issue at #40109, there's no macOS equivalent.
Tests
Added macOS to the plugin integration test. Confirm this test fails on master.