Created
April 28, 2020 09:53
-
-
Save subsoap/61bbbf62ddae33178f2283c79e4d5e1d to your computer and use it in GitHub Desktop.
Defold Build Script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
title=$(less game.project | grep "^title = " | cut -d "=" -f2 | sed -e 's/^[[:space:]]*//') | |
title_no_space=$(echo -e "${title}" | tr -d '[[:space:]]') | |
contentroot=C:/steamworks/tools/ContentBuilder/content/ | |
echo "Project: ${title}" | |
if [ ! -f bob.jar ] | |
then | |
echo "Unable to find bob.jar. Download it from d.defold.com." | |
exit 1 | |
fi | |
bob() { | |
java -Xmx4g -jar bob.jar $@ | |
} | |
build() { | |
platform=$1 | |
shift 1 | |
rm -rf build | |
bob --archive clean resolve build --build-report-html "build-report-${platform}.html" --texture-compression true --variant "release" --platform "${platform}" -e [email protected] -u fake_token --with-symbols | |
} | |
bundle() { | |
platform=$1 | |
echo "${platform}" | |
shift 1 | |
bob --platform ${platform} --bundle-output build/${platform} $@ bundle | |
} | |
move_to_steam() { | |
platform=$1 | |
if [ "${platform}" == "x86_64-darwin" ] | |
then | |
echo "${title_no_space}_${platform}" | |
echo "Removing old ${contentroot}${title_no_space}_${platform}" | |
rm -rf "${contentroot}${title_no_space}_${platform}" | |
if ! cd build/${platform} ; then read -p "Build folder ${platform} not found! - Press Enter"; exit 1; fi | |
mkdir -p "${contentroot}${title_no_space}_${platform}" | |
cp -r * "${contentroot}${title_no_space}_${platform}" | |
cd ../.. | |
else | |
echo "${title_no_space}_${platform}" | |
echo "Removing old ${contentroot}${title_no_space}_${platform}" | |
rm -rf "${contentroot}${title_no_space}_${platform}" | |
if ! cd "build/${platform}/${title}" ; then read -p "Build folder ${platform} not found! - Press Enter"; exit 1; fi | |
mkdir -p "${contentroot}${title_no_space}_${platform}" | |
cp -r * "${contentroot}${title_no_space}_${platform}" | |
cd ../../.. | |
fi | |
} | |
do_platform() { | |
platform=$1 | |
shift 1 | |
echo -e "\n[Building ${platform}]" | |
build ${platform} | |
echo -e "\n[Bundling ${platform}]" | |
bundle ${platform} | |
echo -e "\n[Moving to Steam ${platform}]" | |
move_to_steam ${platform} | |
echo -e "\n[${platform} Done]" | |
} | |
# build / bundle / archive platforms | |
do_platform x86_64-win32 | |
do_platform x86_64-linux | |
do_platform x86_64-darwin | |
# play some music to let us known it's done | |
ffplay fanfare.mp3 -autoexit -nodisp | |
echo -e "\n[All Done!! - You can now run upload_steam]" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment