X-Git-Url: http://git.purplebirdman.com/godot.git/blobdiff_plain/6e00fb582fbc29998b3dba68045518ff48915aac..b9014ae536902147c3bc447e50b4ae9fc6a6e5cd:/script.sh?ds=sidebyside diff --git a/script.sh b/script.sh index 4ccff45..f1c0c39 100755 --- a/script.sh +++ b/script.sh @@ -1,52 +1,48 @@ #!/bin/bash -# gets a Godot release, fetches export templates, -# and builds a project with its native export options +# builds a Godot project with all its native export config options +################################################################################ -PWD=`pwd` -DIR_DOWNLOAD=$PWD/download -DIR_TEMPLATES=$DIR_DOWNLOAD/templates -DIR_DEBUG=$PWD/debug -DIR_RELEASE=$PWD/release -DIR_PROJECT=$PWD/project +DIR_BUILD=`pwd`/build +DIR_DEBUG=$DIR_BUILD/debug +DIR_RELEASE=$DIR_BUILD/release +DIR_PROJECT=`pwd`/project -GODOT_VERSION=4.4-stable -GODOT_ZIP=Godot_v${GODOT_VERSION}_linux.x86_64.zip -GODOT_EXE=Godot_v${GODOT_VERSION}_linux.x86_64 -GODOT_URI=https://github.com/godotengine/godot/releases/download/$GODOT_VERSION/$GODOT_ZIP - -GODOT_EXPORT_TEMPLATES=Godot_v${GODOT_VERSION}_export_templates.tpz -GODOT_TEMPLATE_URI=https://github.com/godotengine/godot/releases/download/$GODOT_VERSION/$GODOT_EXPORT_TEMPLATES - -GODOT=$DIR_DOWNLOAD/$GODOT_EXE - -# 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 +GODOT="docker run -v${DIR_PROJECT}:${DIR_PROJECT} -v${DIR_BUILD}:${DIR_BUILD} cjpalmer/godot:0.1.0" +GODOT_OPTS="--headless --path $DIR_PROJECT" +EXPORT_PRESETS_CFG="$DIR_PROJECT/export_presets.cfg" echo Godot version - $($GODOT --headless --version) -# 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 +################################################################################ +# execute project build -GODOT_TEMPLATE_VERSION=$(cat $DIR_TEMPLATES/version.txt) -LOCAL_TEMPLATES=$HOME/.local/share/godot/export_templates/$GODOT_TEMPLATE_VERSION -if [[ ! -d $LOCAL_TEMPLATES ]] +# iterate through all build types present in config file +# if arg is given, override automated export discovery +if [[ -n "$1" ]] then - mkdir -p $LOCAL_TEMPLATES - cp $DIR_TEMPLATES/* $LOCAL_TEMPLATES - # TODO: leaves extra stuff + EXPORT_NAMES=$1 +else + EXPORT_NAMES=$(awk -F= '$1=="name"{print $2}' $EXPORT_PRESETS_CFG | sed 's/"//g') fi -echo Godot export template version - $GODOT_TEMPLATE_VERSION -echo Local templates - $LOCAL_TEMPLATES - -# 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 +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