Lines Matching +full:generate +full:- +full:schema
8 * http://www.apache.org/licenses/LICENSE-2.0
51 Error("failed to load binary schema: " + filename, false, false); in LoadBinarySchema()
70 { "", "strict-json", "",
73 { "", "allow-non-utf8", "",
74 "Pass non-UTF-8 input through parser and emit nonstandard \\x escapes in "
75 "JSON. (Default is to raise parse error on non-UTF-8 input.)" },
76 { "", "natural-utf8", "",
77 "Output strings with UTF-8 as human-readable strings. By default, UTF-8 "
79 { "", "defaults-json", "",
81 { "", "unknown-json", "",
82 "Allow fields in JSON that are not defined in the schema. These fields "
84 { "", "no-prefix", "",
86 { "", "scoped-enums", "",
88 "--no-prefix." },
89 { "", "swift-implementation-only", "",
91 { "", "gen-inclues", "",
93 "required (no include statements) use --no-includes." },
94 { "", "no-includes", "",
95 "Don't generate include statements for included schemas the generated "
96 "file depends on (C++, Python, Proto-to-Fbs)." },
97 { "", "gen-mutable", "",
98 "Generate accessors that can mutate buffers in-place." },
99 { "", "gen-onefile", "",
100 "Generate a single output file for C#, Go, Java, Kotlin and Python. "
101 "Implies --no-include." },
102 { "", "gen-name-strings", "",
103 "Generate type name functions for C++ and Rust." },
104 { "", "gen-object-api", "", "Generate an additional object-based API." },
105 { "", "gen-compare", "", "Generate operator== for object-based API types." },
106 { "", "gen-nullable", "",
108 { "", "java-checkerframe", "", "Add @Pure for Java." },
109 { "", "gen-generated", "", "Add @Generated annotation for Java." },
110 { "", "gen-jvmstatic", "",
113 { "", "gen-all", "",
114 "Generate not just code for the current schema files, but for all files it "
118 { "", "gen-json-emit", "",
120 { "", "cpp-include", "", "Adds an #include in generated file." },
121 { "", "cpp-ptr-type", "T",
123 { "", "cpp-str-type", "T",
126 "constructible from std::string (see the --cpp-str-flex-ctor option to "
128 { "", "cpp-str-flex-ctor", "",
131 { "", "cpp-field-case-style", "STYLE",
132 "Generate C++ fields using selected case style. Supported STYLE values: * "
133 "'unchanged' - leave unchanged (default) * 'upper' - schema snake_case "
134 "emits UpperCamel; * 'lower' - schema snake_case emits lowerCamel." },
135 { "", "cpp-std", "CPP_STD",
136 "Generate a C++ code using features of selected C++ standard. Supported "
137 "CPP_STD values: * 'c++0x' - generate code compatible with old compilers; "
138 "'c++11' - use C++11 code generator (default); * 'c++17' - use C++17 "
140 { "", "cpp-static-reflection", "",
141 "When using C++17, generate extra code to provide compile-time (static) "
142 "reflection of Flatbuffers types. Requires --cpp-std to be \"c++17\" or "
144 { "", "object-prefix", "PREFIX",
145 "Customize class prefix for C++ object-based API." },
146 { "", "object-suffix", "SUFFIX",
147 "Customize class suffix for C++ object-based API. Default Value is "
149 { "", "go-namespace", "", "Generate the overriding namespace in Golang." },
150 { "", "go-import", "IMPORT",
151 "Generate the overriding import for flatbuffers in Golang (default is "
153 { "", "raw-binary", "",
155 "given a mismatched schema." },
156 { "", "size-prefixed", "", "Input binaries are size prefixed buffers." },
158 { "", "proto-namespace-suffix", "SUFFIX",
160 { "", "oneof-union", "", "Translate .proto oneofs to flatbuffer unions." },
161 { "", "grpc", "", "Generate GRPC interfaces for the specified languages." },
162 { "", "schema", "", "Serialize schemas instead of JSON (use with -b)." },
163 { "", "bfbs-filenames", "PATH",
167 "directory of the first provided schema file." },
168 { "", "bfbs-comments", "", "Add doc comments to the binary schema files." },
169 { "", "bfbs-builtins", "",
170 "Add builtin attributes to the binary schema files." },
171 { "", "bfbs-gen-embed", "",
172 "Generate code to embed the bfbs schema to the source." },
174 "Specify a schema the following schemas should be an evolution of. Gives "
176 { "", "conform-includes", "PATH",
177 "Include path for the schema given with --conform PATH" },
178 { "", "filename-suffix", "SUFFIX",
181 { "", "filename-ext", "EXT",
183 "language-specific (e.g., '.h' for C++)" },
184 { "", "include-prefix", "PATH",
186 { "", "keep-prefix", "",
187 "Keep original prefix of schema include statement." },
188 { "", "reflect-types", "",
190 { "", "reflect-names", "", "Add minimal type/name reflection." },
191 { "", "rust-serialize", "",
193 { "", "rust-module-root-file", "",
194 "Generate rust code in individual files with a module root file." },
195 { "", "root-type", "T", "Select or override the default root_type." },
196 { "", "require-explicit-ids", "",
198 { "", "force-defaults", "",
200 { "", "force-empty", "",
203 { "", "force-empty-vectors", "",
208 "schema-less FlexBuffers." },
209 { "", "no-warnings", "", "Inhibit all warnings messages." },
210 { "", "warnings-as-errors", "", "Treat all warnings as errors." },
211 { "", "cs-global-alias", "",
214 { "", "cs-gen-json-serializer", "",
216 "--gen-object-api)." },
217 { "", "json-nested-bytes", "",
220 { "", "ts-flat-files", "",
222 { "", "annotate", "SCHEMA",
223 "Annotate the provided BINARY_FILE with the specified SCHEMA file." },
224 { "", "no-leak-private-annotation", "",
225 "Prevents multiple type of annotations within a Fbs SCHEMA file."
226 "Currently this is required to generate private types in Rust" },
231 size_t max_line_length = max_col - start_col; in AppendTextWrappedString()
254 ss << "-" << option.short_opt; in AppendOption()
263 ss << "--" << option.long_opt << " "; in AppendOption()
290 ss << "-" << option.short_opt; in AppendShortOption()
293 if (!option.long_opt.empty()) { ss << "--" << option.long_opt; } in AppendShortOption()
308 ss.seekp(-2, ss.cur); in GetShortUsageString()
309 ss << "]... FILE... [-- BINARY_FILE...]"; in GetShortUsageString()
319 << " [OPTION]... FILE... [-- BINARY_FILE...]\n"; in GetUsageString()
333 ".bfbs) or JSON files (conforming to preceding schema). BINARY_FILEs " in GetUsageString()
334 "after the -- must be binary flatbuffer format files. Output files are " in GetUsageString()
336 "directory or the path given by -o. example: " + in GetUsageString()
337 std::string(program_name) + " -c -b schema1.fbs schema2.fbs data.json"; in GetUsageString()
363 // TODO(dbaileychess): Right now we just support a single text-based in AnnotateBinaries()
364 // output of the annotated binary schema, which we generate here. We in AnnotateBinaries()
365 // could output the raw annotations instead and have third-party tools in AnnotateBinaries()
366 // use them to generate their own output. in AnnotateBinaries()
371 text_generator.Generate(filename, schema_filename); in AnnotateBinaries()
404 if (arg[0] == '-') { in Compile()
405 if (filenames.size() && arg[1] != '-') in Compile()
407 if (arg == "-o") { in Compile()
411 } else if (arg == "-I") { in Compile()
417 } else if (arg == "--bfbs-filenames") { in Compile()
422 } else if (arg == "--conform") { in Compile()
425 } else if (arg == "--conform-includes") { in Compile()
431 } else if (arg == "--include-prefix") { in Compile()
435 } else if (arg == "--keep-prefix") { in Compile()
437 } else if (arg == "--strict-json") { in Compile()
439 } else if (arg == "--allow-non-utf8") { in Compile()
441 } else if (arg == "--natural-utf8") { in Compile()
443 } else if (arg == "--go-namespace") { in Compile()
446 } else if (arg == "--go-import") { in Compile()
449 } else if (arg == "--defaults-json") { in Compile()
451 } else if (arg == "--unknown-json") { in Compile()
453 } else if (arg == "--no-prefix") { in Compile()
455 } else if (arg == "--scoped-enums") { in Compile()
458 } else if (arg == "--no-union-value-namespacing") { in Compile()
460 } else if (arg == "--gen-mutable") { in Compile()
462 } else if (arg == "--gen-name-strings") { in Compile()
464 } else if (arg == "--gen-object-api") { in Compile()
466 } else if (arg == "--gen-compare") { in Compile()
468 } else if (arg == "--cpp-include") { in Compile()
471 } else if (arg == "--cpp-ptr-type") { in Compile()
474 } else if (arg == "--cpp-str-type") { in Compile()
477 } else if (arg == "--cpp-str-flex-ctor") { in Compile()
479 } else if (arg == "--no-cpp-direct-copy") { in Compile()
481 } else if (arg == "--cpp-field-case-style") { in Compile()
492 } else if (arg == "--gen-nullable") { in Compile()
494 } else if (arg == "--java-checkerframework") { in Compile()
496 } else if (arg == "--gen-generated") { in Compile()
498 } else if (arg == "--swift-implementation-only") { in Compile()
500 } else if (arg == "--gen-json-emit") { in Compile()
502 } else if (arg == "--object-prefix") { in Compile()
505 } else if (arg == "--object-suffix") { in Compile()
508 } else if (arg == "--gen-all") { in Compile()
511 } else if (arg == "--gen-includes") { in Compile()
513 Warn("warning: --gen-includes is deprecated (it is now default)\n"); in Compile()
514 } else if (arg == "--no-includes") { in Compile()
516 } else if (arg == "--gen-onefile") { in Compile()
519 } else if (arg == "--raw-binary") { in Compile()
521 } else if (arg == "--size-prefixed") { in Compile()
523 } else if (arg == "--") { // Separator between text and binary inputs. in Compile()
525 } else if (arg == "--proto") { in Compile()
527 } else if (arg == "--proto-namespace-suffix") { in Compile()
530 } else if (arg == "--oneof-union") { in Compile()
532 } else if (arg == "--schema") { in Compile()
534 } else if (arg == "-M") { in Compile()
536 } else if (arg == "--version") { in Compile()
539 } else if (arg == "--help" || arg == "-h") { in Compile()
542 } else if (arg == "--grpc") { in Compile()
544 } else if (arg == "--bfbs-comments") { in Compile()
546 } else if (arg == "--bfbs-builtins") { in Compile()
548 } else if (arg == "--bfbs-gen-embed") { in Compile()
550 } else if (arg == "--reflect-types") { in Compile()
552 } else if (arg == "--reflect-names") { in Compile()
554 } else if (arg == "--rust-serialize") { in Compile()
556 } else if (arg == "--rust-module-root-file") { in Compile()
558 } else if (arg == "--require-explicit-ids") { in Compile()
560 } else if (arg == "--root-type") { in Compile()
563 } else if (arg == "--filename-suffix") { in Compile()
566 } else if (arg == "--filename-ext") { in Compile()
569 } else if (arg == "--force-defaults") { in Compile()
571 } else if (arg == "--force-empty") { in Compile()
574 } else if (arg == "--force-empty-vectors") { in Compile()
576 } else if (arg == "--java-primitive-has-method") { in Compile()
578 } else if (arg == "--cs-gen-json-serializer") { in Compile()
580 } else if (arg == "--flexbuffers") { in Compile()
582 } else if (arg == "--gen-jvmstatic") { in Compile()
584 } else if (arg == "--no-warnings") { in Compile()
586 } else if (arg == "--warnings-as-errors") { in Compile()
588 } else if (arg == "--cpp-std") { in Compile()
592 } else if (arg.rfind("--cpp-std=", 0) == 0) { in Compile()
593 opts.cpp_std = arg.substr(std::string("--cpp-std=").size()); in Compile()
594 } else if (arg == "--cpp-static-reflection") { in Compile()
596 } else if (arg == "--cs-global-alias") { in Compile()
598 } else if (arg == "--json-nested-bytes") { in Compile()
600 } else if (arg == "--ts-flat-files") { in Compile()
602 } else if (arg == "--no-leak-private-annotation") { in Compile()
604 } else if (arg == "--annotate") { in Compile()
609 if (arg == "--" + params_.generators[i].option.long_opt || in Compile()
610 arg == "-" + params_.generators[i].option.short_opt) { in Compile()
634 Error("cannot generate code directly from .proto files", true); in Compile()
642 "--cs-gen-json-serializer requires --gen-object-api to be set as " in Compile()
650 Error("unable to load schema: " + conform_to_schema); in Compile()
664 Error("Expected a `.bfbs` or `.fbs` schema, got: " + annotate_schema); in Compile()
672 Error("unable to load schema: " + annotate_schema); in Compile()
687 // If we need to generate the .bfbs file from the provided schema file in Compile()
697 Error("could not parse a value binary schema from: " + annotate_schema); in Compile()
718 static_cast<size_t>(file_it - filenames.begin()) >= binary_files_from; in Compile()
726 parser->builder_.Clear(); in Compile()
727 parser->builder_.PushFlatBuffer( in Compile()
731 // Generally reading binaries that do not correspond to the schema in Compile()
736 if (!parser->file_identifier_.length()) { in Compile()
737 Error("current schema has no file_identifier: cannot test if \"" + in Compile()
739 "\" matches the schema, use --raw-binary to read this file" in Compile()
742 contents.c_str(), parser->file_identifier_.c_str(), in Compile()
746 parser->file_identifier_ + in Compile()
747 "\", use --raw-binary to read this file anyway."); in Compile()
762 // Try to parse the file contents (binary schema/flexbuffer/textual in Compile()
763 // schema) in Compile()
773 parser->flex_root_ = flexbuffers::GetRoot(data, size); in Compile()
775 parser->flex_builder_.Clear(); in Compile()
780 if (!is_schema && !parser->builder_.GetSize()) { in Compile()
782 // didn't just parse a schema with a different extension. in Compile()
783 Error("input file is neither json nor a .fbs (schema) file: " + in Compile()
789 auto err = parser->ConformTo(conform_parser); in Compile()
793 parser->Serialize(); in Compile()
796 parser->file_extension_ = reflection::SchemaExtension(); in Compile()
807 parser->Serialize(); in Compile()
808 bfbs_buffer = parser->builder_.GetBufferPointer(); in Compile()
809 bfbs_length = parser->builder_.GetSize(); in Compile()
820 params_.generators[i].bfbs_generator->Generate(bfbs_buffer, in Compile()
823 Error(std::string("Unable to generate ") + in Compile()
830 !params_.generators[i].generate(*parser.get(), output_path, in Compile()
832 Error(std::string("Unable to generate ") + in Compile()
838 Error(std::string("Cannot generate make rule for ") + in Compile()
852 Error(std::string("Unable to generate GRPC interface for ") + in Compile()
864 if (!parser->SetRootType(opts.root_type.c_str())) in Compile()
866 else if (parser->root_struct_def_->fixed) in Compile()
872 // We do not want to generate code for the definitions in this file in Compile()
874 parser->MarkGenerated(); in Compile()