irondash / cargokit

Integrate cargo build with flutter plugins and applications.
Other
58 stars 18 forks source link

Absolute path crate for Linux, Android, and Windows #10

Open temeddix opened 1 year ago

temeddix commented 1 year ago
Target Absolute path Relative path
Android
iOS
macOS
Linux
Windows

Currently, we cannot provide absolute path to Cmake and gradle. For cocoapods, it is possible. Can this be improved either with direct commit or PR?

knopp commented 1 year ago

That is the point of absolute path for crates? Can you provide an example?

temeddix commented 1 year ago

If a Flutter plugin has Rust crates in its filetree, then relative path is enough. However, if a Flutter plugin needs to use Rust crates OUTSIDE the plugin foldertree, absolute path should be provided. Actually, this is what we're doing at https://github.com/cunarist/rust-in-flutter

knopp commented 1 year ago

I don't really understand your project structure. You have rust_in_flutter package, but the native code lives inside the example that depends on rust_in_flutter? Why do you structure it like that?

temeddix commented 1 year ago

The example folder in Rust-In-Flutter repo is not really for running code. It has two purposes:

So example/native does not really run directly. Rather it gets 'copied' to the Flutter app. The copied template in the dependent is then used by Rust-In-Flutter.

If this issue is hard to be accepted, that's okay, I appreciate it :)

knopp commented 1 year ago

I'd keep this open for now. I'm currently rewriting the Rust part of cargokit into dart (to optionally support prebuilding binaries and it will also be handy once build.dart support lands in pub) so there are too many moving pieces right now. Once the dust settles I can revisit this.

The way I see this instead of concatenating the path in CMake/Gradle it would be passed as it was specified into the build_tool which would then do the right thing.