Beispiel #1
0
def main():
    request = plugin.ReadRequestFromStdin()
    response = plugin_protos.PluginResponse()

    output_dir = request.GetArgs().get('output_dir', '')

    # TODO(cjhopman): This should only be generating files for files listed in
    # request.file_to_generate. Since we don't actually support dependencies,
    # only files in file_to_generate should be here, anyway.
    for proto_file in request.GetAllFiles():
        plugin.RegisterProtoFile(proto_file)

        writer = CppConverterWriter()
        writer.WriteProtoFile(proto_file, output_dir)

        converter_filename = proto_file.CppConverterFilename()
        if output_dir:
            converter_filename = os.path.join(
                output_dir,
                os.path.split(converter_filename)[1])

        response.AddFileWithContent(converter_filename, writer.GetValue())
        if writer.GetErrors():
            response.AddError('\n'.join(writer.GetErrors()))

    response.WriteToStdout()
def main():
  request = plugin.ReadRequestFromStdin()
  response = plugin_protos.PluginResponse()

  # TODO(cjhopman): This should only be generating files for files listed in
  # request.file_to_generate. Since we don't actually support dependencies,
  # only files in file_to_generate should be here, anyway.
  for proto_file in request.GetAllFiles():
    plugin.RegisterProtoFile(proto_file)

    writer = GwtOverlayWriter()
    writer.WriteFile(proto_file)
    response.AddFileWithContent(proto_file.JavaFilename(), writer.GetValue())

    if writer.GetErrors():
      response.AddError('\n'.join(writer.GetErrors()))

  response.WriteToStdout()