Build scripts: check if submodule directories are empty

In a freshly cloned repo, submodule directories exist but are not
empty. Check if they are empty and update submodules. Previously,
submodules where only updated if their directories did not exist.
This commit is contained in:
Leroy Hopson 2021-06-15 14:14:48 +07:00
parent bdda1458c0
commit 3fb2580fc6
No known key found for this signature in database
GPG key ID: D2747312A6DB51AA
2 changed files with 3 additions and 3 deletions

View file

@ -16,12 +16,12 @@ fi
# Update git submodules. # Update git submodules.
LIBTSM_DIR=${NATIVE_DIR}/thirdparty/libtsm LIBTSM_DIR=${NATIVE_DIR}/thirdparty/libtsm
if [ ! -d "$LIBTSM_DIR" ]; then if [ -z "$(ls -A -- "$LIBTSM_DIR")" ]; then
cd ${NATIVE_DIR} cd ${NATIVE_DIR}
git submodule update --init --recursive -- $LIBTSM_DIR git submodule update --init --recursive -- $LIBTSM_DIR
fi fi
GODOT_CPP_DIR=${NATIVE_DIR}/thirdparty/godot-cpp GODOT_CPP_DIR=${NATIVE_DIR}/thirdparty/godot-cpp
if [ ! -d "${GODOT_CPP_DIR}" ]; then if [ -z "$(ls -A -- "$GODOT_CPP_DIR")" ]; then
cd ${NATIVE_DIR} cd ${NATIVE_DIR}
git submodule update --init --recursive -- $GODOT_CPP_DIR git submodule update --init --recursive -- $GODOT_CPP_DIR
fi fi

View file

@ -6,7 +6,7 @@ EXPORT_TEMPLATES_DIR="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
# Update git submodules. # Update git submodules.
GODOT_DIR=${EXPORT_TEMPLATES_DIR}/godot GODOT_DIR=${EXPORT_TEMPLATES_DIR}/godot
if [ ! -d "$GODOT_DIR" ]; then if [ -z "$(ls -A -- "$GODOT_DIR")" ]; then
cd ${EXPORT_TEMPLATES_DIR} cd ${EXPORT_TEMPLATES_DIR}
git submodule update --init --recursive -- $GODOT_DIR git submodule update --init --recursive -- $GODOT_DIR
fi fi