nmfisher / thermion

3D rendering toolkit for Dart and/or Flutter
https://thermion.dev
Apache License 2.0
116 stars 9 forks source link

Use native_assets for build (and separate into platform-specific packages) #19

Closed nmfisher closed 3 months ago

nmfisher commented 6 months ago

Ideally the Filament libraries for each platform should reside in their own repository (so building for one platform doesn't require pulling binaries for all the other platforms).

dart pub doesn't support Git LFS at the moment but I've started experimenting with native_assets, and this seems to be a much nicer way of handling native dependencies (no futzing around with Xcode, for example). We could host the binaries somewhere and then pull them as part of the build process.

nmfisher commented 3 months ago

I've migrated the build system to use native_assets, but the Filament libraries are still stored in LFS, which means we can't publish as-is to pub.dev.

The next step is to extend hook/build.dart to check if the libraries for the target platform exist in the local build cache, and if not, download them (either directly from GitHub hosting or somewhere like Cloudflare R2).

Any help for this would be welcome!

Hannnes1 commented 3 months ago

Seeing as this is tagged as a good first issue, and it being mostly Dart, I'd like to give this a go.

Might not have a lot of time this week though, so if anyone is faster than me that's okay too.

nmfisher commented 3 months ago

🎉 That would be awesome!

Basically the steps would be: 1) zip up the contents of each folder under native/lib in the native-assets branch 2) upload each file as assets to GitHub [0] 3) in hook/build.dart:

[0] In future we could probably pull most of these directly from the official releases from the Filament repository, and just maintain our own version of the third party libs that aren't bundled with the official release (libpng, libimageio, etc). Will leave the above has been implemented. [1] I'm fairly sure that Dart native-assets does expose some way to cache build files (and check whether a build file exists in the cache), I'm just not sure exactly how to do it.

nmfisher commented 3 months ago

First release now available on pub.dev!

https://pub.dev/packages/thermion_flutter https://pub.dev/packages/thermion_dart

Please follow the instructions at https://docs.page/nmfisher/thermion/quickstart for getting up and running with the new packages.

I've also set up a Discord server, I'm online most of the time and usually available to help people.