iOS: Eliminate unguarded-availability opt-out (flutter/engine#56689)

Eliminates the opt-out of `-Wunguarded-availability-new` in the `ios_test_flutter` target.

Xcode 15 beta XCTest framework headers contained unguarded usage of iOS 17 API. This bug resulted in engine build failures.

This was fixed in a later XCTest framework release.

```
/Applications/Xcode_15-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Frameworks/XCTest.framework/Headers/XCUIAccessibilityAuditTypes.h:19:30: error: 'XCUIAccessibilityAuditType' is only available on iOS 17.0 or newer [-Werror,-Wunguarded-availability-new]
   19 | typedef NS_OPTIONS(uint64_t, XCUIAccessibilityAuditType) {
      |                              ^
/Applications/Xcode_15-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Frameworks/XCTest.framework/Headers/XCUIAccessibilityAuditTypes.h:19:30: note: 'XCUIAccessibilityAuditType' has been marked as being introduced in iOS 17.0 here, but the deployment target is iOS 13.0.0
/Applications/Xcode_15-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Frameworks/XCTest.framework/Headers/XCUIAccessibilityAuditTypes.h:19:9: note: annotate anonymous enum with an availability attribute to silence this warning
   19 | typedef NS_OPTIONS(uint64_t, XCUIAccessibilityAuditType) {
      |         ^
/Applications/Xcode_15-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator17.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:383:34: note: expanded from macro 'NS_OPTIONS'
  383 | #define NS_OPTIONS(_type, _name) CF_OPTIONS(_type, _name)
      |                                  ^
/Applications/Xcode_15-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator17.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFAvailability.h:155:96: note: expanded from macro 'CF_OPTIONS'
  155 | #define CF_OPTIONS(_type, _name) __attribute__((availability(swift,unavailable))) _type _name; enum __CF_OPTIONS_ATTRIBUTES : _name
      |
```

Issue: https://github.com/flutter/flutter/issues/128958

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
This commit is contained in:
Chris Bracken 2024-11-18 14:26:10 -08:00 committed by GitHub
parent d9dce77156
commit 1671d8c112

View File

@ -199,12 +199,8 @@ shared_library("ios_test_flutter") {
testonly = true testonly = true
visibility = [ "*" ] visibility = [ "*" ]
# Xcode 15 beta has a bug where iOS 17 API usage is not guarded.
# This bug results engine build failure since the engine treats warnings as errors.
# The `-Wno-unguarded-availability-new` can be removed when the Xcode bug is fixed.
# See details in https://github.com/flutter/flutter/issues/128958.
cflags_objc = flutter_cflags_objc cflags_objc = flutter_cflags_objc
cflags_objcc = flutter_cflags_objcc + [ "-Wno-unguarded-availability-new" ] cflags_objcc = flutter_cflags_objcc
cflags = [ cflags = [
"-fvisibility=default", "-fvisibility=default",
"-F$platform_frameworks_path", "-F$platform_frameworks_path",