Add a FileWriter interface (#7821)

* Add a FileWriter interface

* Change interface

* Provide 2 impl for File interface: FileManager & FileNameManager

* Update

* update

* Update

* Add file_writer file

* Update

* Format files

* Update based on review

* Update

* Format bzl file

* Add LoadFile function

* Format

---------

Co-authored-by: Derek Bailey <derekbailey@google.com>
This commit is contained in:
Khanh Nguyen
2023-04-05 18:49:29 -07:00
committed by GitHub
parent 0888e7cb4d
commit 0916f1c87e
13 changed files with 217 additions and 10 deletions

View File

@@ -250,6 +250,8 @@ const static FlatCOption flatc_options[] = {
{ "", "no-leak-private-annotation", "",
"Prevents multiple type of annotations within a Fbs SCHEMA file. "
"Currently this is required to generate private types in Rust" },
{ "", "file-names-only", "",
"Print out generated file names without writing to the files"},
};
auto cmp = [](FlatCOption a, FlatCOption b) { return a.long_opt < b.long_opt; };
@@ -653,6 +655,9 @@ FlatCOptions FlatCompiler::ParseFromCommandLineArguments(int argc,
} else if (arg == "--annotate") {
if (++argi >= argc) Error("missing path following: " + arg, true);
options.annotate_schema = flatbuffers::PosixPath(argv[argi]);
} else if(arg == "--file-names-only") {
// TODO (khhn): Provide 2 implementation
options.file_names_only = true;
} else {
if (arg == "--proto") { opts.proto_mode = true; }