#!/bin/bash # builds a Godot project with all its native export config options ################################################################################ DIR_BUILD=`pwd`/build DIR_DEBUG=$DIR_BUILD/debug DIR_RELEASE=$DIR_BUILD/release DIR_PROJECT=`pwd`/project 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) ################################################################################ # execute project build # iterate through all build types present in config file # if arg is given, override automated export discovery if [[ -n "$1" ]] then EXPORT_NAMES=$1 else EXPORT_NAMES=$(awk -F= '$1=="name"{print $2}' $EXPORT_PRESETS_CFG | sed 's/"//g') fi 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