3 # builds a Godot project with all its native export config options
4 ################################################################################
7 DIR_DEBUG=$DIR_BUILD/debug
8 DIR_RELEASE=$DIR_BUILD/release
9 DIR_PROJECT=`pwd`/project
11 GODOT="docker run -v${DIR_PROJECT}:${DIR_PROJECT} -v${DIR_BUILD}:${DIR_BUILD} cjpalmer/godot:0.1.0"
12 GODOT_OPTS="--headless --path $DIR_PROJECT"
13 EXPORT_PRESETS_CFG="$DIR_PROJECT/export_presets.cfg"
15 echo Godot version - $($GODOT --headless --version)
17 ################################################################################
18 # execute project build
20 # iterate through all build types present in config file
21 # if arg is given, override automated export discovery
26 EXPORT_NAMES=$(awk -F= '$1=="name"{print $2}' $EXPORT_PRESETS_CFG | sed 's/"//g')
29 for EXPORT_NAME in $EXPORT_NAMES
32 echo Starting project build for export $EXPORT_NAME
34 # create build folders
35 [[ -d $DIR_RELEASE/$EXPORT_NAME ]] || mkdir -p $DIR_RELEASE/$EXPORT_NAME
36 [[ -d $DIR_DEBUG/$EXPORT_NAME ]] || mkdir -p $DIR_DEBUG/$EXPORT_NAME
38 # get export name from config file
39 EXPORT_FNAME=$(awk -vname=${EXPORT_NAME} -F= \
40 '$1=="name" && $2~name{f=1} f==1 && $1=="export_path"{print $2;exit}' \
41 $EXPORT_PRESETS_CFG | sed -e 's|^.*/||' -e 's/"//g')
44 echo $GODOT $GODOT_OPTS --export-debug "$EXPORT_NAME" $DIR_DEBUG/$EXPORT_NAME/$EXPORT_FNAME
45 $GODOT $GODOT_OPTS --export-debug "$EXPORT_NAME" $DIR_DEBUG/$EXPORT_NAME/$EXPORT_FNAME
46 echo $GODOT $GODOT_OPTS --export-release "$EXPORT_NAME" $DIR_RELEASE/$EXPORT_NAME/$EXPORT_FNAME
47 $GODOT $GODOT_OPTS --export-release "$EXPORT_NAME" $DIR_RELEASE/$EXPORT_NAME/$EXPORT_FNAME