blob: 416fa9df97b246b3a95669ee7878b3991ad88f4a [file] [log] [blame]
murgatroid9959838492015-04-08 15:47:14 -07001#!/bin/sh
2# Copyright 2015, Google Inc.
3# All rights reserved.
4#
5# Redistribution and use in source and binary forms, with or without
6# modification, are permitted provided that the following conditions are
7# met:
8#
9# * Redistributions of source code must retain the above copyright
10# notice, this list of conditions and the following disclaimer.
11# * Redistributions in binary form must reproduce the above
12# copyright notice, this list of conditions and the following disclaimer
13# in the documentation and/or other materials provided with the
14# distribution.
15# * Neither the name of Google Inc. nor the names of its
16# contributors may be used to endorse or promote products derived from
17# this software without specific prior written permission.
18#
19# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
murgatroid9959838492015-04-08 15:47:14 -070031set +e
Stanley Cheung39b2e5b2016-09-23 13:37:10 -070032cd $(dirname $0)/../../..
murgatroid9959838492015-04-08 15:47:14 -070033
Stanley Cheung39b2e5b2016-09-23 13:37:10 -070034protoc --proto_path=src/proto/math \
35 --php_out=src/php/tests/generated_code \
36 --grpc_out=src/php/tests/generated_code \
37 --plugin=protoc-gen-grpc=bins/opt/grpc_php_plugin \
38 src/proto/math/math.proto
murgatroid9959838492015-04-08 15:47:14 -070039
Stanley Cheung39b2e5b2016-09-23 13:37:10 -070040# replace the Empty message with EmptyMessage
41# because Empty is a PHP reserved word
Stanley Cheung50c87802017-01-12 15:49:56 -080042output_file=$(mktemp)
Stanley Cheung122c6872017-01-11 19:35:17 -080043sed 's/message Empty/message EmptyMessage/g' \
Stanley Cheung50c87802017-01-12 15:49:56 -080044 src/proto/grpc/testing/empty.proto > $output_file
45mv $output_file ./src/proto/grpc/testing/empty.proto
Stanley Cheung122c6872017-01-11 19:35:17 -080046sed 's/grpc\.testing\.Empty/grpc\.testing\.EmptyMessage/g' \
Stanley Cheung50c87802017-01-12 15:49:56 -080047 src/proto/grpc/testing/test.proto > $output_file
48mv $output_file ./src/proto/grpc/testing/test.proto
murgatroid9959838492015-04-08 15:47:14 -070049
Stanley Cheung39b2e5b2016-09-23 13:37:10 -070050protoc --proto_path=. \
51 --php_out=src/php/tests/interop \
52 --grpc_out=src/php/tests/interop \
53 --plugin=protoc-gen-grpc=bins/opt/grpc_php_plugin \
54 src/proto/grpc/testing/messages.proto \
55 src/proto/grpc/testing/empty.proto \
56 src/proto/grpc/testing/test.proto
57
58# change it back
Stanley Cheung122c6872017-01-11 19:35:17 -080059sed 's/message EmptyMessage/message Empty/g' \
Stanley Cheung50c87802017-01-12 15:49:56 -080060 src/proto/grpc/testing/empty.proto > $output_file
61mv $output_file ./src/proto/grpc/testing/empty.proto
Stanley Cheung122c6872017-01-11 19:35:17 -080062sed 's/grpc\.testing\.EmptyMessage/grpc\.testing\.Empty/g' \
Stanley Cheung50c87802017-01-12 15:49:56 -080063 src/proto/grpc/testing/test.proto > $output_file
64mv $output_file ./src/proto/grpc/testing/test.proto
Stanley Cheung122c6872017-01-11 19:35:17 -080065