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

Switch IOS and MacOs To Use Dynamic Libs #334

Closed
mcmah309 opened this issue Aug 6, 2024 · 6 comments
Closed

Switch IOS and MacOs To Use Dynamic Libs #334

mcmah309 opened this issue Aug 6, 2024 · 6 comments

Comments

@mcmah309
Copy link
Contributor

mcmah309 commented Aug 6, 2024

Due to difficulties with CocoaPods, IOS and MacOs currently use discouraged ExternalLibrary.process. Flutter 3.24.0 provides support for the Swift Package Manager that may fix these issues: https://docs.flutter.dev/packages-and-plugins/swift-package-manager/for-plugin-authors#how-to-add-swift-package-manager-support-to-an-existing-flutter-plugin

Ref: #332 (comment)

@GregoryConrad
Copy link
Owner

GregoryConrad commented Aug 6, 2024

Oh! Thanks for the heads up; I had no clue SPM support was right around the corner. I'll take a look later today.

Looks like a cake walk when compared to CocoaPods: https://developer.apple.com/documentation/xcode/distributing-binary-frameworks-as-swift-packages

@GregoryConrad
Copy link
Owner

I almost got really lucky with this since SPM has support for remote binary targets. Only problem is that they require a checksum for it, which is not feasible for me to do based on how Mimir is setup. Mimir needs to generate the changes to OS build specific files (like package.swift) when a new version is created, but the new version being created won't have the binaries generated in CI until the new version is created and has been pushed to GitHub (and thus no checksum until after the fact).

So that leaves us with either:

  • Seeing if SPM can support compiling the Rust code itself (if it isn't too much of a PITA)
  • Download the file ourselves and then just use the local file for the binary target

I'm going to look into the first option to start, but will fallback to the second in case the first isn't feasible.

@GregoryConrad
Copy link
Owner

Just realized I won't be able to do the Rust build on local dev machines since the Rust code lives in /packages/mimir, not /packages/flutter_mimir. So I'll need to just write a hack in the package.swift to download the binary file, much like it is done in CocoaPods today.

@GregoryConrad
Copy link
Owner

GregoryConrad commented Aug 8, 2024

TODO:

  • update FRB code gen settings for SPM (disable or move C headers to new location)
  • iOS

Probably just disable the FRB code gen since it seems we can just use SPM to distribute the dylib itself

@GregoryConrad
Copy link
Owner

...and SPM runs in a sandbox so I've gotta completely redo CI/CD so that we can generate a checksum ahead of time. Not super happy about it, but what can you do

@GregoryConrad
Copy link
Owner

I've since realized this will just be too much of a pain to do with all of the changes needed. I'm holding out hope that Native Assets will come before CocoaPods support is removed.

@GregoryConrad GregoryConrad closed this as not planned Won't fix, can't repro, duplicate, stale Aug 10, 2024
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

Successfully merging a pull request may close this issue.

2 participants