GregoryConrad / mimir

⚡ Supercharged Flutter/Dart Database
https://pub.dev/packages/mimir
MIT License
128 stars 10 forks source link

refactor!: update to flutter rust bridge v2 #332

Closed mcmah309 closed 3 months ago

mcmah309 commented 3 months ago

closes https://github.com/GregoryConrad/mimir/issues/331

GregoryConrad commented 3 months ago

This is a huge help! TYSM!

It'll take awhile to review all of this (especially since I didn't look in-depth at the FRB v2 changes), so please bear with me while I take a look!

Edit: wasn't as bad as the diff made it out to be--mostly just code gen file updates 😄

mcmah309 commented 3 months ago

Yeah that works!

GregoryConrad commented 3 months ago

I need to go to bed so I'll leave some notes here on where I left off:

// flutter_interface.dart
  /// Creates a [MimirInstance] from the given path for Flutter
  Future<MimirInstance> getInstanceForPath(String path) =>
      getInstance(path: path); // TODO do we need ioDirectory?
# combine-prs

          cargo build -r
          # TODO update generated files
          # TODO run code formatter
          git config --global user.name 'MimirActionsBot'
          git config --global user.email 'mimiractionsbot@users.noreply.github.com'
          git commit -am "chore: update generated files"
          git push
GregoryConrad commented 3 months ago

Switching to dynamic linking would be a one-line fix on iOS/macOS if it weren't for CocoaPods. Thanks CocoaPods! Now I get to rediscover how to get iOS/macOS builds working again.

Looked into Swift Package Manager integration into Flutter but that appears as though it'll take some time before it reaches stable. So will need to find a new solution that deals with CocoaPods in the meantime.

mcmah309 commented 3 months ago

Yup, sounds like flutter development :sweat_smile:

Btw, for this failure, I manually changed it to just String to get it to work. There was one more spot too where I had to add an int cast. Likely bugs in the current flutter rust bridge version.

edit: I see you just fixed it. Nice timing.

GregoryConrad commented 3 months ago

Btw, for this failure, I manually changed it to just String to get it to work. There was one more spot too where I had to add an int cast. Likely bugs in the current flutter rust bridge version.

Hm. I fixed the toString failure by excluding it from codegen (since it was never supposed to be included in codegen anyways). Some bug in FRB made it get included even though it wasn't pub.

Also haven't seen the int casting issue pop-up--maybe something else I did fixed that.

GregoryConrad commented 3 months ago

I think I'm going to do a temp fix here for iOS/macOS that reverts to using the discouraged ExternalLibrary.process method until Swift Package Manager support in Flutter rolls. That way I avoid having to rewrite and re-experiment with all of the iOS/macOS build stuff (which is extremely time consuming). I have the basics of dynamic libraries working with CocoaPods but it'll require quite a few hacks to get right, and since we are already using hacks with ExternalLibrary.process, might as well use the hack that enables the most code re-use.

That being said, notes to future self once SPM support comes: