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

[native assets] Specify supported OS, Arch, minimum SDK version #1500

Open
dcharkes opened this issue Sep 3, 2024 · 0 comments
Open

[native assets] Specify supported OS, Arch, minimum SDK version #1500

dcharkes opened this issue Sep 3, 2024 · 0 comments

Comments

@dcharkes
Copy link
Collaborator

dcharkes commented Sep 3, 2024

Flutter has a way for describing what OSes an app/plugin runs on via the pubspec and what minimal SDK version and architecture an app/plugin runs from via the native build files (Gradle, XCodeBuild, etc.)

Dart standalone has nothing to express this.

The current prototype of native assets in Flutter ties into what the native build systems provide, and the current prototype for Dart standalone completely ignores native version constraints.

We should provide a way express SDK version, OS, and architecture constraints (other than failing the build hook when invoked).

  1. Then we can check these in the same way Flutter does: The minimum SDK version of the app should be at least as high as the lowest SDK version of all packages.
  2. Moreover, we can then check if the architecture and OS is supported even before invoking the build hook.
  3. Finally, we could surface such info on pub.dev (Surface supported architectures per OS pub-dev#8010).

I believe we have two main directions we could go in here.

1. List in the pubspec

platforms:
  android:
    architectures:
      - arm64
      - x64 # simulator
    minimum-sdk: 123
  ios:
    architectures:
      - ...

Pros:

  • Declarative.
  • Could be used for existing plugins, not only native assets.

Cons:

  • Could get out of sync with the build hook if native assets are used.

2. Let the hook report it

Pros:

  • Most hook implementations would use one helper to both report the supported archs as well as produce the native code assets.

Cons:

  • Requires invoking a script (in a sandbox) in order to get the info.
  • Does not work for existing Flutter plugins.

Related notes on specifying external versions (SDK versions, but also versions such as Java version) in internal doc: go/native-assets-external-versions

Having a Flutter-agnostic way would create duplication with what Flutter already does in native build files, so we'd want to try to get the versions and architectures in the native build files read from the pubspec/hooks. flutter/flutter#154425 (comment)

Any options I'm missing? Have you seen patterns of how to deal with external versions (OS API version, etc.) @mkustermann @mraleph?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant