feat(migration)

This commit is contained in:
Ember Moth
2026-07-07 16:33:17 +08:00
parent 953a9e5409
commit aa71d56154
172 changed files with 966 additions and 103 deletions
+19
View File
@@ -0,0 +1,19 @@
// rust2go build script.
//
// Wires up the Go source tree (./go/r2g) into the Rust build:
// - Embeds the Go source path so the Builder can compile it via CGO.
// - Wires `src/idl.rs` (Rust IDL) → `./go/r2g/gen.go`
// (auto-generated Go glue).
//
// On every `cargo build` the Builder regenerates gen.go if the IDL
// changed, then compiles the Go code into a static library that the
// Rust crate is linked against.
fn main() {
rust2go::Builder::new()
.with_go_src("./go/r2g")
// gen.go is written relative to the build script's CWD (the
// crate root), so we spell out the path under go/r2g/ where
// the Go package lives.
.with_regen("src/idl.rs", "go/r2g/gen.go")
.build();
}