Skip to content

feat: replace native_toolchain_rust with cargokit until Dart native assets reach stable#7

Merged
sneurlax merged 6 commits intomainfrom
cargokit
Oct 5, 2025
Merged

feat: replace native_toolchain_rust with cargokit until Dart native assets reach stable#7
sneurlax merged 6 commits intomainfrom
cargokit

Conversation

@sneurlax
Copy link
Contributor

@sneurlax sneurlax commented Oct 5, 2025

The native assets feature which native_toolchain_rust requires is in alpha. There are also some issues with it being out of date with native_assets_cli such that updates are nontrivial: see irondash/native_toolchain_rust#26

  • Log changes in CHANGELOG
  • Test on each platform
    • Android
    • iOS
    • Linux
    • macOS
    • Windows

- Remove native_toolchain_rust_mirror and native_assets_cli from dependencies.
- Remove native_manifest.yaml and hook/build.dart.
- Move ffigen to dev_dependencies (will be used for generating bindings from cargokit-built Rust).

Preparing to migrate from native_toolchain_rust to cargokit build system.
- Squashed 'cargokit/' content from commit ec49f0e from https://github.com/irondash/cargokit.

Cargokit provides cross-platform Rust build integration for Flutter plugins.
- Add Flutter platform support (Android, iOS, Linux, macOS, Windows).
- Configure all platforms to use cargokit for Rust builds:
  * Android: gradle configuration with cargokit plugin.
  * iOS/macOS: pod spec with cargokit build script.
  * Linux/Windows: CMakeLists.txt with cargokit integration.
- Add basic Rust library with sum() function as proof of concept.
- Create example Flutter app to demonstrate plugin.
- Update pubspec.yaml to declare FFI plugin for all platforms.
- Configure ffigen to generate bindings from src/monero.h.

The library is now a Flutter plugin that uses cargokit to build
and bundle Rust code across all supported platforms.
Changes:
- Created minimal rust/Cargo.toml that depends on ../../monero-rust.
- rust/src/lib.rs re-exports monero-rust::ffi functions.
- Copied header file from monero-rust.
- Generated Dart bindings from monero-rust header.
- Updated lib/monero.dart with full Monero API (generate_mnemonic, generate_address).

The Rust build system (via cargokit) will now build monero-rust
and link it into the Flutter plugin.
- Add generated MoneroBindings class with proper FFI wrappers
- Update monero.h header file (remove extra comment block)
- Fix android/build.gradle to reference correct cargokit plugin path (plugin.gradle).
- Add [replace] directive in rust/Cargo.toml to use local serai-mirror.
- Require serai-mirror at ../serai-mirror on fix/android-serai branch.
- Android builds now work by using rustls-tls instead of native-tls/OpenSSL.

The OpenSSL dependency in monero-serai-mirror's reqwest prevented cross-compilation to Android targets.  This is resolved by using a local serai-mirror with rustls-tls as the TLS backend.  This is a temporary solution until migration to monero-oxide.
@sneurlax sneurlax merged commit 6abca54 into main Oct 5, 2025
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 this pull request may close these issues.

1 participant