Speed up the 'make run-dev' command (#6362)

This commit is contained in:
GabrielInTheWorld 2022-02-16 16:19:58 +01:00 committed by GitHub
parent b9ca06af25
commit 473c742681
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 27 additions and 4 deletions

View File

@ -11,7 +11,7 @@ run-service-tests:
git submodule foreach 'make run-tests'
build-dev:
git submodule foreach 'make build-dev'
./dev-commands/submodules-do.sh 'make build-dev'
make -C proxy build-dev
run-dev: | build-dev

23
dev-commands/submodules-do.sh Executable file
View File

@ -0,0 +1,23 @@
#!/bin/bash
# This script runs a command in every registered submodule parallel
# Credits go to https://stackoverflow.com/a/70418086
if [ -z "$1" ]; then
echo "Missing Command" >&2
exit 1
fi
COMMAND="$@"
IFS=$'\n'
for DIR in $(git submodule foreach --recursive -q sh -c pwd); do
printf "\n\"${DIR}\": \"${COMMAND}\" started!\n" \
&& \
cd "$DIR" \
&& \
eval "$COMMAND" \
&& \
printf "\"${DIR}\": \"${COMMAND}\" finished!\n" \
&
done
wait

View File

@ -23,9 +23,9 @@ function pull_latest_commit {
local BRANCH_NAME=$(get_upstream_branch)
local REMOTE_NAME=$(get_upstream_name)
echo "git fetch $REMOTE_NAME && git checkout $REMOTE_NAME/$BRANCH_NAME ..."
git fetch $REMOTE_NAME;
git checkout $REMOTE_NAME/$BRANCH_NAME;
echo "git checkout $BRANCH_NAME && git pull $REMOTE_NAME $BRANCH_NAME ..."
git checkout -B $BRANCH_NAME;
git pull $REMOTE_NAME $BRANCH_NAME;
}
export -f pull_latest_commit