-
Notifications
You must be signed in to change notification settings - Fork 3.4k
[path_provider] Convert iOS/macOS to FFI package #9762
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
stuartmorgan-g
wants to merge
11
commits into
flutter:main
Choose a base branch
from
stuartmorgan-g:path-provider-foundation-ffi
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
fea0ff6
Switch to FFI, move most tests to integration
stuartmorgan-g 0e278aa
Version bump
stuartmorgan-g 1b69acc
Use new filtering to minimize generation
stuartmorgan-g bcc3a7e
Add the web import workaround
stuartmorgan-g 6b698c1
Typo fix
stuartmorgan-g 8292cdc
Typo fix
stuartmorgan-g 0ba3f0d
Relax FFI requirement for N-2 support
stuartmorgan-g 170adc6
Stub FFI library in unit tests for non-macOS hosts
stuartmorgan-g 6b1c280
Analysis fix, rename generated file to mark as generated
stuartmorgan-g 78843ce
Add change missed in the previous commit
stuartmorgan-g 5381fd3
Merge branch 'main' into path-provider-foundation-ffi
stuartmorgan-g File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
packages/path_provider/path_provider_foundation/CONTRIBUTING.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Contributing | ||
|
||
## `ffigen` | ||
|
||
This package uses [ffigen](https://pub.dev/packages/ffigen) to call Foundation | ||
methods, rather than using the standard Flutter plugin structure. To add new | ||
functionality to the FFI interface, update `ffigen_config.yaml`, then run: | ||
|
||
```bash | ||
dart run ffigen --config ffigen_config.yaml | ||
``` | ||
|
||
### Configuration philosophy | ||
|
||
This package intentionally uses very strict filtering rules to include only the | ||
necessary methods and functions. This is partially to keep the package small, | ||
but mostly to avoid unnecessarily generating anything that requires native code | ||
helpers, which would require setting up a native compilation step. |
90 changes: 0 additions & 90 deletions
90
packages/path_provider/path_provider_foundation/darwin/RunnerTests/RunnerTests.swift
This file was deleted.
Oops, something went wrong.
26 changes: 0 additions & 26 deletions
26
packages/path_provider/path_provider_foundation/darwin/path_provider_foundation.podspec
This file was deleted.
Oops, something went wrong.
28 changes: 0 additions & 28 deletions
28
...ages/path_provider/path_provider_foundation/darwin/path_provider_foundation/Package.swift
This file was deleted.
Oops, something went wrong.
75 changes: 0 additions & 75 deletions
75
...darwin/path_provider_foundation/Sources/path_provider_foundation/PathProviderPlugin.swift
This file was deleted.
Oops, something went wrong.
14 changes: 0 additions & 14 deletions
14
...path_provider_foundation/Sources/path_provider_foundation/Resources/PrivacyInfo.xcprivacy
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be a breaking change? Developers who are importing the "path_provider_foundation" module directly will get a build failure since it's not longer available. Here's an example I found:
https://github.com/MixinNetwork/flutter-app/blob/1a0fd1691c3c5fd9a4d86097d73efeb438cd9ca5/macos/Runner/AppDelegate.swift#L5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't generally consider native code changes to be breaking changes for the plugin unless the native code is explicitly intended for direct native use (e.g., this file).
I can't think of a good reason to directly import this native package. Notably, that code... doesn't appear to make sense? The import is there to create an instance of the plugin that is never used and never wired up to anything. Also, even if we considered this a breaking change for
path_provider_foundation
, we wouldn't consider it a breaking change forpath_provider
, and that app is not directly relying onpath_provider_foundation
so would be broken anyway.Ultimately, there's a large grey area of things that can break unexpected use cases, but that we don't consider breaking (e.g., adding a parameter to a method of a Dart class that's not intended to be subclassed). I would definitely include this change in that area. We have not considered it breaking in the past to change the name of the plugin class, which is very similar.