-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
831810c
commit 41223e4
Showing
43 changed files
with
8,897 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
--- | ||
Language: Cpp | ||
BasedOnStyle: Google | ||
DerivePointerAlignment: false | ||
PointerAlignment: Left | ||
IncludeBlocks: Regroup | ||
IncludeCategories: | ||
# ruby.h is even more first if it's included | ||
- Regex: '^<ruby/ruby.h>' | ||
Priority: -200 | ||
# Some platforms (namely msys) need wchar to be included BEFORE | ||
# anything else, especially strsafe.h. | ||
- Regex: '^<wchar.h>' | ||
Priority: 5 | ||
# use priority 100+ for grpc headers so they sort last | ||
# 'system' headers - include things that have " in the names to make them | ||
# stand out and get fixed | ||
- Regex: '^(<|")grpc' | ||
Priority: 100 | ||
# similary using include/ to get system headers should stand out and get | ||
# fixed | ||
- Regex: '^"include/' | ||
Priority: 100 | ||
# source headers go last | ||
- Regex: '^"(src|test)/' | ||
Priority: 101 | ||
# not-grpc headers follow | ||
# first, non system headers that are included like <> - these are all | ||
# local carveouts, and get sorted below c++ but before non grpc "" files | ||
- Regex: '^<(openssl/|uv\.h|ares\.h|address_sorting/|gmock/|gtest/|zlib|zconf|benchmark/|google/)' | ||
Priority: 30 | ||
# first C system headers - they have a . in the filename | ||
- Regex: '^<.*\.' | ||
Priority: 10 | ||
# then C++ system headers - no ., the only thing that will match now | ||
- Regex: '^<' | ||
Priority: 20 | ||
# finally other "" includes go between system headers and our headers | ||
- Regex: '^"' | ||
Priority: 40 | ||
--- | ||
Language: ObjC | ||
BasedOnStyle: Google | ||
ColumnLimit: 100 | ||
ObjCBlockIndentWidth: 2 | ||
--- | ||
Language: Proto | ||
BasedOnStyle: Google | ||
ColumnLimit: 100 | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
# gRPC Bazel BUILD file. | ||
# | ||
# Copyright 2016 gRPC authors. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
load( | ||
"//bazel:grpc_build_system.bzl", | ||
"grpc_cc_library", | ||
"grpc_proto_plugin", | ||
) | ||
|
||
package( | ||
default_visibility = ["//visibility:public"], | ||
features = [ | ||
"-layering_check", | ||
"-parse_headers", | ||
], | ||
) | ||
|
||
licenses(["notice"]) | ||
|
||
exports_files(["LICENSE"]) | ||
|
||
grpc_cc_library( | ||
name = "proto_parser_helper", | ||
srcs = ["proto_parser_helper.cc"], | ||
hdrs = ["proto_parser_helper.h"], | ||
language = "c++", | ||
) | ||
|
||
grpc_cc_library( | ||
name = "grpc_plugin_support", | ||
srcs = [ | ||
"cpp_generator.cc", | ||
"csharp_generator.cc", | ||
"node_generator.cc", | ||
"objective_c_generator.cc", | ||
"php_generator.cc", | ||
"python_generator.cc", | ||
"ruby_generator.cc", | ||
], | ||
hdrs = [ | ||
"config.h", | ||
"config_protobuf.h", | ||
"cpp_generator.h", | ||
"cpp_generator_helpers.h", | ||
"cpp_plugin.h", | ||
"csharp_generator.h", | ||
"csharp_generator_helpers.h", | ||
"generator_helpers.h", | ||
"node_generator.h", | ||
"node_generator_helpers.h", | ||
"objective_c_generator.h", | ||
"objective_c_generator_helpers.h", | ||
"php_generator.h", | ||
"php_generator_helpers.h", | ||
"protobuf_plugin.h", | ||
"python_generator.h", | ||
"python_generator_helpers.h", | ||
"python_private_generator.h", | ||
"ruby_generator.h", | ||
"ruby_generator_helpers-inl.h", | ||
"ruby_generator_map-inl.h", | ||
"ruby_generator_string-inl.h", | ||
"schema_interface.h", | ||
], | ||
external_deps = [ | ||
"protobuf_clib", | ||
"protobuf", | ||
], | ||
language = "c++", | ||
deps = [ | ||
"proto_parser_helper", | ||
"//:grpc++_config_proto", | ||
], | ||
) | ||
|
||
grpc_proto_plugin( | ||
name = "grpc_cpp_plugin", | ||
srcs = ["cpp_plugin.cc"], | ||
deps = [":grpc_plugin_support"], | ||
) | ||
|
||
grpc_proto_plugin( | ||
name = "grpc_csharp_plugin", | ||
srcs = ["csharp_plugin.cc"], | ||
deps = [":grpc_plugin_support"], | ||
) | ||
|
||
grpc_proto_plugin( | ||
name = "grpc_node_plugin", | ||
srcs = ["node_plugin.cc"], | ||
deps = [":grpc_plugin_support"], | ||
) | ||
|
||
grpc_proto_plugin( | ||
name = "grpc_objective_c_plugin", | ||
srcs = ["objective_c_plugin.cc"], | ||
deps = [":grpc_plugin_support"], | ||
) | ||
|
||
grpc_proto_plugin( | ||
name = "grpc_php_plugin", | ||
srcs = ["php_plugin.cc"], | ||
deps = [":grpc_plugin_support"], | ||
) | ||
|
||
grpc_proto_plugin( | ||
name = "grpc_python_plugin", | ||
srcs = ["python_plugin.cc"], | ||
deps = [":grpc_plugin_support"], | ||
) | ||
|
||
grpc_proto_plugin( | ||
name = "grpc_ruby_plugin", | ||
srcs = ["ruby_plugin.cc"], | ||
deps = [":grpc_plugin_support"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Overview | ||
|
||
This directory contains source code for gRPC protocol buffer compiler (*protoc*) plugins. Along with `protoc`, | ||
these plugins are used to generate gRPC client and server stubs from `.proto` files. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/* | ||
* | ||
* Copyright 2015 gRPC authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
|
||
#ifndef SRC_COMPILER_CONFIG_H | ||
#define SRC_COMPILER_CONFIG_H | ||
|
||
#include <string> | ||
|
||
#include "src/compiler/config_protobuf.h" | ||
|
||
#ifdef GRPC_CUSTOM_STRING | ||
#warning GRPC_CUSTOM_STRING is no longer supported. Please use std::string. | ||
#endif | ||
|
||
namespace grpc { | ||
|
||
// Using grpc::string and grpc::to_string is discouraged in favor of | ||
// std::string and std::to_string. This is only for legacy code using | ||
// them explictly. | ||
using std::string; // deprecated | ||
using std::to_string; // deprecated | ||
|
||
namespace protobuf { | ||
|
||
namespace compiler { | ||
typedef GRPC_CUSTOM_CODEGENERATOR CodeGenerator; | ||
typedef GRPC_CUSTOM_GENERATORCONTEXT GeneratorContext; | ||
static inline int PluginMain(int argc, char* argv[], | ||
const CodeGenerator* generator) { | ||
return GRPC_CUSTOM_PLUGINMAIN(argc, argv, generator); | ||
} | ||
static inline void ParseGeneratorParameter( | ||
const string& parameter, std::vector<std::pair<string, string> >* options) { | ||
GRPC_CUSTOM_PARSEGENERATORPARAMETER(parameter, options); | ||
} | ||
|
||
} // namespace compiler | ||
namespace io { | ||
typedef GRPC_CUSTOM_PRINTER Printer; | ||
typedef GRPC_CUSTOM_CODEDOUTPUTSTREAM CodedOutputStream; | ||
typedef GRPC_CUSTOM_STRINGOUTPUTSTREAM StringOutputStream; | ||
} // namespace io | ||
} // namespace protobuf | ||
} // namespace grpc | ||
|
||
namespace grpc_cpp_generator { | ||
|
||
static const char* const kCppGeneratorMessageHeaderExt = ".pb.h"; | ||
static const char* const kCppGeneratorServiceHeaderExt = ".grpc.pb.h"; | ||
|
||
} // namespace grpc_cpp_generator | ||
|
||
#endif // SRC_COMPILER_CONFIG_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/* | ||
* | ||
* Copyright 2019 gRPC authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
|
||
#ifndef SRC_COMPILER_CONFIG_PROTOBUF_H | ||
#define SRC_COMPILER_CONFIG_PROTOBUF_H | ||
|
||
#include <grpcpp/impl/codegen/config_protobuf.h> | ||
|
||
#ifndef GRPC_CUSTOM_CODEGENERATOR | ||
#include <google/protobuf/compiler/code_generator.h> | ||
#define GRPC_CUSTOM_CODEGENERATOR ::google::protobuf::compiler::CodeGenerator | ||
#define GRPC_CUSTOM_GENERATORCONTEXT \ | ||
::google::protobuf::compiler::GeneratorContext | ||
#endif | ||
|
||
#ifndef GRPC_CUSTOM_PRINTER | ||
#include <google/protobuf/io/coded_stream.h> | ||
#include <google/protobuf/io/printer.h> | ||
#include <google/protobuf/io/zero_copy_stream_impl_lite.h> | ||
#define GRPC_CUSTOM_PRINTER ::google::protobuf::io::Printer | ||
#define GRPC_CUSTOM_CODEDOUTPUTSTREAM ::google::protobuf::io::CodedOutputStream | ||
#define GRPC_CUSTOM_STRINGOUTPUTSTREAM \ | ||
::google::protobuf::io::StringOutputStream | ||
#endif | ||
|
||
#ifndef GRPC_CUSTOM_PLUGINMAIN | ||
#include <google/protobuf/compiler/plugin.h> | ||
#define GRPC_CUSTOM_PLUGINMAIN ::google::protobuf::compiler::PluginMain | ||
#endif | ||
|
||
#ifndef GRPC_CUSTOM_PARSEGENERATORPARAMETER | ||
#include <google/protobuf/compiler/code_generator.h> | ||
#define GRPC_CUSTOM_PARSEGENERATORPARAMETER \ | ||
::google::protobuf::compiler::ParseGeneratorParameter | ||
#endif | ||
|
||
#ifndef GRPC_CUSTOM_CSHARP_GETCLASSNAME | ||
#include <google/protobuf/compiler/csharp/names.h> | ||
#define GRPC_CUSTOM_CSHARP_GETCLASSNAME \ | ||
::google::protobuf::compiler::csharp::GetClassName | ||
#define GRPC_CUSTOM_CSHARP_GETFILENAMESPACE \ | ||
::google::protobuf::compiler::csharp::GetFileNamespace | ||
#define GRPC_CUSTOM_CSHARP_GETOUTPUTFILE \ | ||
::google::protobuf::compiler::csharp::GetOutputFile | ||
#define GRPC_CUSTOM_CSHARP_GETREFLECTIONCLASSNAME \ | ||
::google::protobuf::compiler::csharp::GetReflectionClassName | ||
#endif | ||
|
||
#endif // SRC_COMPILER_CONFIG_PROTOBUF_H |
Oops, something went wrong.