]> Untitled Git - godot.git/commitdiff
Exports according to config file
authorClifton Palmer <clifton.james.palmer@protonmail.com>
Sun, 9 Mar 2025 10:27:25 +0000 (05:27 -0500)
committerClifton Palmer <clifton.james.palmer@protonmail.com>
Sun, 9 Mar 2025 10:27:25 +0000 (05:27 -0500)
.gitignore
script.sh

index 32d49da287b12e970c4d2bfd685fd73c477c4778..84fd956c5cb420332830975a566bc9dc8f3f1fcb 100644 (file)
@@ -2,3 +2,4 @@ download/
 project/
 debug/
 release/
 project/
 debug/
 release/
+*.swp
index 4ccff458ac78cb5ecca27d91ea5b8358816d4cf6..ce9cd20622d542e2f153a69053b5c6f668e6fd77 100755 (executable)
--- a/script.sh
+++ b/script.sh
@@ -3,6 +3,7 @@
 # gets a Godot release, fetches export templates, 
 # and builds a project with its native export options
 
 # gets a Godot release, fetches export templates, 
 # and builds a project with its native export options
 
+################################################################################
 PWD=`pwd`
 DIR_DOWNLOAD=$PWD/download
 DIR_TEMPLATES=$DIR_DOWNLOAD/templates
 PWD=`pwd`
 DIR_DOWNLOAD=$PWD/download
 DIR_TEMPLATES=$DIR_DOWNLOAD/templates
@@ -20,14 +21,18 @@ GODOT_TEMPLATE_URI=https://github.com/godotengine/godot/releases/download/$GODOT
 
 GODOT=$DIR_DOWNLOAD/$GODOT_EXE
 
 
 GODOT=$DIR_DOWNLOAD/$GODOT_EXE
 
+################################################################################
 # get Godot
 # get Godot
+
 [[ -d $DIR_DOWNLOAD ]] || mkpath -p $DIR_DOWNLOAD 
 [[ -f $DIR_DOWNLOAD/$GODOT_ZIP ]] || wget -P $DIR_DOWNLOAD $GODOT_URI
 [[ -f $DIR_DOWNLOAD/$GODOT_EXE ]] || unzip $DIR_DOWNLOAD/$GODOT_ZIP -d $DIR_DOWNLOAD
 
 echo Godot version - $($GODOT --headless --version)
 
 [[ -d $DIR_DOWNLOAD ]] || mkpath -p $DIR_DOWNLOAD 
 [[ -f $DIR_DOWNLOAD/$GODOT_ZIP ]] || wget -P $DIR_DOWNLOAD $GODOT_URI
 [[ -f $DIR_DOWNLOAD/$GODOT_EXE ]] || unzip $DIR_DOWNLOAD/$GODOT_ZIP -d $DIR_DOWNLOAD
 
 echo Godot version - $($GODOT --headless --version)
 
+################################################################################
 # get export templates
 # get export templates
+
 [[ -f $DIR_DOWNLOAD/$GODOT_EXPORT_TEMPLATES ]] || wget -P $DIR_DOWNLOAD $GODOT_TEMPLATE_URI
 [[ -d $DIR_TEMPLATES ]] || unzip -d $DIR_DOWNLOAD $DIR_DOWNLOAD/$GODOT_EXPORT_TEMPLATES
 
 [[ -f $DIR_DOWNLOAD/$GODOT_EXPORT_TEMPLATES ]] || wget -P $DIR_DOWNLOAD $GODOT_TEMPLATE_URI
 [[ -d $DIR_TEMPLATES ]] || unzip -d $DIR_DOWNLOAD $DIR_DOWNLOAD/$GODOT_EXPORT_TEMPLATES
 
@@ -37,16 +42,37 @@ if [[ ! -d $LOCAL_TEMPLATES ]]
 then
     mkdir -p $LOCAL_TEMPLATES
     cp $DIR_TEMPLATES/* $LOCAL_TEMPLATES
 then
     mkdir -p $LOCAL_TEMPLATES
     cp $DIR_TEMPLATES/* $LOCAL_TEMPLATES
-    # TODO: leaves extra stuff
+    # TODO: leaves extra copy of templates
 fi
 
 echo Godot export template version - $GODOT_TEMPLATE_VERSION
 echo Local templates - $LOCAL_TEMPLATES
 
 fi
 
 echo Godot export template version - $GODOT_TEMPLATE_VERSION
 echo Local templates - $LOCAL_TEMPLATES
 
+################################################################################
 # execute project build
 # execute project build
-PLATFORM=macOS
-[[ -d $DIR_RELEASE/$PLATFORM ]] || mkdir -p $DIR_RELEASE/$PLATFORM
-[[ -d $DIR_DEBUG/$PLATFORM ]] || mkdir -p $DIR_DEBUG/$PLATFORM
 
 
-echo Starting project build
-$GODOT --headless --export-debug --path $DIR_PROJECT $PLATFORM $DIR_DEBUG/$PLATFORM/wolf-seeking-sheep.dmg
+# iterate through all build types present in config file
+EXPORT_PRESETS_CFG=$DIR_PROJECT/export_presets.cfg
+EXPORT_NAMES=$(awk -F= '$1=="name"{print $2}' $EXPORT_PRESETS_CFG | sed 's/"//g')
+GODOT_OPTS="--headless --path $DIR_PROJECT"
+
+for EXPORT_NAME in $EXPORT_NAMES
+do
+    echo
+    echo Starting project build for export $EXPORT_NAME
+
+    # create build folders
+    [[ -d $DIR_RELEASE/$EXPORT_NAME ]] || mkdir -p $DIR_RELEASE/$EXPORT_NAME
+    [[ -d $DIR_DEBUG/$EXPORT_NAME ]] || mkdir -p $DIR_DEBUG/$EXPORT_NAME
+
+    # get export name from config file
+    EXPORT_FNAME=$(awk -vname=${EXPORT_NAME} -F= \
+        '$1=="name" && $2~name{f=1} f==1 && $1=="export_path"{print $2;exit}' \
+        $EXPORT_PRESETS_CFG | sed -e 's|^.*/||' -e 's/"//g')
+
+    # do build!
+    echo $GODOT $GODOT_OPTS --export-debug "$EXPORT_NAME" $DIR_DEBUG/$EXPORT_NAME/$EXPORT_FNAME
+    $GODOT $GODOT_OPTS --export-debug "$EXPORT_NAME" $DIR_DEBUG/$EXPORT_NAME/$EXPORT_FNAME
+    echo $GODOT $GODOT_OPTS --export-release "$EXPORT_NAME" $DIR_RELEASE/$EXPORT_NAME/$EXPORT_FNAME
+    $GODOT $GODOT_OPTS --export-release "$EXPORT_NAME" $DIR_RELEASE/$EXPORT_NAME/$EXPORT_FNAME
+done