[rust] init multipass cargo workspace & oxidize petname
This pull request introduces Rust to Multipass by migrating the petname (name generation e.g. hearty-kangaroo) functionality from C++ to Rust and integrates it into the build and runtime environments. This transition involves replacing the old C++ name generator with a new Rust implementation, updating the build system to compile and link the Rust static library, and adapting relevant CI and packaging scripts to support Rust. The changes also update C++ code to use the Rust FFI for name generation and remove legacy C++ petname code.
Petname/name generation migration to Rust:
- Added new Rust crate (tentatively named
rustipass) and implemented petname in rust as a module, exposing FFI functions for name generation and tests. - Updated C++ code (
src/client/gui/ffi/dart_ffi.cpp,src/daemon/daemon.cpp) to use Rust FFI for petname generation instead of the old C++NameGenerator. - Removed legacy C++ petname and name generator code (
include/multipass/name_generator.h,src/petname/make_name_generator.cpp).
Build system and CI integration:
- Updated CMake configuration to build the Rust static library and link it as an interface library for petname, removing previous code-generation steps. (
src/petname/CMakeLists.txt) - Added Rust-related files to CI triggers and installed Rust toolchain in CI workflows for Windows/macOS (
.github/workflows/dynamic-ci.yml,.github/workflows/windows-macos.yml).
Packaging and environment updates:
- Added Rust as a build dependency and ensured the Rust toolchain is initialized during Snap builds and CI (
BUILD.*.md,snap/snapcraft.yaml)
Daemon configuration cleanup:
- Removed all references to the old C++
NameGeneratorfrom daemon configuration code (src/daemon/daemon_config.cpp,src/daemon/daemon_config.h).
MULTI-2218
Codecov Report
:x: Patch coverage is 93.43066% with 9 lines in your changes missing coverage. Please review.
:white_check_mark: Project coverage is 89.30%. Comparing base (68ede90) to head (3c2af6c).
:warning: Report is 24 commits behind head on main.
| Files with missing lines | Patch % | Lines |
|---|---|---|
| src/rustipass/rust_petname_generator.cpp | 42.85% | 8 Missing :warning: |
| src/daemon/daemon.cpp | 75.00% | 1 Missing :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## main #4299 +/- ##
==========================================
+ Coverage 89.28% 89.30% +0.02%
==========================================
Files 260 261 +1
Lines 17532 17636 +104
==========================================
+ Hits 15653 15750 +97
- Misses 1879 1886 +7
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
For Rust CI, you can take a look at the Rust code sanity desktop action, and the app-center-ratings ci to see the linter, formatter, testing and sec checks other projects are using.