Skip to content
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

Federate the Android and iOS implementations of 1P plugins #68498

Closed
MisterJimson opened this issue Oct 19, 2020 · 5 comments · Fixed by flutter/plugins#6171
Closed

Federate the Android and iOS implementations of 1P plugins #68498

MisterJimson opened this issue Oct 19, 2020 · 5 comments · Fixed by flutter/plugins#6171
Labels
P2 Important issues not at the top of the work list package flutter/packages repository. See also p: labels. platform-android Android applications specifically platform-ios iOS applications specifically team Infra upgrades, team productivity, code health, technical debt. See also team: labels.

Comments

@MisterJimson
Copy link

Use case

From the flutter docs: https://flutter.dev/docs/development/packages-and-plugins/developing-packages#federated-plugins

Federated plugins are a a way of splitting support for different platforms into separate packages. So, a federated plugin can use one package for iOS, another for Android, another for web, and yet another for a car (as an example of an IoT device). Among other benefits, this approach allows a domain expert to extend an existing plugin to work for the platform they know best.

This seems at odds with the official plugins not having the Android and iOS implementations in separate projects.

Looking at shared_preferences as an example: https://github.com/flutter/plugins/tree/master/packages/shared_preferences

Why are web and desktop in separate packages but Android and iOS are not? If we want to swap the implementation of Android or iOS, the default implementation is still present. Why are they special?

Proposal

Treat all platforms the same, 1 package per platform.

Here is an example of what I am calling "fully federated", where there is no platform implementations in the app facing package: https://github.com/MisterJimson/federated_plugins_example/tree/fully-federated

@stuartmorgan
Copy link
Contributor

stuartmorgan commented Oct 19, 2020

Why are web and desktop in separate packages but Android and iOS are not?

Because they predate federation.

Treat all platforms the same, 1 package per platform.

This is the plan of record. However, the work of transitioning existing plugin implementations has been low priority.

Patches federating existing mobile implementations would be welcome, and it's something that will get cleaned up at some point.

@darshankawar darshankawar added plugin c: proposal A detailed proposal for a change to Flutter labels Oct 20, 2020
@stuartmorgan stuartmorgan added team Infra upgrades, team productivity, code health, technical debt. See also team: labels. P2 Important issues not at the top of the work list and removed c: proposal A detailed proposal for a change to Flutter labels May 21, 2021
@stuartmorgan stuartmorgan added platform-android Android applications specifically platform-ios iOS applications specifically labels Jun 13, 2021
@Sunbreak
Copy link
Contributor

Does it work out? woodemi/quick_flutter.brick#22 (comment)

  • Choice B: all implementations are in their own federated package
$ mason make quick_flutter_federated_plugin
...
$ ls fedplugin/
fedplugin			fedplugin_ios			fedplugin_macos			fedplugin_web
fedplugin_android		fedplugin_linux			fedplugin_platform_interface	fedplugin_windows

@stuartmorgan
Copy link
Contributor

I'm not sure what you are asking. If it's "is it possible to implement what this issue describes", then yes.

stuartmorgan added a commit to flutter/plugins that referenced this issue Nov 10, 2021
Fully federates the plugin by moving the existing mobile implementations to their own packages, per planned repo structure.

Temporarily marks `path_provider` as unpublishable to allow the implementations to be moved, rather than copied and deleted, in order to better preserve git history. A follow-up PR will restore it to publishable form.

Part of flutter/flutter#68498
stuartmorgan added a commit to stuartmorgan/plugins that referenced this issue Nov 10, 2021
Now that the iOS and Android implementation packages are published,
switch to them and re-enable publishing.

Part of flutter/flutter#68498
stuartmorgan added a commit to flutter/plugins that referenced this issue Nov 13, 2021
Now that the iOS and Android implementation packages are published,
switch to them and re-enable publishing.

Part of flutter/flutter#68498
stuartmorgan added a commit to flutter/plugins that referenced this issue Nov 19, 2021
Fully federates the plugin by moving the existing mobile implementations to their own packages, per planned repo structure.

Temporarily marks shared_preferences as unpublishable to allow the implementations to be moved, rather than copied and deleted, in order to better preserve git history. A follow-up PR will restore it to publishable form.

Part of flutter/flutter#68498
stuartmorgan added a commit to stuartmorgan/plugins that referenced this issue Nov 19, 2021
Restores the app-facing package to publishable state, pointing at the
newly-published federated Android and iOS implementation packages.

Part of Part of flutter/flutter#68498
stuartmorgan added a commit to flutter/plugins that referenced this issue Nov 19, 2021
Restores the app-facing package to publishable state, pointing at the
newly-published federated Android and iOS implementation packages.

Part of Part of flutter/flutter#68498
stuartmorgan added a commit to flutter/plugins that referenced this issue Nov 22, 2021
Fully federates the plugin by moving the existing mobile implementations to their own packages, per planned repo structure.

