Skip to content

Commit

Permalink
Switch to parrallel execution of SDK commands
Browse files Browse the repository at this point in the history
Use subshell execution of the `run-all-sdk-command` make target.
  • Loading branch information
aLekSer committed Apr 24, 2019
1 parent b8a6d45 commit f5c26d1
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions build/includes/sdk.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit f5c26d1

Please sign in to comment.