Support multiple fbs files & no root types in static flatbuffers
In order to improve parity with the existing flatbuffer bazel rules, add
support for:
* Multiple srcs files.
* Generating code for files where no root_type has been specified.
Change-Id: I77d909978fd0bf5125b9e789162c7b629d0fe00d
Signed-off-by: James Kuszmaul <james.kuszmaul@bluerivertech.com>
diff --git a/aos/flatbuffers/generate.cc b/aos/flatbuffers/generate.cc
index 2e081f3..030de35 100644
--- a/aos/flatbuffers/generate.cc
+++ b/aos/flatbuffers/generate.cc
@@ -8,13 +8,17 @@
DEFINE_string(reflection_bfbs, "", "Path to the .bfbs reflection file.");
DEFINE_string(output_file, "", "Path to the output header to write.");
+DEFINE_string(base_file_name, "",
+ "Name of the base file to generate code for as used by the "
+ "reflection::Schema object.");
namespace aos::fbs {
int Main() {
aos::FlatbufferVector<reflection::Schema> schema =
aos::FileToFlatbuffer<reflection::Schema>(FLAGS_reflection_bfbs);
aos::util::WriteStringToFileOrDie(
- FLAGS_output_file, GenerateCodeForRootTableFile(&schema.message()));
+ FLAGS_output_file,
+ GenerateCodeForRootTableFile(&schema.message(), FLAGS_base_file_name));
return EXIT_SUCCESS;
}
} // namespace aos::fbs