Skip to content

Commit

Permalink
deps,tools: add missing grpc compiler folder
Browse files Browse the repository at this point in the history
  • Loading branch information
santigimeno committed Nov 21, 2024
1 parent 04a1aa0 commit b155f2c
Show file tree
Hide file tree
Showing 42 changed files with 8,838 additions and 1 deletion.
129 changes: 129 additions & 0 deletions deps/grpc/src/compiler/BUILD
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"],
)
4 changes: 4 additions & 0 deletions deps/grpc/src/compiler/README.md
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.
68 changes: 68 additions & 0 deletions deps/grpc/src/compiler/config.h
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
64 changes: 64 additions & 0 deletions deps/grpc/src/compiler/config_protobuf.h
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
Loading

0 comments on commit b155f2c

Please sign in to comment.