Temporarily marks `url_launcher` as unpublishable to allow the implementations to be moved, rather than copied and deleted, in order to better preserve git history. A follow-up PR will restore it to publishable form.

Part of flutter/flutter#68498
stuartmorgan added a commit to stuartmorgan/plugins that referenced this issue Nov 23, 2021
Restores the app-facing package to a publishable state now that _android
and _ios implementation packages are published.

Part of flutter/flutter#68498
stuartmorgan added a commit to flutter/plugins that referenced this issue Nov 29, 2021
Restores the app-facing package to a publishable state now that _android
and _ios implementation packages are published.

Part of flutter/flutter#68498
amantoux pushed a commit to amantoux/plugins that referenced this issue Dec 11, 2021
Fully federates the plugin by moving the existing mobile implementations to their own packages, per planned repo structure.

Temporarily marks `path_provider` as unpublishable to allow the implementations to be moved, rather than copied and deleted, in order to better preserve git history. A follow-up PR will restore it to publishable form.

Part of flutter/flutter#68498
amantoux pushed a commit to amantoux/plugins that referenced this issue Dec 11, 2021
Now that the iOS and Android implementation packages are published,
switch to them and re-enable publishing.

Part of flutter/flutter#68498
amantoux pushed a commit to amantoux/plugins that referenced this issue Dec 11, 2021
Fully federates the plugin by moving the existing mobile implementations to their own packages, per planned repo structure.

Temporarily marks shared_preferences as unpublishable to allow the implementations to be moved, rather than copied and deleted, in order to better preserve git history. A follow-up PR will restore it to publishable form.

Part of flutter/flutter#68498
stuartmorgan added a commit to flutter/plugins that referenced this issue Feb 2, 2022
Moves the iOS and Android implementations to their own federated packages. The iOS implementation package uses the name `avfoundation` rather than `ios` since it is likely that a macOS implementation could share a significant amount of code.

As part of the federation, migrates the mobile implementations to using in-package method channels rather than the shared method channel. Currently these are just duplicates of the existing method channels; updating them to new version of Pigeon will be done in a separate PR later.

Temporarily marks `video_player` as unpublishable to allow the implementations to be moved, rather than copied and deleted, in order to better preserve git history. A follow-up PR will restore it to publishable form.

No version change: The changes to `video_player_platform_interface` only affect development of the plugin, not use of the plugin.

Part of flutter/flutter#68498
Part of flutter/flutter#94224
stuartmorgan added a commit to stuartmorgan/plugins that referenced this issue Feb 2, 2022
Publishes the change from in-package Android and iOS implementations
to federated implementations.

Part of flutter/flutter#68498
stuartmorgan added a commit to stuartmorgan/plugins that referenced this issue Feb 2, 2022
Publishes the change from in-package Android and iOS implementations
to federated implementations.

Part of flutter/flutter#68498
henkibro pushed a commit to henkibro/url_launcher that referenced this issue Mar 1, 2022
Fully federates the plugin by moving the existing mobile implementations to their own packages, per planned repo structure.

Temporarily marks `url_launcher` as unpublishable to allow the implementations to be moved, rather than copied and deleted, in order to better preserve git history. A follow-up PR will restore it to publishable form.

Part of flutter/flutter#68498
henkibro pushed a commit to henkibro/url_launcher that referenced this issue Mar 1, 2022
Restores the app-facing package to a publishable state now that _android
and _ios implementation packages are published.

Part of flutter/flutter#68498
@stuartmorgan
Copy link
Contributor

Note: camera is blocked by #100555.

stuartmorgan added a commit to stuartmorgan/plugins that referenced this issue Apr 12, 2022
Restores the app-facing package to a publishable state, switch to the
newly published federated mobile versions.

Part of flutter/flutter#68498
stuartmorgan added a commit to stuartmorgan/plugins that referenced this issue Jun 9, 2022
Re-enables publishing of `camera` now that the mobile federated
implementation packages have been published.

Part of flutter/flutter#68498
stuartmorgan added a commit to stuartmorgan/plugins that referenced this issue Aug 4, 2022
Restored the app-facing package to publishable state, using the
newly-published federated mobile implementations.

Part of flutter/flutter#68498
stuartmorgan added a commit to stuartmorgan/plugins that referenced this issue Aug 4, 2022
Restored the app-facing package to publishable state, using the
newly-published federated mobile implementations.

Part of flutter/flutter#68498
stuartmorgan added a commit to flutter/plugins that referenced this issue Aug 17, 2022
Restored the app-facing package to publishable state, using the
newly-published federated mobile implementations.

Part of flutter/flutter#68498
@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 17, 2022
@flutter-triage-bot flutter-triage-bot bot added the package flutter/packages repository. See also p: labels. label Jul 5, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
P2 Important issues not at the top of the work list package flutter/packages repository. See also p: labels. platform-android Android applications specifically platform-ios iOS applications specifically team Infra upgrades, team productivity, code health, technical debt. See also team: labels.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants