Skip to content

Commit 8f8eefc

Browse files
committed
Update commands to generate flatbuffer rust code
Signed-off-by: Ludvig Liljenberg <[email protected]>
1 parent 81dc6f2 commit 8f8eefc

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

Justfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ build-fuzzer fuzz-target:
362362
###################
363363

364364
gen-all-fbs-rust-code:
365-
for fbs in `find src -name "*.fbs"`; do flatc -r --rust-module-root-file --gen-all -o ./src/hyperlight_common/src/flatbuffers/ $fbs; done
365+
flatc --rust --rust-module-root-file --gen-all -o ./src/hyperlight_common/src/flatbuffers/ ./src/schema/all.fbs
366366
just fmt-apply
367367

368368
install-vcpkg:

docs/how-to-use-flatbuffers.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,3 @@ We recommend building `flatc` from source. To generate rust code, use
1919
```console
2020
just gen-all-fbs-rust-code
2121
```
22-
23-
### Note about generated code
24-
25-
Because we invoke `flatc` multiple times when generating the Rust code, the `mod.rs` generated in `./src/hyperlight_common/src/flatbuffers` is overwritten multiple times and will likely be incorrect. Make sure to manually inspect and if necessary update this file before continuing with your changes as certain modules might be missing. After fixing `mod.rs`, you might need to re-run `just fmt`, since it might not have applied to all generated files if your `mod.rs` was invalid.
26-
27-
>`flatc` does support passing multiple schema files (e.g. it is possible to pass `.\src\schema\*.fbs`), so we could regenerate all the files each time a change was made, however that generates incorrect code (see [here](https://github.com/google/flatbuffers/issues/6800) for details).

src/schema/all.fbs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
include "function_types.fbs";
2+
include "function_call_result.fbs";
3+
include "function_call.fbs";
4+
include "guest_error.fbs";
5+
include "guest_log_data.fbs";
6+
include "host_function_definition.fbs";
7+
include "host_function_details.fbs";

0 commit comments

Comments
 (0)