Add a --conform-includes flag to specify include path for the conform schema
(mirrored from cl 133146933)
Change-Id: I61385289728777cae83139fef0229001d92382ca
diff --git a/src/flatc.cpp b/src/flatc.cpp
index 5ca7ab3..bb9f395 100644
--- a/src/flatc.cpp
+++ b/src/flatc.cpp
@@ -133,6 +133,8 @@
" --schema Serialize schemas instead of JSON (use with -b)\n"
" --conform FILE Specify a schema the following schemas should be\n"
" an evolution of. Gives errors if not.\n"
+ " --conform-includes Include path for the schema given with --conform\n"
+ " PATH \n"
"FILEs may be schemas, or JSON files (conforming to preceding schema)\n"
"FILEs after the -- must be binary flatbuffer format files.\n"
"Output files are named using the base file name of the input,\n"
@@ -169,6 +171,7 @@
bool schema_binary = false;
std::vector<std::string> filenames;
std::vector<const char *> include_directories;
+ std::vector<const char *> conform_include_directories;
size_t binary_files_from = std::numeric_limits<size_t>::max();
std::string conform_to_schema;
for (int argi = 1; argi < argc; argi++) {
@@ -185,6 +188,9 @@
} else if(arg == "--conform") {
if (++argi >= argc) Error("missing path following" + arg, true);
conform_to_schema = argv[argi];
+ } else if (arg == "--conform-includes") {
+ if (++argi >= argc) Error("missing path following" + arg, true);
+ conform_include_directories.push_back(argv[argi]);
} else if(arg == "--strict-json") {
opts.strict_json = true;
} else if(arg == "--allow-non-utf8") {
@@ -265,7 +271,8 @@
std::string contents;
if (!flatbuffers::LoadFile(conform_to_schema.c_str(), true, &contents))
Error("unable to load schema: " + conform_to_schema);
- ParseFile(conform_parser, conform_to_schema, contents, include_directories);
+ ParseFile(conform_parser, conform_to_schema, contents,
+ conform_include_directories);
}
// Now process the files: