38 #ifndef GOOGLE_PROTOBUF_COMPILER_COMMAND_LINE_INTERFACE_H__
39 #define GOOGLE_PROTOBUF_COMPILER_COMMAND_LINE_INTERFACE_H__
46 #include <unordered_map>
47 #include <unordered_set>
51 #include <google/protobuf/stubs/common.h>
52 #include <google/protobuf/port_def.inc>
64 class RepeatedPtrField;
111 class PROTOC_EXPORT CommandLineInterface {
115 CommandLineInterface();
116 ~CommandLineInterface();
145 void RegisterGenerator(
const std::string& flag_name,
186 void AllowPlugins(
const std::string& exe_name_prefix);
193 int Run(
int argc,
const char*
const argv[]);
211 class GeneratorContextImpl;
213 typedef std::unordered_map<std::string, std::unique_ptr<GeneratorContextImpl>>
232 bool EnforceProto3OptionalSupport(
234 const std::vector<const FileDescriptor*>& parsed_files)
const;
239 PARSE_ARGUMENT_DONE_AND_CONTINUE,
240 PARSE_ARGUMENT_DONE_AND_EXIT,
245 ParseArgumentStatus ParseArguments(
int argc,
const char*
const argv[]);
250 std::vector<std::string>* arguments);
270 void PrintHelpText();
282 std::vector<const FileDescriptor*>* parsed_files);
285 struct OutputDirective;
286 bool GenerateOutput(
const std::vector<const FileDescriptor*>& parsed_files,
287 const OutputDirective& output_directive,
289 bool GeneratePluginOutput(
290 const std::vector<const FileDescriptor*>& parsed_files,
298 bool WriteDescriptorSet(
299 const std::vector<const FileDescriptor*>& parsed_files);
302 bool GenerateDependencyManifestFile(
303 const std::vector<const FileDescriptor*>& parsed_files,
304 const GeneratorContextMap& output_directories,
316 static void GetTransitiveDependencies(
318 bool include_source_code_info,
319 std::set<const FileDescriptor*>* already_seen,
347 struct GeneratorInfo {
360 std::map<std::string, std::string> generator_parameters_;
362 std::map<std::string, std::string> plugin_parameters_;
370 std::map<std::string, std::string> plugins_;
380 Mode mode_ = MODE_COMPILE;
387 PrintMode print_mode_ = PRINT_NONE;
394 ErrorFormat error_format_ = ERROR_FORMAT_GCC;
397 bool fatal_warnings_ =
false;
399 std::vector<std::pair<std::string, std::string> >
401 std::vector<std::string> input_files_;
405 std::set<std::string> direct_dependencies_;
406 bool direct_dependencies_explicitly_set_ =
false;
420 std::vector<OutputDirective> output_directives_;
428 std::vector<std::string> descriptor_set_in_names_;
441 bool imports_in_descriptor_set_;
445 bool source_info_in_descriptor_set_ =
false;
448 bool disallow_services_ =
false;
451 bool deterministic_output_ =
false;
460 #include <google/protobuf/port_undef.inc>
462 #endif // GOOGLE_PROTOBUF_COMPILER_COMMAND_LINE_INTERFACE_H__