Skip to content

Commit

Permalink
PHP Proto3: run generate_projects.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
stanley-cheung committed Sep 30, 2016
1 parent b7223bb commit 857a130
Show file tree
Hide file tree
Showing 12 changed files with 314 additions and 76 deletions.
15 changes: 15 additions & 0 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
],
Expand Down Expand Up @@ -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 = [
Expand Down
29 changes: 29 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down Expand Up @@ -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
)
Expand Down
37 changes: 36 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 \

Expand Down Expand Up @@ -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 \

Expand Down
30 changes: 0 additions & 30 deletions tools/dockerfile/interoptest/grpc_interop_php/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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"]

30 changes: 0 additions & 30 deletions tools/dockerfile/interoptest/grpc_interop_php7/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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++
Expand All @@ -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"]

15 changes: 0 additions & 15 deletions tools/dockerfile/stress_test/grpc_interop_stress_php/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
19 changes: 19 additions & 0 deletions tools/run_tests/sources_and_headers.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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",
Expand All @@ -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",
Expand Down
16 changes: 16 additions & 0 deletions vsprojects/grpc_protoc_plugins.sln
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down
Loading

0 comments on commit 857a130

Please sign in to comment.