From b6f7cba09f8d3afc6efdd94b906f6b0b644fedb8 Mon Sep 17 00:00:00 2001 From: David Capello Date: Mon, 11 Nov 2024 13:06:03 -0300 Subject: [PATCH] Check submodules in build.sh --- build.sh | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/build.sh b/build.sh index 90d72ba14..326e1bf5b 100755 --- a/build.sh +++ b/build.sh @@ -22,7 +22,7 @@ echo "======================= BUILD ASEPRITE HELPER ========================" # Check that we are running the script from the Aseprite clone directory. pwd=$(pwd) -if [ ! -f "$pwd/README.md" ] ; then +if [[ ! -f "$pwd/EULA.txt" || ! -f "$pwd/.gitmodules" ]] ; then echo "" echo "Run build script from the Aseprite directory" exit 1 @@ -99,6 +99,44 @@ if ! ninja --version >/dev/null ; then exit 1 fi +# Check that all submodules are checked out. +run_submodule_update= +for module in $(cat "$pwd/.gitmodules" | \ + grep '^\[submodule' | \ + sed -e 's/^\[.*\"\(.*\)\"\]/\1/') \ + $(cat "$pwd/laf/.gitmodules" | \ + grep '^\[submodule' | \ + sed -e 's/^\[.*\"\(.*\)\"\]/laf\/\1/') ; do + if [[ ! -f "$module/CMakeLists.txt" && + ! -f "$module/Makefile" && + ! -f "$module/makefile" && + ! -f "$module/Makefile.am" ]] ; then + echo "" + echo "Module $module doesn't exist." + if [ $auto ] ; then + run_submodule_update=1 + break + else + echo "Run:" + echo "" + echo " git submodule update --init --recursive" + echo "" + exit 1 + fi + fi +done +if [ $run_submodule_update ] ; then + echo "Running:" + echo "" + echo " git submodule update --init --recursive" + echo "" + if ! git submodule update --init --recursive ; then + echo "Failed, try again" + exit 1 + fi + echo "Done" +fi + # Create the directory to store the configuration. if [ ! -d "$pwd/.build" ] ; then mkdir "$pwd/.build"