aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--composer.json2
-rw-r--r--src/php/.gitignore3
-rw-r--r--src/php/README.md86
-rwxr-xr-xsrc/php/bin/determine_extension_dir.sh2
-rwxr-xr-xsrc/php/bin/generate_proto_php.sh31
-rwxr-xr-xsrc/php/bin/interop_client.sh3
-rw-r--r--src/php/composer.json2
-rw-r--r--src/php/tests/generated_code/AbstractGeneratedCodeTest.php5
-rw-r--r--src/php/tests/generated_code/math.proto83
-rw-r--r--src/php/tests/interop/empty.proto43
-rwxr-xr-xsrc/php/tests/interop/interop_client.php13
-rw-r--r--src/php/tests/interop/messages.proto162
-rw-r--r--src/php/tests/interop/test.proto78
-rw-r--r--templates/composer.json.template2
-rw-r--r--templates/src/php/composer.json.template2
-rwxr-xr-xtools/dockerfile/interoptest/grpc_interop_php/build_interop.sh3
-rwxr-xr-xtools/dockerfile/interoptest/grpc_interop_php7/build_interop.sh3
-rwxr-xr-xtools/dockerfile/stress_test/grpc_interop_stress_php/build_interop_stress.sh3
18 files changed, 106 insertions, 420 deletions
diff --git a/composer.json b/composer.json
index 78366208ed..c5c7ae81d8 100644
--- a/composer.json
+++ b/composer.json
@@ -7,7 +7,7 @@
"license": "BSD-3-Clause",
"require": {
"php": ">=5.5.0",
- "stanley-cheung/protobuf-php": "v0.6"
+ "google/protobuf": "v3.1.0-alpha-1"
},
"require-dev": {
"google/auth": "v0.9"
diff --git a/src/php/.gitignore b/src/php/.gitignore
index ecde2ca4c6..f124cbcbf4 100644
--- a/src/php/.gitignore
+++ b/src/php/.gitignore
@@ -20,3 +20,6 @@ mkinstalldirs
ext/grpc/ltmain.sh
composer.lock
vendor/
+
+*.pb.php
+*_grpc_pb.php
diff --git a/src/php/README.md b/src/php/README.md
index 7e9819b256..1a0284ec18 100644
--- a/src/php/README.md
+++ b/src/php/README.md
@@ -1,7 +1,8 @@
#Overview
-This directory contains source code for PHP implementation of gRPC layered on shared C library.
+This directory contains source code for PHP implementation of gRPC layered on
+shared C library.
#Status
@@ -9,17 +10,29 @@ GA
## Environment
-Prerequisite:
+**Prerequisite:**
* `php` 5.5 or above, 7.0 or above
-* `pear` and `pecl`
-* `phpunit`
+* `pecl`
+* `composer`
+* `phpunit` (optional)
-**PEAR:**
+**Ubuntu/Debian:**
+```sh
+$ sudo apt-get install php5 php5-dev
+```
+
+**PEAR/PECL:**
```sh
$ curl -O http://pear.php.net/go-pear.phar
$ sudo php -d detect_unicode=0 go-pear.phar
```
+**Composer:**
+```sh
+$ curl -sS https://getcomposer.org/installer | php
+$ sudo mv composer.phar /usr/local/bin/composer
+```
+
**PHPUnit:**
```sh
$ wget https://phar.phpunit.de/phpunit-old.phar
@@ -29,15 +42,32 @@ $ sudo mv phpunit-old.phar /usr/bin/phpunit
## Quick Install
-Install the gRPC PHP extension
+**Install the gRPC PHP extension**
```sh
sudo pecl install grpc
```
-This will compile and install the gRPC PHP extension into the standard PHP extension directory. You should be able to run the [unit tests](#unit-tests), with the PHP extension installed.
+This will compile and install the gRPC PHP extension into the standard PHP
+extension directory. You should be able to run the [unit tests](#unit-tests),
+with the PHP extension installed.
+
+
+**Add the gRPC PHP library as a Composer dependency**
+
+You need to add this to your project's `composer.json` file.
+
+```
+ "require": {
+ "grpc/grpc": "v1.0.0"
+ }
+```
+
+To run tests with generated stub code from `.proto` files, you will also need
+the `composer` and `protoc` binaries. You can find out how to get these
+[below](#generated-code-tests).
+
-To run tests with generated stub code from `.proto` files, you will also need the `composer`, `protoc` and `protoc-gen-php` binaries. You can find out how to get these [below](#generated-code-tests).
## Build from Source
@@ -98,45 +128,46 @@ $ ./bin/run_tests.sh
## Generated Code Tests
-This section specifies the prerequisites for running the generated code tests, as well as how to run the tests themselves.
+This section specifies the prerequisites for running the generated code tests,
+as well as how to run the tests themselves.
### Composer
-If you don't have it already, install `composer` to pull in some runtime dependencies based on the `composer.json` file.
+Install the runtime dependencies via `composer install`.
```sh
-$ curl -sS https://getcomposer.org/installer | php
-$ sudo mv composer.phar /usr/local/bin/composer
-
$ cd grpc/src/php
$ composer install
```
### Protobuf compiler
-Again if you don't have it already, you need to install the protobuf compiler `protoc`, version 3.0.0+.
+Again if you don't have it already, you need to install the protobuf compiler
+`protoc`, version 3.1.0+.
+
+If `protoc` hasn't been installed, you can download the `protoc` binaries from
+[the protocol buffers Github repository](https://github.com/google/protobuf/releases).
-If you compiled the gRPC C core library from source above, the `protoc` binary should have been installed as well. If it hasn't been installed, you can run the following commands to install it.
+If you really must compile `protoc` from source, you can run the following
+commands, but this is risky because there is no easy way to uninstall /
+upgrade to a newer release.
```sh
$ cd grpc/third_party/protobuf
-$ sudo make install # 'make' should have been run by core grpc
+$ ./autogen.sh && ./configure && make
+$ sudo make install
```
-Alternatively, you can download `protoc` binaries from [the protocol buffers Github repository](https://github.com/google/protobuf/releases).
+### PHP Protoc Plugin
-### PHP protobuf compiler
+You need the gRPC PHP protoc plugin to generate the client stub classes.
-You need to install `protoc-gen-php` to generate stub class `.php` files from service definition `.proto` files.
+It should already been compiled when you run `make` from the root directory
+of this repo. The plugin can be found in the `bins/opt` directory. We are
+planning to provide a better way to download and install the plugin
+in the future.
-```sh
-$ git clone https://github.com/stanley-cheung/Protobuf-PHP
-$ cd Protobuf-PHP
-$ gem install rake ronn
-$ rake pear:package version=1.0
-$ sudo pear install Protobuf-1.0.tgz
-```
### Client Stub
@@ -149,7 +180,8 @@ $ ./bin/generate_proto_php.sh
### Run test server
-Run a local server serving the math services. Please see [Node][] for how to run an example server.
+Run a local server serving the math services. Please see [Node][] for how to
+run an example server.
```sh
$ cd grpc
diff --git a/src/php/bin/determine_extension_dir.sh b/src/php/bin/determine_extension_dir.sh
index a59882506f..e3d6bbc1a5 100755
--- a/src/php/bin/determine_extension_dir.sh
+++ b/src/php/bin/determine_extension_dir.sh
@@ -32,7 +32,7 @@ default_extension_dir=$(php-config --extension-dir)
if [ ! -e $default_extension_dir/grpc.so ]; then
# the grpc extension is not found in the default PHP extension dir
# try the source modules directory
- module_dir=../ext/grpc/modules
+ module_dir=$(pwd)/../ext/grpc/modules
if [ ! -e $module_dir/grpc.so ]; then
echo "Please run 'phpize && ./configure && make' from ext/grpc first"
exit 1
diff --git a/src/php/bin/generate_proto_php.sh b/src/php/bin/generate_proto_php.sh
index 16f93747ab..c558bc5769 100755
--- a/src/php/bin/generate_proto_php.sh
+++ b/src/php/bin/generate_proto_php.sh
@@ -28,13 +28,32 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
set +e
-cd $(dirname $0)
+cd $(dirname $0)/../../..
+
+protoc --proto_path=src/proto/math \
+ --php_out=src/php/tests/generated_code \
+ --grpc_out=src/php/tests/generated_code \
+ --plugin=protoc-gen-grpc=bins/opt/grpc_php_plugin \
+ src/proto/math/math.proto
-gen_code='../tests/generated_code'
-interop='../tests/interop'
+# replace the Empty message with EmptyMessage
+# because Empty is a PHP reserved word
+sed -i 's/message Empty/message EmptyMessage/g' \
+ src/proto/grpc/testing/empty.proto
+sed -i 's/grpc\.testing\.Empty/grpc\.testing\.EmptyMessage/g' \
+ src/proto/grpc/testing/test.proto
-protoc-gen-php -i $gen_code -o $gen_code $gen_code/math.proto
+protoc --proto_path=. \
+ --php_out=src/php/tests/interop \
+ --grpc_out=src/php/tests/interop \
+ --plugin=protoc-gen-grpc=bins/opt/grpc_php_plugin \
+ src/proto/grpc/testing/messages.proto \
+ src/proto/grpc/testing/empty.proto \
+ src/proto/grpc/testing/test.proto
-protoc-gen-php -i $interop -o $interop $interop/test.proto
+# change it back
+sed -i 's/message EmptyMessage/message Empty/g' \
+ src/proto/grpc/testing/empty.proto
+sed -i 's/grpc\.testing\.EmptyMessage/grpc\.testing\.Empty/g' \
+ src/proto/grpc/testing/test.proto
diff --git a/src/php/bin/interop_client.sh b/src/php/bin/interop_client.sh
index 2af49cd892..7fa4686ef8 100755
--- a/src/php/bin/interop_client.sh
+++ b/src/php/bin/interop_client.sh
@@ -31,5 +31,6 @@
set -e
cd $(dirname $0)
source ./determine_extension_dir.sh
+cd ../tests/interop
php $extension_dir -d max_execution_time=300 \
- ../tests/interop/interop_client.php $@ 1>&2
+ interop_client.php $@ 1>&2
diff --git a/src/php/composer.json b/src/php/composer.json
index 571f30013f..6042094032 100644
--- a/src/php/composer.json
+++ b/src/php/composer.json
@@ -8,7 +8,7 @@
"version": "1.1.0",
"require": {
"php": ">=5.5.0",
- "stanley-cheung/protobuf-php": "v0.6"
+ "google/protobuf": "v3.1.0-alpha-1"
},
"require-dev": {
"google/auth": "v0.9"
diff --git a/src/php/tests/generated_code/AbstractGeneratedCodeTest.php b/src/php/tests/generated_code/AbstractGeneratedCodeTest.php
index 75922d4cf7..8fe9bc26d8 100644
--- a/src/php/tests/generated_code/AbstractGeneratedCodeTest.php
+++ b/src/php/tests/generated_code/AbstractGeneratedCodeTest.php
@@ -32,7 +32,8 @@
*
*/
require_once realpath(dirname(__FILE__).'/../../vendor/autoload.php');
-require_once dirname(__FILE__).'/math.php';
+require_once dirname(__FILE__).'/math.pb.php';
+require_once dirname(__FILE__).'/math_grpc_pb.php';
abstract class AbstractGeneratedCodeTest extends PHPUnit_Framework_TestCase
{
@@ -92,7 +93,7 @@ abstract class AbstractGeneratedCodeTest extends PHPUnit_Framework_TestCase
public function testTimeout()
{
$div_arg = new math\DivArgs();
- $call = self::$client->Div($div_arg, [], ['timeout' => 100]);
+ $call = self::$client->Div($div_arg, [], ['timeout' => 1]);
list($response, $status) = $call->wait();
$this->assertSame(\Grpc\STATUS_DEADLINE_EXCEEDED, $status->code);
}
diff --git a/src/php/tests/generated_code/math.proto b/src/php/tests/generated_code/math.proto
deleted file mode 100644
index c872ee6e0b..0000000000
--- a/src/php/tests/generated_code/math.proto
+++ /dev/null
@@ -1,83 +0,0 @@
-
-// Copyright 2015, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// TODO: start using src/proto/math/math.proto and remove this file once
-// PHP supports proto3.
-
-syntax = "proto2";
-
-package math;
-
-message DivArgs {
- optional int64 dividend = 1 [default = 0];
- optional int64 divisor = 2 [default = 0];
-}
-
-message DivReply {
- optional int64 quotient = 1 [default = 0];
- optional int64 remainder = 2 [default = 0];
-}
-
-message FibArgs {
- optional int64 limit = 1 [default = 0];
-}
-
-message Num {
- optional int64 num = 1 [default = 0];
-}
-
-message FibReply {
- optional int64 count = 1 [default = 0];
-}
-
-service Math {
- // Div divides args.dividend by args.divisor and returns the quotient and
- // remainder.
- rpc Div (DivArgs) returns (DivReply) {
- }
-
- // DivMany accepts an arbitrary number of division args from the client stream
- // and sends back the results in the reply stream. The stream continues until
- // the client closes its end; the server does the same after sending all the
- // replies. The stream ends immediately if either end aborts.
- rpc DivMany (stream DivArgs) returns (stream DivReply) {
- }
-
- // Fib generates numbers in the Fibonacci sequence. If args.limit > 0, Fib
- // generates up to limit numbers; otherwise it continues until the call is
- // canceled. Unlike Fib above, Fib has no final FibReply.
- rpc Fib (FibArgs) returns (stream Num) {
- }
-
- // Sum sums a stream of numbers, returning the final result once the stream
- // is closed.
- rpc Sum (stream Num) returns (Num) {
- }
-}
diff --git a/src/php/tests/interop/empty.proto b/src/php/tests/interop/empty.proto
deleted file mode 100644
index 4200d7b519..0000000000
--- a/src/php/tests/interop/empty.proto
+++ /dev/null
@@ -1,43 +0,0 @@
-
-// Copyright 2015, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-syntax = "proto2";
-
-package grpc.testing;
-
-// An empty message that you can re-use to avoid defining duplicated empty
-// messages in your project. A typical example is to use it as argument or the
-// return value of a service API. For instance:
-//
-// service Foo {
-// rpc Bar (grpc.testing.EmptyMessage) returns (grpc.testing.EmptyMessage) { };
-// };
-//
-message EmptyMessage {}
diff --git a/src/php/tests/interop/interop_client.php b/src/php/tests/interop/interop_client.php
index 4bc4589956..124d324913 100755
--- a/src/php/tests/interop/interop_client.php
+++ b/src/php/tests/interop/interop_client.php
@@ -32,9 +32,8 @@
*
*/
require_once realpath(dirname(__FILE__).'/../../vendor/autoload.php');
-require 'empty.php';
-require 'messages.php';
-require 'test.php';
+require 'src/proto/grpc/testing/test.pb.php';
+require 'src/proto/grpc/testing/test_grpc_pb.php';
use Google\Auth\CredentialsLoader;
use Google\Auth\ApplicationDefaultCredentials;
use GuzzleHttp\ClientInterface;
@@ -282,7 +281,7 @@ function serverStreaming($stub)
foreach ($sizes as $size) {
$response_parameters = new grpc\testing\ResponseParameters();
$response_parameters->setSize($size);
- $request->addResponseParameters($response_parameters);
+ $request->getResponseParameters()[] = $response_parameters;
}
$call = $stub->StreamingOutputCall($request);
@@ -316,7 +315,7 @@ function pingPong($stub)
$request->setResponseType(grpc\testing\PayloadType::COMPRESSABLE);
$response_parameters = new grpc\testing\ResponseParameters();
$response_parameters->setSize($response_lengths[$i]);
- $request->addResponseParameters($response_parameters);
+ $request->getResponseParameters()[] = $response_parameters;
$payload = new grpc\testing\Payload();
$payload->setBody(str_repeat("\0", $request_lengths[$i]));
$request->setPayload($payload);
@@ -376,7 +375,7 @@ function cancelAfterFirstResponse($stub)
$request->setResponseType(grpc\testing\PayloadType::COMPRESSABLE);
$response_parameters = new grpc\testing\ResponseParameters();
$response_parameters->setSize(31415);
- $request->addResponseParameters($response_parameters);
+ $request->getResponseParameters()[] = $response_parameters;
$payload = new grpc\testing\Payload();
$payload->setBody(str_repeat("\0", 27182));
$request->setPayload($payload);
@@ -396,7 +395,7 @@ function timeoutOnSleepingServer($stub)
$request->setResponseType(grpc\testing\PayloadType::COMPRESSABLE);
$response_parameters = new grpc\testing\ResponseParameters();
$response_parameters->setSize(8);
- $request->addResponseParameters($response_parameters);
+ $request->getResponseParameters()[] = $response_parameters;
$payload = new grpc\testing\Payload();
$payload->setBody(str_repeat("\0", 9));
$request->setPayload($payload);
diff --git a/src/php/tests/interop/messages.proto b/src/php/tests/interop/messages.proto
deleted file mode 100644
index 44e3c3b8f9..0000000000
--- a/src/php/tests/interop/messages.proto
+++ /dev/null
@@ -1,162 +0,0 @@
-
-// Copyright 2015-2016, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// Message definitions to be used by integration test service definitions.
-
-syntax = "proto2";
-
-package grpc.testing;
-
-// The type of payload that should be returned.
-enum PayloadType {
- // Compressable text format.
- COMPRESSABLE = 0;
-
- // Uncompressable binary format.
- UNCOMPRESSABLE = 1;
-}
-
-// A block of data, to simply increase gRPC message size.
-message Payload {
- // The type of data in body.
- optional PayloadType type = 1 [default = COMPRESSABLE];
- // Primary contents of payload.
- optional bytes body = 2;
-}
-
-// A protobuf representation for grpc status. This is used by test
-// clients to specify a status that the server should attempt to return.
-message EchoStatus {
- optional int32 code = 1;
- optional string message = 2;
-}
-
-// Unary request.
-message SimpleRequest {
- // Desired payload type in the response from the server.
- // If response_type is RANDOM, server randomly chooses one from other formats.
- optional PayloadType response_type = 1 [default = COMPRESSABLE];
-
- // Desired payload size in the response from the server.
- // If response_type is COMPRESSABLE, this denotes the size before compression.
- optional int32 response_size = 2;
-
- // Optional input payload sent along with the request.
- optional Payload payload = 3;
-
- // Whether SimpleResponse should include username.
- optional bool fill_username = 4;
-
- // Whether SimpleResponse should include OAuth scope.
- optional bool fill_oauth_scope = 5;
-
- // Whether to request the server to compress the response.
- optional bool request_compressed_response = 6;
-
- // Whether server should return a given status
- optional EchoStatus response_status = 7;
-}
-
-// Unary response, as configured by the request.
-message SimpleResponse {
- // Payload to increase message size.
- optional Payload payload = 1;
- // The user the request came from, for verifying authentication was
- // successful when the client expected it.
- optional string username = 2;
- // OAuth scope.
- optional string oauth_scope = 3;
-}
-
-// Client-streaming request.
-message StreamingInputCallRequest {
- // Optional input payload sent along with the request.
- optional Payload payload = 1;
-
- // Not expecting any payload from the response.
-}
-
-// Client-streaming response.
-message StreamingInputCallResponse {
- // Aggregated size of payloads received from the client.
- optional int32 aggregated_payload_size = 1;
-}
-
-// Configuration for a particular response.
-message ResponseParameters {
- // Desired payload sizes in responses from the server.
- // If response_type is COMPRESSABLE, this denotes the size before compression.
- optional int32 size = 1;
-
- // Desired interval between consecutive responses in the response stream in
- // microseconds.
- optional int32 interval_us = 2;
-}
-
-// Server-streaming request.
-message StreamingOutputCallRequest {
- // Desired payload type in the response from the server.
- // If response_type is RANDOM, the payload from each response in the stream
- // might be of different types. This is to simulate a mixed type of payload
- // stream.
- optional PayloadType response_type = 1 [default = COMPRESSABLE];
-
- // Configuration for each expected response message.
- repeated ResponseParameters response_parameters = 2;
-
- // Optional input payload sent along with the request.
- optional Payload payload = 3;
-
- // Whether to request the server to compress the response.
- optional bool request_compressed_response = 6;
-
- // Whether server should return a given status
- optional EchoStatus response_status = 7;
-}
-
-// Server-streaming response, as configured by the request and parameters.
-message StreamingOutputCallResponse {
- // Payload to increase response size.
- optional Payload payload = 1;
-}
-
-// For reconnect interop test only.
-// Client tells server what reconnection parameters it used.
-message ReconnectParams {
- optional int32 max_reconnect_backoff_ms = 1;
-}
-
-// For reconnect interop test only.
-// Server tells client whether its reconnects are following the spec and the
-// reconnect backoffs it saw.
-message ReconnectInfo {
- optional bool passed = 1;
- repeated int32 backoff_ms = 2;
-}
diff --git a/src/php/tests/interop/test.proto b/src/php/tests/interop/test.proto
deleted file mode 100644
index 57ef30ee1c..0000000000
--- a/src/php/tests/interop/test.proto
+++ /dev/null
@@ -1,78 +0,0 @@
-
-// Copyright 2015-2016, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// An integration test service that covers all the method signature permutations
-// of unary/streaming requests/responses.
-syntax = "proto2";
-
-import "empty.proto";
-import "messages.proto";
-
-package grpc.testing;
-
-// A simple service to test the various types of RPCs and experiment with
-// performance with various types of payload.
-service TestService {
- // One empty request followed by one empty response.
- rpc EmptyCall(grpc.testing.EmptyMessage) returns (grpc.testing.EmptyMessage);
-
- // One request followed by one response.
- rpc UnaryCall(SimpleRequest) returns (SimpleResponse);
-
- // One request followed by a sequence of responses (streamed download).
- // The server returns the payload with client desired type and sizes.
- rpc StreamingOutputCall(StreamingOutputCallRequest)
- returns (stream StreamingOutputCallResponse);
-
- // A sequence of requests followed by one response (streamed upload).
- // The server returns the aggregated size of client payload as the result.
- rpc StreamingInputCall(stream StreamingInputCallRequest)
- returns (StreamingInputCallResponse);
-
- // A sequence of requests with each request served by the server immediately.
- // As one request could lead to multiple responses, this interface
- // demonstrates the idea of full duplexing.
- rpc FullDuplexCall(stream StreamingOutputCallRequest)
- returns (stream StreamingOutputCallResponse);
-
- // A sequence of requests followed by a sequence of responses.
- // The server buffers all the client requests and then serves them in order. A
- // stream of responses are returned to the client when the server starts with
- // first request.
- rpc HalfDuplexCall(stream StreamingOutputCallRequest)
- returns (stream StreamingOutputCallResponse);
-}
-
-// A simple service NOT implemented at servers so clients can test for
-// that case.
-service UnimplementedService {
- // A call that no server should implement
- rpc UnimplementedCall(grpc.testing.EmptyMessage) returns (grpc.testing.EmptyMessage);
-}
diff --git a/templates/composer.json.template b/templates/composer.json.template
index 48d3b8892e..accfb382a9 100644
--- a/templates/composer.json.template
+++ b/templates/composer.json.template
@@ -9,7 +9,7 @@
"license": "BSD-3-Clause",
"require": {
"php": ">=5.5.0",
- "stanley-cheung/protobuf-php": "v0.6"
+ "google/protobuf": "v3.1.0-alpha-1"
},
"require-dev": {
"google/auth": "v0.9"
diff --git a/templates/src/php/composer.json.template b/templates/src/php/composer.json.template
index bf876f345e..7feeae976d 100644
--- a/templates/src/php/composer.json.template
+++ b/templates/src/php/composer.json.template
@@ -10,7 +10,7 @@
"version": "${settings.php_version.php_composer()}",
"require": {
"php": ">=5.5.0",
- "stanley-cheung/protobuf-php": "v0.6"
+ "google/protobuf": "v3.1.0-alpha-1"
},
"require-dev": {
"google/auth": "v0.9"
diff --git a/tools/dockerfile/interoptest/grpc_interop_php/build_interop.sh b/tools/dockerfile/interoptest/grpc_interop_php/build_interop.sh
index a84a450221..cf5e888eff 100755
--- a/tools/dockerfile/interoptest/grpc_interop_php/build_interop.sh
+++ b/tools/dockerfile/interoptest/grpc_interop_php/build_interop.sh
@@ -38,7 +38,6 @@ git clone --recursive /var/local/jenkins/grpc /var/local/git/grpc
cp -r /var/local/jenkins/service_account $HOME || true
cd /var/local/git/grpc
-rvm --default use ruby-2.1
# gRPC core and protobuf need to be installed
make install
@@ -49,4 +48,4 @@ make install
(cd src/php && composer install)
-(cd src/php && protoc-gen-php -i tests/interop/ -o tests/interop/ tests/interop/test.proto)
+(cd src/php && ./bin/generate_proto_php.sh)
diff --git a/tools/dockerfile/interoptest/grpc_interop_php7/build_interop.sh b/tools/dockerfile/interoptest/grpc_interop_php7/build_interop.sh
index 261dded282..e486e5276a 100755
--- a/tools/dockerfile/interoptest/grpc_interop_php7/build_interop.sh
+++ b/tools/dockerfile/interoptest/grpc_interop_php7/build_interop.sh
@@ -38,7 +38,6 @@ git clone --recursive /var/local/jenkins/grpc /var/local/git/grpc
cp -r /var/local/jenkins/service_account $HOME || true
cd /var/local/git/grpc
-rvm --default use ruby-2.1
# gRPC core and protobuf need to be installed
make install
@@ -49,4 +48,4 @@ make install
(cd src/php && composer install)
-(cd src/php && protoc-gen-php -i tests/interop/ -o tests/interop/ tests/interop/test.proto)
+(cd src/php && ./bin/generate_proto_php.sh)
diff --git a/tools/dockerfile/stress_test/grpc_interop_stress_php/build_interop_stress.sh b/tools/dockerfile/stress_test/grpc_interop_stress_php/build_interop_stress.sh
index 87262f1d62..34fd09f78b 100755
--- a/tools/dockerfile/stress_test/grpc_interop_stress_php/build_interop_stress.sh
+++ b/tools/dockerfile/stress_test/grpc_interop_stress_php/build_interop_stress.sh
@@ -38,7 +38,6 @@ git clone --recursive /var/local/jenkins/grpc /var/local/git/grpc
cp -r /var/local/jenkins/service_account $HOME || true
cd /var/local/git/grpc
-rvm --default use ruby-2.1
make install-certs
@@ -51,4 +50,4 @@ make install
(cd src/php && composer install)
-(cd src/php && protoc-gen-php -i tests/interop/ -o tests/interop/ tests/interop/test.proto)
+(cd src/php && ./bin/generate_proto_php.sh)