playwright/browser_patches/firefox-beta/archive.sh
Andrey Lushnikov af33d713ad
devops: fix Firefox-Beta build the same way we fix FF Stable (#16146)
Drive-by: add missing `ff-beta-ubuntu-20.04-arm64` build
2022-08-02 07:27:51 -07:00

62 lines
1.5 KiB
Bash
Executable File

#!/bin/bash
set -e
set +x
if [[ ("$1" == "-h") || ("$1" == "--help") ]]; then
echo "usage: $(basename "$0") [output-absolute-path]"
echo
echo "Generate distributable .zip archive from Firefox checkout folder that was previously built."
echo
exit 0
fi
ZIP_PATH=$1
if [[ $ZIP_PATH != /* ]]; then
echo "ERROR: path $ZIP_PATH is not absolute"
exit 1
fi
if [[ $ZIP_PATH != *.zip ]]; then
echo "ERROR: path $ZIP_PATH must have .zip extension"
exit 1
fi
if [[ -f $ZIP_PATH ]]; then
echo "ERROR: path $ZIP_PATH exists; can't do anything."
exit 1
fi
if ! [[ -d $(dirname "$ZIP_PATH") ]]; then
echo "ERROR: folder for path $($ZIP_PATH) does not exist."
exit 1
fi
trap "cd $(pwd -P)" EXIT
cd "$(dirname "$0")"
SCRIPT_FOLDER="$(pwd -P)"
source "${SCRIPT_FOLDER}/../utils.sh"
if [[ -z "${FF_CHECKOUT_PATH}" ]]; then
FF_CHECKOUT_PATH="$HOME/firefox"
fi
OBJ_FOLDER="${FF_CHECKOUT_PATH}/obj-build-playwright"
cd "${FF_CHECKOUT_PATH}"
export MH_BRANCH=mozilla-beta
export MOZ_BUILD_DATE=$(date +%Y%m%d%H%M%S)
./mach package
node "${SCRIPT_FOLDER}/install-preferences.js" "${OBJ_FOLDER}/dist/firefox"
if ! [[ -d "$OBJ_FOLDER/dist/firefox" ]]; then
echo "ERROR: cannot find $OBJ_FOLDER/dist/firefox folder in the firefox checkout. Did you build?"
exit 1;
fi
if is_win; then
# Bundle vcruntime14_1.dll - see https://github.com/microsoft/playwright/issues/9974
cd "$(printMSVCRedistDir)"
cp -t "${OBJ_FOLDER}/dist/firefox" vcruntime140_1.dll
fi
# tar resulting directory and cleanup TMP.
cd "${OBJ_FOLDER}/dist"
zip -r "$ZIP_PATH" firefox