diff --git a/BUILD b/BUILD
index 4763bc0abd7..bad6f3f0755 100644
--- a/BUILD
+++ b/BUILD
@@ -1652,6 +1652,8 @@ cc_library(
"src/compiler/node_generator_helpers.h",
"src/compiler/objective_c_generator.h",
"src/compiler/objective_c_generator_helpers.h",
+ "src/compiler/php_generator.h",
+ "src/compiler/php_generator_helpers.h",
"src/compiler/python_generator.h",
"src/compiler/ruby_generator.h",
"src/compiler/ruby_generator_helpers-inl.h",
@@ -1661,6 +1663,7 @@ cc_library(
"src/compiler/csharp_generator.cc",
"src/compiler/node_generator.cc",
"src/compiler/objective_c_generator.cc",
+ "src/compiler/php_generator.cc",
"src/compiler/python_generator.cc",
"src/compiler/ruby_generator.cc",
],
@@ -2259,6 +2262,18 @@ cc_binary(
)
+cc_binary(
+ name = "grpc_php_plugin",
+ srcs = [
+ "src/compiler/php_plugin.cc",
+ ],
+ deps = [
+ "//external:protobuf_compiler",
+ ":grpc_plugin_support",
+ ],
+)
+
+
cc_binary(
name = "grpc_python_plugin",
srcs = [
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 97cedbe449b..c4191521bd1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1430,6 +1430,7 @@ add_library(grpc_plugin_support
src/compiler/csharp_generator.cc
src/compiler/node_generator.cc
src/compiler/objective_c_generator.cc
+ src/compiler/php_generator.cc
src/compiler/python_generator.cc
src/compiler/ruby_generator.cc
)
@@ -1770,6 +1771,34 @@ if (gRPC_INSTALL)
endif()
+add_executable(grpc_php_plugin
+ src/compiler/php_plugin.cc
+)
+
+target_include_directories(grpc_php_plugin
+ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
+ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include
+ PRIVATE ${BORINGSSL_ROOT_DIR}/include
+ PRIVATE ${PROTOBUF_ROOT_DIR}/src
+ PRIVATE ${ZLIB_ROOT_DIR}
+ PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/zlib
+)
+
+target_link_libraries(grpc_php_plugin
+ ${_gRPC_PROTOBUF_PROTOC_LIBRARIES}
+ grpc_plugin_support
+)
+
+
+if (gRPC_INSTALL)
+ install(TARGETS grpc_php_plugin EXPORT gRPCTargets
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ )
+endif()
+
+
add_executable(grpc_python_plugin
src/compiler/python_plugin.cc
)
diff --git a/Makefile b/Makefile
index b98380be48b..1ec417f5893 100644
--- a/Makefile
+++ b/Makefile
@@ -732,7 +732,7 @@ PC_LIBS_GRPCXX =
CPPFLAGS := -Ithird_party/googletest/include $(CPPFLAGS)
-PROTOC_PLUGINS_ALL = $(BINDIR)/$(CONFIG)/grpc_cpp_plugin $(BINDIR)/$(CONFIG)/grpc_csharp_plugin $(BINDIR)/$(CONFIG)/grpc_node_plugin $(BINDIR)/$(CONFIG)/grpc_objective_c_plugin $(BINDIR)/$(CONFIG)/grpc_python_plugin $(BINDIR)/$(CONFIG)/grpc_ruby_plugin
+PROTOC_PLUGINS_ALL = $(BINDIR)/$(CONFIG)/grpc_cpp_plugin $(BINDIR)/$(CONFIG)/grpc_csharp_plugin $(BINDIR)/$(CONFIG)/grpc_node_plugin $(BINDIR)/$(CONFIG)/grpc_objective_c_plugin $(BINDIR)/$(CONFIG)/grpc_php_plugin $(BINDIR)/$(CONFIG)/grpc_python_plugin $(BINDIR)/$(CONFIG)/grpc_ruby_plugin
PROTOC_PLUGINS_DIR = $(BINDIR)/$(CONFIG)
ifeq ($(HAS_SYSTEM_PROTOBUF),true)
@@ -1047,6 +1047,7 @@ grpc_cpp_plugin: $(BINDIR)/$(CONFIG)/grpc_cpp_plugin
grpc_csharp_plugin: $(BINDIR)/$(CONFIG)/grpc_csharp_plugin
grpc_node_plugin: $(BINDIR)/$(CONFIG)/grpc_node_plugin
grpc_objective_c_plugin: $(BINDIR)/$(CONFIG)/grpc_objective_c_plugin
+grpc_php_plugin: $(BINDIR)/$(CONFIG)/grpc_php_plugin
grpc_python_plugin: $(BINDIR)/$(CONFIG)/grpc_python_plugin
grpc_ruby_plugin: $(BINDIR)/$(CONFIG)/grpc_ruby_plugin
grpc_tool_test: $(BINDIR)/$(CONFIG)/grpc_tool_test
@@ -2343,6 +2344,8 @@ else
$(Q) $(INSTALL) -d $(prefix)/bin
$(Q) $(INSTALL) $(BINDIR)/$(CONFIG)/grpc_objective_c_plugin $(prefix)/bin/grpc_objective_c_plugin
$(Q) $(INSTALL) -d $(prefix)/bin
+ $(Q) $(INSTALL) $(BINDIR)/$(CONFIG)/grpc_php_plugin $(prefix)/bin/grpc_php_plugin
+ $(Q) $(INSTALL) -d $(prefix)/bin
$(Q) $(INSTALL) $(BINDIR)/$(CONFIG)/grpc_python_plugin $(prefix)/bin/grpc_python_plugin
$(Q) $(INSTALL) -d $(prefix)/bin
$(Q) $(INSTALL) $(BINDIR)/$(CONFIG)/grpc_ruby_plugin $(prefix)/bin/grpc_ruby_plugin
@@ -4341,6 +4344,7 @@ LIBGRPC_PLUGIN_SUPPORT_SRC = \
src/compiler/csharp_generator.cc \
src/compiler/node_generator.cc \
src/compiler/objective_c_generator.cc \
+ src/compiler/php_generator.cc \
src/compiler/python_generator.cc \
src/compiler/ruby_generator.cc \
@@ -11696,6 +11700,37 @@ ifneq ($(NO_DEPS),true)
endif
+GRPC_PHP_PLUGIN_SRC = \
+ src/compiler/php_plugin.cc \
+
+GRPC_PHP_PLUGIN_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(GRPC_PHP_PLUGIN_SRC))))
+
+
+
+ifeq ($(NO_PROTOBUF),true)
+
+# You can't build the protoc plugins or protobuf-enabled targets if you don't have protobuf 3.0.0+.
+
+$(BINDIR)/$(CONFIG)/grpc_php_plugin: protobuf_dep_error
+
+else
+
+$(BINDIR)/$(CONFIG)/grpc_php_plugin: $(PROTOBUF_DEP) $(GRPC_PHP_PLUGIN_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_plugin_support.a
+ $(E) "[HOSTLD] Linking $@"
+ $(Q) mkdir -p `dirname $@`
+ $(Q) $(HOST_LDXX) $(HOST_LDFLAGS) $(GRPC_PHP_PLUGIN_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_plugin_support.a $(HOST_LDLIBSXX) $(HOST_LDLIBS_PROTOC) $(HOST_LDLIBS) $(HOST_LDLIBS_PROTOC) -o $(BINDIR)/$(CONFIG)/grpc_php_plugin
+
+endif
+
+$(OBJDIR)/$(CONFIG)/src/compiler/php_plugin.o: $(LIBDIR)/$(CONFIG)/libgrpc_plugin_support.a
+
+deps_grpc_php_plugin: $(GRPC_PHP_PLUGIN_OBJS:.o=.dep)
+
+ifneq ($(NO_DEPS),true)
+-include $(GRPC_PHP_PLUGIN_OBJS:.o=.dep)
+endif
+
+
GRPC_PYTHON_PLUGIN_SRC = \
src/compiler/python_plugin.cc \
diff --git a/tools/dockerfile/interoptest/grpc_interop_php/Dockerfile b/tools/dockerfile/interoptest/grpc_interop_php/Dockerfile
index 0d6171c1705..d0e1a965530 100644
--- a/tools/dockerfile/interoptest/grpc_interop_php/Dockerfile
+++ b/tools/dockerfile/interoptest/grpc_interop_php/Dockerfile
@@ -63,21 +63,6 @@ RUN apt-get update && apt-get install -y \
# Build profiling
RUN apt-get update && apt-get install -y time && apt-get clean
-#==================
-# Ruby dependencies
-
-# Install rvm
-RUN gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
-RUN \curl -sSL https://get.rvm.io | bash -s stable
-
-# Install Ruby 2.1
-RUN /bin/bash -l -c "rvm install ruby-2.1"
-RUN /bin/bash -l -c "rvm use --default ruby-2.1"
-RUN /bin/bash -l -c "echo 'gem: --no-ri --no-rdoc' > ~/.gemrc"
-RUN /bin/bash -l -c "echo 'export PATH=/usr/local/rvm/bin:$PATH' >> ~/.bashrc"
-RUN /bin/bash -l -c "echo 'rvm --default use ruby-2.1' >> ~/.bashrc"
-RUN /bin/bash -l -c "gem install bundler --no-ri --no-rdoc"
-
#=================
# PHP dependencies
@@ -97,25 +82,10 @@ RUN ln -s /usr/bin/ccache /usr/local/bin/clang++
RUN mkdir /var/local/jenkins
-# ronn: a ruby tool used to convert markdown to man pages, used during the
-# install of Protobuf extensions
-#
-# rake: a ruby version of make used to build the PHP Protobuf extension
-RUN /bin/bash -l -c "rvm all do gem install ronn rake"
-
# Install composer
RUN curl -sS https://getcomposer.org/installer | php
RUN mv composer.phar /usr/local/bin/composer
-# Download the patched PHP protobuf so that PHP gRPC clients can be generated
-# from proto3 schemas.
-RUN git clone https://github.com/stanley-cheung/Protobuf-PHP.git /var/local/git/protobuf-php
-
-RUN /bin/bash -l -c "rvm use ruby-2.1 \
- && cd /var/local/git/protobuf-php \
- && rvm all do rake pear:package version=1.0 \
- && pear install Protobuf-1.0.tgz"
-
# Define the default command.
CMD ["bash"]
diff --git a/tools/dockerfile/interoptest/grpc_interop_php7/Dockerfile b/tools/dockerfile/interoptest/grpc_interop_php7/Dockerfile
index be8f25f8ffa..d8cbe7093c6 100644
--- a/tools/dockerfile/interoptest/grpc_interop_php7/Dockerfile
+++ b/tools/dockerfile/interoptest/grpc_interop_php7/Dockerfile
@@ -75,21 +75,6 @@ RUN cd /var/local/git/php-src \
&& make \
&& make install
-#==================
-# Ruby dependencies
-
-# Install rvm
-RUN gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
-RUN \curl -sSL https://get.rvm.io | bash -s stable
-
-# Install Ruby 2.1
-RUN /bin/bash -l -c "rvm install ruby-2.1"
-RUN /bin/bash -l -c "rvm use --default ruby-2.1"
-RUN /bin/bash -l -c "echo 'gem: --no-ri --no-rdoc' > ~/.gemrc"
-RUN /bin/bash -l -c "echo 'export PATH=/usr/local/rvm/bin:$PATH' >> ~/.bashrc"
-RUN /bin/bash -l -c "echo 'rvm --default use ruby-2.1' >> ~/.bashrc"
-RUN /bin/bash -l -c "gem install bundler --no-ri --no-rdoc"
-
# Prepare ccache
RUN ln -s /usr/bin/ccache /usr/local/bin/gcc
RUN ln -s /usr/bin/ccache /usr/local/bin/g++
@@ -101,25 +86,10 @@ RUN ln -s /usr/bin/ccache /usr/local/bin/clang++
RUN mkdir /var/local/jenkins
-# ronn: a ruby tool used to convert markdown to man pages, used during the
-# install of Protobuf extensions
-#
-# rake: a ruby version of make used to build the PHP Protobuf extension
-RUN /bin/bash -l -c "rvm all do gem install ronn rake"
-
# Install composer
RUN curl -sS https://getcomposer.org/installer | php
RUN mv composer.phar /usr/local/bin/composer
-# Download the patched PHP protobuf so that PHP gRPC clients can be generated
-# from proto3 schemas.
-RUN git clone https://github.com/stanley-cheung/Protobuf-PHP.git /var/local/git/protobuf-php
-
-RUN /bin/bash -l -c "rvm use ruby-2.1 \
- && cd /var/local/git/protobuf-php \
- && rvm all do rake pear:package version=1.0 \
- && pear install Protobuf-1.0.tgz"
-
# Define the default command.
CMD ["bash"]
diff --git a/tools/dockerfile/stress_test/grpc_interop_stress_php/Dockerfile b/tools/dockerfile/stress_test/grpc_interop_stress_php/Dockerfile
index 0716be5a9dd..0fe9c151e53 100644
--- a/tools/dockerfile/stress_test/grpc_interop_stress_php/Dockerfile
+++ b/tools/dockerfile/stress_test/grpc_interop_stress_php/Dockerfile
@@ -117,24 +117,9 @@ RUN ln -s /usr/bin/ccache /usr/local/bin/clang++
RUN mkdir /var/local/jenkins
-# ronn: a ruby tool used to convert markdown to man pages, used during the
-# install of Protobuf extensions
-#
-# rake: a ruby version of make used to build the PHP Protobuf extension
-RUN /bin/bash -l -c "rvm all do gem install ronn rake"
-
# Install composer
RUN curl -sS https://getcomposer.org/installer | php
RUN mv composer.phar /usr/local/bin/composer
-# Download the patched PHP protobuf so that PHP gRPC clients can be generated
-# from proto3 schemas.
-RUN git clone https://github.com/stanley-cheung/Protobuf-PHP.git /var/local/git/protobuf-php
-
-RUN /bin/bash -l -c "rvm use ruby-2.1 \
- && cd /var/local/git/protobuf-php \
- && rvm all do rake pear:package version=1.0 \
- && pear install Protobuf-1.0.tgz"
-
# Define the default command.
CMD ["bash"]
diff --git a/tools/run_tests/sources_and_headers.json b/tools/run_tests/sources_and_headers.json
index 03bdcd42645..9b378442afa 100644
--- a/tools/run_tests/sources_and_headers.json
+++ b/tools/run_tests/sources_and_headers.json
@@ -2482,6 +2482,20 @@
"third_party": false,
"type": "target"
},
+ {
+ "deps": [
+ "grpc_plugin_support"
+ ],
+ "headers": [],
+ "is_filegroup": false,
+ "language": "c++",
+ "name": "grpc_php_plugin",
+ "src": [
+ "src/compiler/php_plugin.cc"
+ ],
+ "third_party": false,
+ "type": "target"
+ },
{
"deps": [
"grpc_plugin_support"
@@ -5027,6 +5041,8 @@
"src/compiler/node_generator_helpers.h",
"src/compiler/objective_c_generator.h",
"src/compiler/objective_c_generator_helpers.h",
+ "src/compiler/php_generator.h",
+ "src/compiler/php_generator_helpers.h",
"src/compiler/python_generator.h",
"src/compiler/ruby_generator.h",
"src/compiler/ruby_generator_helpers-inl.h",
@@ -5051,6 +5067,9 @@
"src/compiler/objective_c_generator.cc",
"src/compiler/objective_c_generator.h",
"src/compiler/objective_c_generator_helpers.h",
+ "src/compiler/php_generator.cc",
+ "src/compiler/php_generator.h",
+ "src/compiler/php_generator_helpers.h",
"src/compiler/python_generator.cc",
"src/compiler/python_generator.h",
"src/compiler/ruby_generator.cc",
diff --git a/vsprojects/grpc_protoc_plugins.sln b/vsprojects/grpc_protoc_plugins.sln
index 2e55720f28c..c1d0ea2eb1e 100644
--- a/vsprojects/grpc_protoc_plugins.sln
+++ b/vsprojects/grpc_protoc_plugins.sln
@@ -35,6 +35,14 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "grpc_objective_c_plugin", "
{B6E81D84-2ACB-41B8-8781-493A944C7817} = {B6E81D84-2ACB-41B8-8781-493A944C7817}
EndProjectSection
EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "grpc_php_plugin", "vcxproj\.\grpc_php_plugin\grpc_php_plugin.vcxproj", "{2C5F74B5-2F1E-A7A7-45EA-250AF73A1CEC}"
+ ProjectSection(myProperties) = preProject
+ lib = "False"
+ EndProjectSection
+ ProjectSection(ProjectDependencies) = postProject
+ {B6E81D84-2ACB-41B8-8781-493A944C7817} = {B6E81D84-2ACB-41B8-8781-493A944C7817}
+ EndProjectSection
+EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "grpc_plugin_support", "vcxproj\.\grpc_plugin_support\grpc_plugin_support.vcxproj", "{B6E81D84-2ACB-41B8-8781-493A944C7817}"
ProjectSection(myProperties) = preProject
lib = "True"
@@ -96,6 +104,14 @@ Global
{19564640-CEE6-4921-ABA5-676ED79A36F6}.Debug|x64.Build.0 = Debug|x64
{19564640-CEE6-4921-ABA5-676ED79A36F6}.Release|Win32.Build.0 = Release|Win32
{19564640-CEE6-4921-ABA5-676ED79A36F6}.Release|x64.Build.0 = Release|x64
+ {2C5F74B5-2F1E-A7A7-45EA-250AF73A1CEC}.Debug|Win32.ActiveCfg = Debug|Win32
+ {2C5F74B5-2F1E-A7A7-45EA-250AF73A1CEC}.Debug|x64.ActiveCfg = Debug|x64
+ {2C5F74B5-2F1E-A7A7-45EA-250AF73A1CEC}.Release|Win32.ActiveCfg = Release|Win32
+ {2C5F74B5-2F1E-A7A7-45EA-250AF73A1CEC}.Release|x64.ActiveCfg = Release|x64
+ {2C5F74B5-2F1E-A7A7-45EA-250AF73A1CEC}.Debug|Win32.Build.0 = Debug|Win32
+ {2C5F74B5-2F1E-A7A7-45EA-250AF73A1CEC}.Debug|x64.Build.0 = Debug|x64
+ {2C5F74B5-2F1E-A7A7-45EA-250AF73A1CEC}.Release|Win32.Build.0 = Release|Win32
+ {2C5F74B5-2F1E-A7A7-45EA-250AF73A1CEC}.Release|x64.Build.0 = Release|x64
{B6E81D84-2ACB-41B8-8781-493A944C7817}.Debug|Win32.ActiveCfg = Debug|Win32
{B6E81D84-2ACB-41B8-8781-493A944C7817}.Debug|x64.ActiveCfg = Debug|x64
{B6E81D84-2ACB-41B8-8781-493A944C7817}.Release|Win32.ActiveCfg = Release|Win32
diff --git a/vsprojects/vcxproj/grpc_php_plugin/grpc_php_plugin.vcxproj b/vsprojects/vcxproj/grpc_php_plugin/grpc_php_plugin.vcxproj
new file mode 100644
index 00000000000..1648ba9010f
--- /dev/null
+++ b/vsprojects/vcxproj/grpc_php_plugin/grpc_php_plugin.vcxproj
@@ -0,0 +1,168 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ Win32
+
+
+ Release
+ x64
+
+
+
+ {2C5F74B5-2F1E-A7A7-45EA-250AF73A1CEC}
+ true
+ $(SolutionDir)IntDir\$(MSBuildProjectName)\
+
+
+
+ v100
+
+
+ v110
+
+
+ v120
+
+
+ v140
+
+
+ Application
+ true
+ Unicode
+
+
+ Application
+ false
+ true
+ Unicode
+
+
+
+
+
+
+
+
+
+
+
+
+ grpc_php_plugin
+
+
+ grpc_php_plugin
+
+
+
+ NotUsing
+ Level3
+ Disabled
+ WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)
+ true
+ MultiThreadedDebug
+ true
+ None
+ false
+
+
+ Console
+ true
+ false
+
+
+
+
+
+ NotUsing
+ Level3
+ Disabled
+ WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)
+ true
+ MultiThreadedDebug
+ true
+ None
+ false
+
+
+ Console
+ true
+ false
+
+
+
+
+
+ NotUsing
+ Level3
+ MaxSpeed
+ WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)
+ true
+ true
+ true
+ MultiThreaded
+ true
+ None
+ false
+
+
+ Console
+ true
+ false
+ true
+ true
+
+
+
+
+
+ NotUsing
+ Level3
+ MaxSpeed
+ WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)
+ true
+ true
+ true
+ MultiThreaded
+ true
+ None
+ false
+
+
+ Console
+ true
+ false
+ true
+ true
+
+
+
+
+
+
+
+
+
+ {B6E81D84-2ACB-41B8-8781-493A944C7817}
+
+
+
+
+
+
+
+ This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
+
+
+
+
diff --git a/vsprojects/vcxproj/grpc_php_plugin/grpc_php_plugin.vcxproj.filters b/vsprojects/vcxproj/grpc_php_plugin/grpc_php_plugin.vcxproj.filters
new file mode 100644
index 00000000000..e131753f8d6
--- /dev/null
+++ b/vsprojects/vcxproj/grpc_php_plugin/grpc_php_plugin.vcxproj.filters
@@ -0,0 +1,18 @@
+
+
+
+
+ src\compiler
+
+
+
+
+
+ {d7fb4039-77f4-10f2-59fe-bb98fb56950a}
+
+
+ {5560fb58-2ae8-75cc-fbca-e630a50c15bf}
+
+
+
+
diff --git a/vsprojects/vcxproj/grpc_plugin_support/grpc_plugin_support.vcxproj b/vsprojects/vcxproj/grpc_plugin_support/grpc_plugin_support.vcxproj
index 9828b8bcaf0..05165d6fb80 100644
--- a/vsprojects/vcxproj/grpc_plugin_support/grpc_plugin_support.vcxproj
+++ b/vsprojects/vcxproj/grpc_plugin_support/grpc_plugin_support.vcxproj
@@ -161,6 +161,8 @@
+
+
@@ -176,6 +178,8 @@
+
+
diff --git a/vsprojects/vcxproj/grpc_plugin_support/grpc_plugin_support.vcxproj.filters b/vsprojects/vcxproj/grpc_plugin_support/grpc_plugin_support.vcxproj.filters
index 27eb935e074..c8b893221d3 100644
--- a/vsprojects/vcxproj/grpc_plugin_support/grpc_plugin_support.vcxproj.filters
+++ b/vsprojects/vcxproj/grpc_plugin_support/grpc_plugin_support.vcxproj.filters
@@ -13,6 +13,9 @@
src\compiler
+
+ src\compiler
+
src\compiler
@@ -56,6 +59,12 @@
src\compiler
+
+ src\compiler
+
+
+ src\compiler
+
src\compiler