Fix includes of reflection.fbs with static flatbuffer API
Because the base reflection_generated.h needs to be available to flatc
at compile-time, it gets checked into the repository. On top of this,
flatc special-cases `reflection/reflection.fbs` for inclusion, so we
need to treat it special in our #include paths as well.
This makes it so that we codegen the reflection_static.h from
reflection.fbs, and introduces a requirements that any flatbuffer files
which use the reflection.fbs must depend on
@aos//aos/flatbuffers/reflection:reflection_fbs
Change-Id: I22a11e86052b7bd90efadb209a7529ff58b6e0ca
Signed-off-by: James Kuszmaul <james.kuszmaul@bluerivertech.com>
diff --git a/aos/flatbuffers/static_flatbuffers_test.cc b/aos/flatbuffers/static_flatbuffers_test.cc
index ca1cf42..52fa01e 100644
--- a/aos/flatbuffers/static_flatbuffers_test.cc
+++ b/aos/flatbuffers/static_flatbuffers_test.cc
@@ -10,6 +10,7 @@
#include "aos/flatbuffers.h"
#include "aos/flatbuffers/builder.h"
#include "aos/flatbuffers/interesting_schemas.h"
+#include "aos/flatbuffers/test_dir/include_reflection_static.h"
#include "aos/flatbuffers/test_dir/type_coverage_static.h"
#include "aos/flatbuffers/test_schema.h"
#include "aos/flatbuffers/test_static.h"
@@ -1088,4 +1089,9 @@
aos::FlatbufferToJson(from_object_static, {.multi_line = true}));
}
+// Tests that we can build code that uses the reflection types.
+TEST_F(StaticFlatbuffersTest, IncludeReflectionTypes) {
+ VerifyJson<::aos::testing::UseSchemaStatic>("{\n\n}");
+}
+
} // namespace aos::fbs::testing