From 5ae9bb3cb35dd64be195efcadb00e5cca4c11a18 Mon Sep 17 00:00:00 2001 From: Nex Date: Sun, 15 Mar 2020 10:47:53 +0800 Subject: [PATCH] Fix Node.js gen scripts --- scripts/gen-node.js.sh | 12 ++++++------ scripts/gen-nodejs.bat | 15 +++++++++------ 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/scripts/gen-node.js.sh b/scripts/gen-node.js.sh index 035da88..2dd1ec1 100644 --- a/scripts/gen-node.js.sh +++ b/scripts/gen-node.js.sh @@ -1,10 +1,10 @@ #!/usr/bin/env bash cd "${0%/*}/.." dir=gen/nodejs -plugin=`which grpc_tools_node_protoc_plugin` +pluginPath=$(which grpc_tools_node_protoc_plugin) mkdir -p $dir -%exe% --js_out=import_style=commonjs,binary:%dir --grpc_out=%dir --plugin=protoc-gen-grpc=$plugin bdledger/api/common.proto -%exe% --js_out=import_style=commonjs,binary:%dir --grpc_out=%dir --plugin=protoc-gen-grpc=$plugin bdledger/api/error_details.proto -%exe% --js_out=import_style=commonjs,binary:%dir --grpc_out=%dir --plugin=protoc-gen-grpc=$plugin bdledger/api/node.proto -%exe% --js_out=import_style=commonjs,binary:%dir --grpc_out=%dir --plugin=protoc-gen-grpc=$plugin bdledger/api/ledger.proto -%exe% --js_out=import_style=commonjs,binary:%dir --grpc_out=%dir --plugin=protoc-gen-grpc=$plugin bdledger/api/query.proto +protoc -I . --js_out=import_style=commonjs,binary:$dir --grpc_out=$dir --plugin=protoc-gen-grpc="$pluginPath" bdledger/api/common.proto +protoc -I . --js_out=import_style=commonjs,binary:$dir --grpc_out=$dir --plugin=protoc-gen-grpc="$pluginPath" bdledger/api/error_details.proto +protoc -I . --js_out=import_style=commonjs,binary:$dir --grpc_out=$dir --plugin=protoc-gen-grpc="$pluginPath" bdledger/api/node.proto +protoc -I . --js_out=import_style=commonjs,binary:$dir --grpc_out=$dir --plugin=protoc-gen-grpc="$pluginPath" bdledger/api/ledger.proto +protoc -I . --js_out=import_style=commonjs,binary:$dir --grpc_out=$dir --plugin=protoc-gen-grpc="$pluginPath" bdledger/api/query.proto diff --git a/scripts/gen-nodejs.bat b/scripts/gen-nodejs.bat index 9e331e2..849462b 100644 --- a/scripts/gen-nodejs.bat +++ b/scripts/gen-nodejs.bat @@ -2,15 +2,18 @@ cd /d "%~dp0.." set dir=.\gen\nodejs set exe=grpc_tools_node_protoc -for /f %%i in ('where grpc_tools_node_protoc_plugin') do set plugin=%%i +set plugin=grpc_tools_node_protoc_plugin where /q %exe% || echo missing %exe% && exit /B +where /q %plugin% || echo missing %plugin% && exit /B + +for /f %%i in ('where %plugin%') do set pluginPath=%%i if not exist %dir% mkdir %dir% -call %exe% --js_out=import_style=commonjs,binary:%dir% --grpc_out=%dir% --plugin=protoc-gen-grpc=%plugin% bdledger/api/common.proto -call %exe% --js_out=import_style=commonjs,binary:%dir% --grpc_out=%dir% --plugin=protoc-gen-grpc=%plugin% bdledger/api/error_details.proto -call %exe% --js_out=import_style=commonjs,binary:%dir% --grpc_out=%dir% --plugin=protoc-gen-grpc=%plugin% bdledger/api/node.proto -call %exe% --js_out=import_style=commonjs,binary:%dir% --grpc_out=%dir% --plugin=protoc-gen-grpc=%plugin% bdledger/api/ledger.proto -call %exe% --js_out=import_style=commonjs,binary:%dir% --grpc_out=%dir% --plugin=protoc-gen-grpc=%plugin% bdledger/api/query.proto +call %exe% -I . --js_out=import_style=commonjs,binary:%dir% --grpc_out=%dir% --plugin=protoc-gen-grpc=%pluginPath% bdledger/api/common.proto +call %exe% -I . --js_out=import_style=commonjs,binary:%dir% --grpc_out=%dir% --plugin=protoc-gen-grpc=%pluginPath% bdledger/api/error_details.proto +call %exe% -I . --js_out=import_style=commonjs,binary:%dir% --grpc_out=%dir% --plugin=protoc-gen-grpc=%pluginPath% bdledger/api/node.proto +call %exe% -I . --js_out=import_style=commonjs,binary:%dir% --grpc_out=%dir% --plugin=protoc-gen-grpc=%pluginPath% bdledger/api/ledger.proto +call %exe% -I . --js_out=import_style=commonjs,binary:%dir% --grpc_out=%dir% --plugin=protoc-gen-grpc=%pluginPath% bdledger/api/query.proto echo all done