Feature/native api lint ffigen - #63734
Conversation
|
Thank you for your contribution! This project uses Gerrit for code reviews. Your pull request has automatically been converted into a code review at: https://dart-review.googlesource.com/c/sdk/+/519800 Please wait for a developer to review your code review at the above link; you can speed up the review if you sign into Gerrit and manually add a reviewer that has recently worked on the relevant code. See CONTRIBUTING.md to learn how to upload changes to Gerrit directly. Additional commits pushed to this PR will update both the PR and the corresponding Gerrit CL. After the review is complete on the CL, your reviewer will merge the CL (automatically closing this PR). |
Adds native_interop_annotation for @ExternalVersions and a custom analyzer plugin native_api_lint to warn when generated ffigen bindings are incompatible with the iOS/macOS minimum deployment target. Fixes dart-lang#63618
5ecaa34 to
9f8b8d8
Compare
|
https://dart-review.googlesource.com/c/sdk/+/519800 has been updated with the latest commits from this pull request. |
1 similar comment
|
https://dart-review.googlesource.com/c/sdk/+/519800 has been updated with the latest commits from this pull request. |
|
https://dart-review.googlesource.com/c/sdk/+/519800 has been updated with the latest commits from this pull request. |
Custom lint for OS-level API compatibility
Fixes #63618
Description
This PR introduces a custom analyzer plugin and annotation package to provide warnings and errors when generated
ffigenbindings are incompatible with the user's project deployment targets.iOS/macOS APIs have OS-versions defining when an API was introduced, deprecated, or obsoleted. When
ffigengenerates bindings for these APIs, developers need analyzer warnings if they call an API that requires a newer OS version than what their app currently targets.Changes Included:
package:native_interop_annotation: Adds the@ExternalVersionsannotation andExternalVersionclass. This allowsffigento emit standard annotations specifyingmin,max, anddeprecationMessageonto Dart elements.package:native_api_lint: A standalone analyzer plugin hooked into the Dart analysis server that:analysis_options.yaml,ios/Podfile, orios/Runner.xcodeproj/project.pbxproj).api_not_available_on_min_target(WARNING) if the API requires a newer OS.api_obsoleted_on_min_target(ERROR) if the API was removed before the project's minimum target.api_deprecated_on_target(INFO) if the API is deprecated on the user's targeted OS version.DeploymentTargetResolver,AnnotationReader, andVersionUtils.Testing
Podfileandpbxprojparsing with single quotes, double quotes, and leading spaces.