Skip to content

Instantly share code, notes, and snippets.

@subsoap
Created April 13, 2019 15:29
Show Gist options
  • Save subsoap/9988daf87a39436811ebedeb57a3ce64 to your computer and use it in GitHub Desktop.
Save subsoap/9988daf87a39436811ebedeb57a3ce64 to your computer and use it in GitHub Desktop.
#!/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_sdk_128/sdk/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 a@a.com -u fake_token
}
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]"
read -p "Press enter to close"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment