Traverse-Research / opensource-ecosystem

Open-source tracking repository for Traverse Research
12 stars 0 forks source link

Traverse Research Android tracking issues #4

Open Jasper-Bekkers opened 2 years ago

Jasper-Bekkers commented 2 years ago

At the moment setting up an android build from Rust / cargo is a bit of a pain. There's a lot of manual setup involved and there are fundamental limitations to some of the core rust tools that would need to be addressed. To address some of these issues we've tried to make some steps ourselves;

Next steps

However, to take some of the next steps it would be nice to see progress from the cargo core team to make it able to build and run apks directly from cargo instead of requiring intermediate tooling.

Ideally I would love to see the rust workflow for building and running android applications to be as simple as:

cargo build --target ... --target ...
cargo run --device ??
dvc94ch commented 2 years ago

I'd like to point out an alternative approach. Recently I've been working on a replacement for cargo-apk called x. It's a build tool for building rust and rust/flutter applications for all platforms and publishing to the play/microsoft/app stores. It can currently download prepackaged macos/ios/windows sdks and can cross compile debug builds. Would really like to foster some collaboration, but it's still early days and will take a few more weeks until it starts being useful.

MarijnS95 commented 2 years ago

@dvc94ch It'd be great to have a solution that deals with with all platforms at once, but our end goal is to have it baked into cargo as a cross-ecosystem solution.

How does x relate to cargo-mobile?

dvc94ch commented 2 years ago

cargo-mobile is similar to flutter, they integrate into existing build systems. this is in my opinion a pain point as you need to configure 5 different build systems if you're building a cross platform application, and platform features need to be exposed in kotlin/swift/c++. Another pain point is that you actually need a mac to build an ios app with cargo-mobile, something that x still requires to generate certificates and provisioning profiles, but the end goal is being a cross platform system.

I think there is a lot of stuff here that will be tricky to integrate into cargo, because it's likely out of scope of what cargo does and possibly should do. In any case if cargo does gain more abilities more work can be offloaded to cargo. but I expect x to be a great testing ground for this purpose. For example I think the sdk-manager you built would be a nice fit to simplify the setup process on android for x, but I don't think it will ever become a part of cargo.

I'm not particularly attached to flutter in the long run, but for non-game apps I think it will be the most expedient short term solution. Rust can be used to build cross platform abstractions that can easily be integrated in dart using something like ffi-gen. But I know you have more of a game centric focus.