From f5c26d146c4bab8d0ca3d798e0fd62ca49b07f38 Mon Sep 17 00:00:00 2001 From: Alexander Apalikov Date: Wed, 24 Apr 2019 12:46:24 +0300 Subject: [PATCH] Switch to parrallel execution of SDK commands Use subshell execution of the `run-all-sdk-command` make target. --- build/includes/sdk.mk | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/build/includes/sdk.mk b/build/includes/sdk.mk index 6b4ab2c9cb..c7898e2789 100644 --- a/build/includes/sdk.mk +++ b/build/includes/sdk.mk @@ -55,17 +55,22 @@ gen-all-sdk-grpc: run-all-sdk-command gen-sdk-grpc: COMMAND := gen gen-sdk-grpc: run-sdk-command -# Runs a command on all supported languages, use COMMAND variable to select which command. +# Runs a command on all supported languages in parallel, use COMMAND variable to select which command. run-all-sdk-command: cd $(sdk_build_folder); \ + FAIL=0; \ for d in */ ; do \ if [ "$${d%?}" != "tool" ] && [ -f $$d/$(COMMAND).sh ]; then \ - ( cd .. && $(MAKE) run-sdk-command COMMAND=$(COMMAND) SDK_FOLDER=$${d%?} ) \ - || { failed=1; break; }; \ + (cd .. && $(MAKE) run-sdk-command COMMAND=$(COMMAND) SDK_FOLDER=$${d%?}) & \ fi \ done; \ - if (( failed )); then \ - echo "Failed to run SDK command"; exit -1; \ + for job in `jobs -p` ; \ + do \ + wait $$job || let "FAIL+=1"; \ + done ; \ + if [ "$$FAIL" != "0" ]; \ + then \ + echo "Failed to run SDK command"; exit -1; \ fi # Runs a command for a specific SDK.