|  | @@ -59,8 +59,8 @@ class GeneratorContextImpl : public ::google::protobuf::compiler::GeneratorConte
 | 
	
		
			
				|  |  |  public:
 | 
	
		
			
				|  |  |    GeneratorContextImpl(const std::vector<const ::google::protobuf::FileDescriptor*>& parsed_files,
 | 
	
		
			
				|  |  |                         std::map<std::string, std::string>* files_out) :
 | 
	
		
			
				|  |  | -    parsed_files_(parsed_files),
 | 
	
		
			
				|  |  | -    files_(files_out){}
 | 
	
		
			
				|  |  | +    files_(files_out),
 | 
	
		
			
				|  |  | +    parsed_files_(parsed_files) {}
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |    ::google::protobuf::io::ZeroCopyOutputStream* Open(const std::string& filename) {
 | 
	
		
			
				|  |  |      // TODO(rbellevi): Learn not to dream impossible dreams. :(
 | 
	
	
		
			
				|  | @@ -114,7 +114,7 @@ private:
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  } // end namespace detail
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -int protoc_in_memory(char* protobuf_path,
 | 
	
		
			
				|  |  | +int protoc_get_protos(char* protobuf_path,
 | 
	
		
			
				|  |  |                       char* include_path,
 | 
	
		
			
				|  |  |                       std::map<std::string, std::string>* files_out,
 | 
	
		
			
				|  |  |                       std::vector<ProtocError>* errors,
 | 
	
	
		
			
				|  | @@ -140,3 +140,30 @@ int protoc_in_memory(char* protobuf_path,
 | 
	
		
			
				|  |  |    // TODO: Come up with a better error reporting mechanism than this.
 | 
	
		
			
				|  |  |    return 0;
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +int protoc_get_services(char* protobuf_path,
 | 
	
		
			
				|  |  | +                     char* include_path,
 | 
	
		
			
				|  |  | +                     std::map<std::string, std::string>* files_out,
 | 
	
		
			
				|  |  | +                     std::vector<ProtocError>* errors,
 | 
	
		
			
				|  |  | +                     std::vector<ProtocWarning>* warnings)
 | 
	
		
			
				|  |  | +{
 | 
	
		
			
				|  |  | +  // TODO: Create parsed_files.
 | 
	
		
			
				|  |  | +  std::string protobuf_filename(protobuf_path);
 | 
	
		
			
				|  |  | +  std::unique_ptr<detail::ErrorCollectorImpl> error_collector(new detail::ErrorCollectorImpl(errors, warnings));
 | 
	
		
			
				|  |  | +  std::unique_ptr<::google::protobuf::compiler::DiskSourceTree> source_tree(new ::google::protobuf::compiler::DiskSourceTree());
 | 
	
		
			
				|  |  | +  // NOTE: This is equivalent to "--proto_path=."
 | 
	
		
			
				|  |  | +  source_tree->MapPath("", ".");
 | 
	
		
			
				|  |  | +  // TODO: Figure out more advanced virtual path mapping.
 | 
	
		
			
				|  |  | +  ::google::protobuf::compiler::Importer importer(source_tree.get(), error_collector.get());
 | 
	
		
			
				|  |  | +  const ::google::protobuf::FileDescriptor* parsed_file = importer.Import(protobuf_filename);
 | 
	
		
			
				|  |  | +  if (parsed_file == nullptr) {
 | 
	
		
			
				|  |  | +    return 1;
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  | +  detail::GeneratorContextImpl generator_context({parsed_file}, files_out);
 | 
	
		
			
				|  |  | +  std::string error;
 | 
	
		
			
				|  |  | +  grpc_python_generator::GeneratorConfiguration grpc_py_config;
 | 
	
		
			
				|  |  | +  grpc_python_generator::PythonGrpcGenerator grpc_py_generator(grpc_py_config);
 | 
	
		
			
				|  |  | +  grpc_py_generator.Generate(parsed_file, "", &generator_context, &error);
 | 
	
		
			
				|  |  | +  // TODO: Come up with a better error reporting mechanism than this.
 | 
	
		
			
				|  |  | +  return 0;
 | 
	
		
			
				|  |  | +}
 |