mirror of
				https://github.com/shivammathur/setup-php.git
				synced 2025-10-31 07:16:22 +07:00 
			
		
		
		
	Use brew for grpc_php_plugin on macOS
This commit is contained in:
		| @ -24,14 +24,18 @@ get_grpc_tag() { | |||||||
|   fi |   fi | ||||||
| } | } | ||||||
|  |  | ||||||
| add_grpc_php_plugin() { | add_grpc_php_plugin_macos() { | ||||||
|   grpc_tag=$1 |   brew install grpc | ||||||
|  |   brew link --force --overwrite grpc >/dev/null 2>&1 | ||||||
|  |   grpc_tag="v$(brew info grpc | grep "grpc:" | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+")" | ||||||
|  |   license_path="$(brew --prefix grpc)/LICENSE" | ||||||
|  | } | ||||||
|  |  | ||||||
|  | add_grpc_php_plugin_linux() { | ||||||
|   get_grpc_tag |   get_grpc_tag | ||||||
|   ( |  | ||||||
|   get -s -n "" "https://github.com/grpc/grpc/archive/$grpc_tag.tar.gz" | tar -xz -C /tmp |   get -s -n "" "https://github.com/grpc/grpc/archive/$grpc_tag.tar.gz" | tar -xz -C /tmp | ||||||
|   cd "/tmp/grpc-${grpc_tag:1}" || exit |   cd "/tmp/grpc-${grpc_tag:1}" || exit | ||||||
|   add_bazel |   add_bazel | ||||||
|     [ "$(uname -s)" = "Darwin" ] && sudo xcode-select -s /Applications/Xcode_11.7.app |  | ||||||
|   if [ "$DISTRIB_RELEASE" = "16.04" ]; then |   if [ "$DISTRIB_RELEASE" = "16.04" ]; then | ||||||
|     CC="$(command -v gcc)" CXX="$(command -v g++)" ./tools/bazel build src/compiler:grpc_php_plugin |     CC="$(command -v gcc)" CXX="$(command -v g++)" ./tools/bazel build src/compiler:grpc_php_plugin | ||||||
|   else |   else | ||||||
| @ -39,10 +43,20 @@ add_grpc_php_plugin() { | |||||||
|   fi |   fi | ||||||
|   sudo mv ./bazel-bin/src/compiler/grpc_php_plugin /usr/local/bin/grpc_php_plugin |   sudo mv ./bazel-bin/src/compiler/grpc_php_plugin /usr/local/bin/grpc_php_plugin | ||||||
|   sudo chmod a+x /usr/local/bin/grpc_php_plugin |   sudo chmod a+x /usr/local/bin/grpc_php_plugin | ||||||
|   ) >/dev/null 2>&1 |   license_path="/tmp/grpc-${grpc_tag:1}/LICENSE" | ||||||
|   echo "::set-output name=grpc_php_plugin_path::/usr/local/bin/grpc_php_plugin" | } | ||||||
|  |  | ||||||
|  | add_grpc_php_plugin() { | ||||||
|  |   grpc_tag=$1 | ||||||
|  |   license_path="" | ||||||
|  |   if [ "$(uname -s)" = "Darwin" ]; then | ||||||
|  |     add_grpc_php_plugin_macos >/dev/null 2>&1 | ||||||
|  |   else | ||||||
|  |     add_grpc_php_plugin_linux >/dev/null 2>&1 | ||||||
|  |   fi | ||||||
|  |   echo "::set-output name=grpc_php_plugin_path::$(command -v grpc_php_plugin)" | ||||||
|   add_log "${tick:?}" "grpc_php_plugin" "Added grpc_php_plugin ${grpc_tag:1}" |   add_log "${tick:?}" "grpc_php_plugin" "Added grpc_php_plugin ${grpc_tag:1}" | ||||||
|   printf "::group::\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "grpc_php_plugin" "Click to read the grpc_php_plugin related license information" |   printf "::group::\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "grpc_php_plugin" "Click to read the grpc_php_plugin related license information" | ||||||
|   cat "/tmp/grpc-${grpc_tag:1}/LICENSE" |   cat "$license_path" | ||||||
|   echo "::endgroup::" |   echo "::endgroup::" | ||||||
| } | } | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user
	 Shivam Mathur
					Shivam Mathur