Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Rust installation to build script #231

Merged
merged 1 commit into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .PLAYWRIGHT_VERSION
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,9 @@
# In case the patches from this version do not apply cleanly, please open an issue!
# For advice on how to build foxhound with playwright support, see build.sh
PLAYWRIGHT_VERSION="v1.44.0"
# This tells the build script which rust version to download and install
# See here for the correct version mapping: https://firefox-source-docs.mozilla.org/writing-rust-code/update-policy.html
# also available in-tree here: docs/writing-rust-code/update-policy.md
RUST_VERSION="1.75.0"
# The current firefox version can be found here: browser/config/version.txt
FIREFOX_VERSION=$(cat browser/config/version.txt)
21 changes: 20 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ FOXHOUND_OBJ_DIR=
FOXHOUND_DIR=
PLAYWRIGHT_DIR=
PLAYWRIGHT_VERSION=
FIREFOX_VERSION=
RUST_VERSION=
WITH_PLAYWRIGHT_INTEGRATION=
NO_CLOBBER=
MAKE_GIT_COMMIT=
Expand Down Expand Up @@ -57,14 +59,20 @@ _make_git_commit() {
popd > /dev/null || exit 1
}

_prepare_playwright() {
_get_playwright_version() {
pushd "${FOXHOUND_DIR}" > /dev/null || _die "Can't change into foxhound dir: ${FOXHOUND_DIR}"
if [ ! -f "${CURRENT_DIR}/.PLAYWRIGHT_VERSION" ]; then
_die "Can not determine playwright version, as \".PLAYWRIGHT_VERSION\" file is missing. Please open an issue on Github!"
fi
# This file also contains the rust version
. "${CURRENT_DIR}/.PLAYWRIGHT_VERSION"
_status "Detected Firefox version: ${FIREFOX_VERSION}"
_status "Set playwright version to: ${PLAYWRIGHT_VERSION}"
_status "Required Rust version: ${RUST_VERSION}"
popd > /dev/null || exit 1
}

_prepare_playwright() {
_status "Fetching Playwright and checking out ${PLAYWRIGHT_VERSION} branch"
if [ -z "$DRY_RUN" ]; then
pushd "${PLAYWRIGHT_DIR}" > /dev/null || _die "Can't change into playwright dir: ${PLAYWRIGHT_DIR}"
Expand Down Expand Up @@ -119,6 +127,11 @@ _prepare_foxhound() {
if [ -z "$DRY_RUN" ]; then
./mach --no-interactive bootstrap --no-system-changes --application-choice=browser || _die "Bootstrapping failed! You can install dependencies manually and skip this step via the '-b' flag"
fi
_status "Installing Rust"
if [ -z "$DRY_RUN" ]; then
# This is the recommended way to install rust from https://www.rust-lang.org/tools/install
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain ${RUST_VERSION} || _die "Rust installation failed! You can install dependencies manually and skip this step via the '-b' flag"
fi
fi
popd > /dev/null || exit 1
}
Expand Down Expand Up @@ -182,6 +195,12 @@ _package_foxhound() {
main() {
FOXHOUND_DIR="${CURRENT_DIR}"
PLAYWRIGHT_DIR="${BASEDIR}/playwright"

_status "Starting Foxhound build in ${FOXHOUND_DIR}"

# First get playwright / rust versions
_get_playwright_version

if [ -z "$SKIP_PREPARATION" ] && [ -n "$WITH_PLAYWRIGHT_INTEGRATION" ] && [ ! -d "${PLAYWRIGHT_DIR}" ]; then
_checkout_playwright
fi
Expand Down
Loading