@@ -24,35 +24,38 @@ get_grpc_tag() {
2424 fi
2525}
2626
27- add_grpc_php_plugin_macos () {
27+ add_grpc_php_plugin_brew () {
2828 brew install grpc
2929 brew link --force --overwrite grpc > /dev/null 2>&1
3030 grpc_tag=" v$( brew info grpc | grep " grpc:" | grep -Eo " [0-9]+\.[0-9]+\.[0-9]+" ) "
3131 license_path=" $( brew --prefix grpc) /LICENSE"
3232}
3333
34- add_grpc_php_plugin_linux () {
34+ add_grpc_php_plugin_compile () {
3535 get_grpc_tag
3636 get -s -n " " " https://github.com/grpc/grpc/archive/$grpc_tag .tar.gz" | tar -xz -C /tmp
37- cd " /tmp/grpc-${grpc_tag: 1} " || exit
38- add_bazel
39- if [ " $DISTRIB_RELEASE " = " 16.04" ]; then
40- CC=" $( command -v gcc) " CXX=" $( command -v g++) " ./tools/bazel build src/compiler:grpc_php_plugin
41- else
42- ./tools/bazel build src/compiler:grpc_php_plugin
43- fi
44- sudo mv ./bazel-bin/src/compiler/grpc_php_plugin /usr/local/bin/grpc_php_plugin
45- sudo chmod a+x /usr/local/bin/grpc_php_plugin
46- license_path=" /tmp/grpc-${grpc_tag: 1} /LICENSE"
37+ export DISABLE_BAZEL_WRAPPER=1
38+ (
39+ cd " /tmp/grpc-${grpc_tag: 1} " || exit
40+ add_bazel
41+ if [ " $DISTRIB_RELEASE " = " 16.04" ]; then
42+ CC=" $( command -v gcc) " CXX=" $( command -v g++) " ./tools/bazel build src/compiler:grpc_php_plugin
43+ else
44+ ./tools/bazel build src/compiler:grpc_php_plugin
45+ fi
46+ sudo mv ./bazel-bin/src/compiler/grpc_php_plugin /usr/local/bin/grpc_php_plugin
47+ sudo chmod a+x /usr/local/bin/grpc_php_plugin
48+ license_path=" /tmp/grpc-${grpc_tag: 1} /LICENSE"
49+ )
4750}
4851
4952add_grpc_php_plugin () {
5053 grpc_tag=$1
5154 license_path=" "
52- if [ " $( uname -s ) " = " Darwin " ]; then
53- add_grpc_php_plugin_macos > /dev/null 2>&1
55+ if [ " $grpc_tag " = " latest " ]; then
56+ add_grpc_php_plugin_brew > /dev/null 2>&1
5457 else
55- add_grpc_php_plugin_linux > /dev/null 2>&1
58+ add_grpc_php_plugin_compile > /dev/null 2>&1
5659 fi
5760 echo " ::set-output name=grpc_php_plugin_path::$( command -v grpc_php_plugin) "
5861 add_log " ${tick:? } " " grpc_php_plugin" " Added grpc_php_plugin ${grpc_tag: 1} "
0 commit comments