Improve robustness of packaging scripts.

This commit is contained in:
Paul Chote 2017-08-24 22:00:53 +01:00
parent 928ae7b336
commit fac25a869f
3 changed files with 16 additions and 23 deletions

View File

@ -28,14 +28,14 @@ if [ "${INCLUDE_DEFAULT_MODS}" = "True" ]; then
exit 1
fi
TAG="$1"
OUTPUTDIR=$(python -c "import os; print(os.path.realpath('$2'))")
BUILTDIR="${PACKAGING_DIR}/build"
PACKAGING_OSX_APP_NAME="OpenRA - ${PACKAGING_DISPLAY_NAME}.app"
# Set the working dir to the location of this script
cd "${PACKAGING_DIR}"
TAG="$1"
OUTPUTDIR="$2"
BUILTDIR="$(pwd)/build"
PACKAGING_OSX_APP_NAME="OpenRA - ${PACKAGING_DISPLAY_NAME}.app"
modify_plist() {
sed "s|$1|$2|g" "$3" > "$3.tmp" && mv "$3.tmp" "$3"
}
@ -87,10 +87,8 @@ modify_plist "{JOIN_SERVER_URL_SCHEME}" "openra-${MOD_ID}-${TAG}" "${PACKAGING_O
echo "Packaging zip archive"
zip "${PACKAGING_INSTALLER_NAME}-${TAG}" -r -9 "${PACKAGING_OSX_APP_NAME}" --quiet --symlinks
mv "${PACKAGING_INSTALLER_NAME}-${TAG}.zip" ${OUTPUTDIR}
zip "${PACKAGING_INSTALLER_NAME}-${TAG}.zip" -r -9 "${PACKAGING_OSX_APP_NAME}" --quiet --symlinks
mv "${PACKAGING_INSTALLER_NAME}-${TAG}.zip" "${OUTPUTDIR}"
popd > /dev/null
# Clean up

View File

@ -11,23 +11,18 @@ command -v make >/dev/null 2>&1 || { echo >&2 "The OpenRA mod template requires
command -v curl >/dev/null 2>&1 || { echo >&2 "The OpenRA mod template requires curl."; exit 1; }
command -v makensis >/dev/null 2>&1 || { echo >&2 "The OpenRA mod template requires makensis."; exit 1; }
# Set the working dir to the location of this script
cd "$(dirname $0)"
PACKAGING_DIR=$(python -c "import os; print(os.path.dirname(os.path.realpath('$0')))")
pushd windows >/dev/null
echo "Building Windows package"
./buildpackage.sh "$1" "$2"
${PACKAGING_DIR}/windows/buildpackage.sh "$1" "$2"
if [ $? -ne 0 ]; then
echo "Windows package build failed."
fi
popd >/dev/null
pushd osx >/dev/null
echo "Building macOS package"
./buildpackage.sh "$1" "$2"
${PACKAGING_DIR}/osx/buildpackage.sh "$1" "$2"
if [ $? -ne 0 ]; then
echo "macOS package build failed."
fi
popd >/dev/null
echo "Package build done."

View File

@ -26,13 +26,13 @@ if [ "${INCLUDE_DEFAULT_MODS}" = "True" ]; then
exit 1
fi
TAG="$1"
OUTPUTDIR=$(python -c "import os; print(os.path.realpath('$2'))")
BUILTDIR="${PACKAGING_DIR}/build"
# Set the working dir to the location of this script
cd "${PACKAGING_DIR}"
TAG="$1"
OUTPUTDIR="$2"
BUILTDIR="$(pwd)/build"
LAUNCHER_LIBS="-r:System.dll -r:System.Drawing.dll -r:System.Windows.Forms.dll -r:${BUILTDIR}/OpenRA.Game.exe"
echo "Building core files"
@ -73,12 +73,12 @@ rm "${BUILTDIR}/WindowsLauncher.cs"
mono "${SRC_DIR}/fixheader.exe" "${BUILTDIR}/${PACKAGING_WINDOWS_LAUNCHER_NAME}.exe" > /dev/null
echo "Building Windows setup.exe"
pushd "${PACKAGING_DIR}" > /dev/null
makensis -V2 -DSRCDIR="${BUILTDIR}" -DDEPSDIR="${SRC_DIR}/thirdparty/download/windows" -DTAG="${TAG}" -DMOD_ID="${MOD_ID}" -DPACKAGING_WINDOWS_INSTALL_DIR_NAME="${PACKAGING_WINDOWS_INSTALL_DIR_NAME}" -DPACKAGING_WINDOWS_LAUNCHER_NAME="${PACKAGING_WINDOWS_LAUNCHER_NAME}" -DPACKAGING_DISPLAY_NAME="${PACKAGING_DISPLAY_NAME}" -DPACKAGING_WEBSITE_URL="${PACKAGING_WEBSITE_URL}" -DPACKAGING_AUTHORS="${PACKAGING_AUTHORS}" -DPACKAGING_WINDOWS_REGISTRY_KEY="${PACKAGING_WINDOWS_REGISTRY_KEY}" buildpackage.nsi
if [ $? -eq 0 ]; then
mv OpenRA.Setup.exe "${OUTPUTDIR}/${PACKAGING_INSTALLER_NAME}-$TAG.exe"
else
exit 1
fi
popd > /dev/null
# Cleanup
rm -rf "${BUILTDIR}"