• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/sh
2# Copyright 2015 gRPC authors.
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#     http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16set +e
17cd $(dirname $0)/../../..
18
19protoc --proto_path=src/proto/math \
20       --php_out=src/php/tests/generated_code \
21       --grpc_out=src/php/tests/generated_code \
22       --plugin=protoc-gen-grpc=bins/opt/grpc_php_plugin \
23       src/proto/math/math.proto
24
25# replace the Empty message with EmptyMessage
26# because Empty is a PHP reserved word
27output_file=$(mktemp)
28sed 's/message Empty/message EmptyMessage/g' \
29  src/proto/grpc/testing/empty.proto > $output_file
30mv $output_file ./src/proto/grpc/testing/empty.proto
31sed 's/grpc\.testing\.Empty/grpc\.testing\.EmptyMessage/g' \
32  src/proto/grpc/testing/test.proto > $output_file
33mv $output_file ./src/proto/grpc/testing/test.proto
34
35protoc --proto_path=. \
36       --php_out=src/php/tests/interop \
37       --grpc_out=src/php/tests/interop \
38       --plugin=protoc-gen-grpc=bins/opt/grpc_php_plugin \
39       src/proto/grpc/testing/messages.proto \
40       src/proto/grpc/testing/empty.proto \
41       src/proto/grpc/testing/test.proto
42
43# change it back
44sed 's/message EmptyMessage/message Empty/g' \
45  src/proto/grpc/testing/empty.proto > $output_file
46mv $output_file ./src/proto/grpc/testing/empty.proto
47sed 's/grpc\.testing\.EmptyMessage/grpc\.testing\.Empty/g' \
48  src/proto/grpc/testing/test.proto > $output_file
49mv $output_file ./src/proto/grpc/testing/test.proto
50
51