feat(servo): isolate profiles with hardware sidecars

This commit is contained in:
2026-07-09 20:27:22 -04:00
parent 78dc86b18e
commit c28ec2bee8
92 changed files with 10306 additions and 1485 deletions
+31 -3
View File
@@ -1,19 +1,47 @@
#!/usr/bin/env bash
set -euo pipefail
repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
binary_path="${repo_root}/target/debug/ely_app"
repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)"
cd "${repo_root}"
target_dir="${CARGO_TARGET_DIR:-${repo_root}/target}"
case "${target_dir}" in
/*|[A-Za-z]:[\\/]*) ;;
*) target_dir="${repo_root}/${target_dir}" ;;
esac
source "${repo_root}/scripts/release_build_env.sh"
ely_configure_release_build_env "${repo_root}" "${target_dir}"
unset CARGO_BUILD_TARGET
binary_path="${target_dir}/release/ely_app"
sidecar_path="${target_dir}/release/ely_servo_sidecar"
icon_path="${repo_root}/generated-icons/macos/AppIcon.icns"
bundle_root="${repo_root}/target/macos/ELY Browser.app"
contents_dir="${bundle_root}/Contents"
macos_dir="${contents_dir}/MacOS"
resources_dir="${contents_dir}/Resources"
cargo build -p ely_app
cargo build --release --locked --manifest-path "${repo_root}/Cargo.toml" --target-dir "${target_dir}" -p ely_app
cargo build --release --locked --manifest-path "${repo_root}/Cargo.toml" --target-dir "${target_dir}" -p ely_servo_host --features servo-engine,hardware-render --bin ely_servo_sidecar
rm -rf "${bundle_root}"
mkdir -p "${macos_dir}" "${resources_dir}"
cp "${repo_root}/packaging/macos/Info.plist" "${contents_dir}/Info.plist"
cp "${icon_path}" "${resources_dir}/AppIcon.icns"
cp "${binary_path}" "${macos_dir}/ely_app"
cp "${sidecar_path}" "${macos_dir}/ely_servo_sidecar"
chmod 755 "${macos_dir}/ely_app"
chmod 755 "${macos_dir}/ely_servo_sidecar"
"${repo_root}/scripts/verify_release_artifacts.sh" \
"${macos_dir}/ely_app" \
"${macos_dir}/ely_servo_sidecar"
codesign_identity="${ELY_CODESIGN_IDENTITY:--}"
codesign --force --sign "${codesign_identity}" --timestamp=none "${macos_dir}/ely_app"
codesign --force --sign "${codesign_identity}" --timestamp=none "${macos_dir}/ely_servo_sidecar"
codesign --force --sign "${codesign_identity}" --timestamp=none "${bundle_root}"
codesign --verify --deep --strict "${bundle_root}"
[[ -x "${macos_dir}/ely_app" ]] || { echo "missing app executable in ${macos_dir}" >&2; exit 1; }
[[ -x "${macos_dir}/ely_servo_sidecar" ]] || { echo "missing sidecar executable in ${macos_dir}" >&2; exit 1; }
[[ -f "${resources_dir}/AppIcon.icns" ]] || { echo "missing app icon in ${resources_dir}" >&2; exit 1; }
[[ ! -e "${resources_dir}/ely_servo_sidecar" ]] || { echo "sidecar must be placed in ${macos_dir}" >&2; exit 1; }
echo "${bundle_root}"
+60
View File
@@ -0,0 +1,60 @@
#!/usr/bin/env bash
set -euo pipefail
repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)"
cd "${repo_root}"
target_dir="${CARGO_TARGET_DIR:-${repo_root}/target}"
case "${target_dir}" in
/*|[A-Za-z]:[\\/]*) ;;
*) target_dir="${repo_root}/${target_dir}" ;;
esac
source "${repo_root}/scripts/release_build_env.sh"
ely_configure_release_build_env "${repo_root}" "${target_dir}"
unset CARGO_BUILD_TARGET
distribution_dir="${repo_root}/target/distribution/ely-browser"
binary_suffix=""
case "$(uname -s)" in
MINGW*|MSYS*|CYGWIN*) binary_suffix=".exe" ;;
esac
cargo build --release --locked --manifest-path "${repo_root}/Cargo.toml" --target-dir "${target_dir}" -p ely_app
sidecar_features="servo-engine"
if [[ "$(uname -s)" == "Darwin" ]]; then
sidecar_features="servo-engine,hardware-render"
fi
cargo build --release --locked --manifest-path "${repo_root}/Cargo.toml" --target-dir "${target_dir}" -p ely_servo_host --features "${sidecar_features}" --bin ely_servo_sidecar
rm -rf "${distribution_dir}"
mkdir -p "${distribution_dir}"
cp "${target_dir}/release/ely_app${binary_suffix}" "${distribution_dir}/"
cp "${target_dir}/release/ely_servo_sidecar${binary_suffix}" "${distribution_dir}/"
case "$(uname -s)" in
Darwin)
cp "${repo_root}/packaging/macos/Info.plist" "${distribution_dir}/"
cp "${repo_root}/generated-icons/macos/AppIcon.icns" "${distribution_dir}/"
;;
Linux)
cp "${repo_root}/packaging/linux/com.elydora.ely-browser.desktop" "${distribution_dir}/"
;;
MINGW*|MSYS*|CYGWIN*)
cp "${repo_root}/packaging/windows/ely_app.exe.manifest" "${distribution_dir}/"
;;
esac
if [[ -z "${binary_suffix}" ]]; then
chmod 755 "${distribution_dir}/ely_app" "${distribution_dir}/ely_servo_sidecar"
fi
app_output="${distribution_dir}/ely_app${binary_suffix}"
sidecar_output="${distribution_dir}/ely_servo_sidecar${binary_suffix}"
"${repo_root}/scripts/verify_release_artifacts.sh" "${app_output}" "${sidecar_output}"
[[ -f "${app_output}" ]] || { echo "missing app executable at ${app_output}" >&2; exit 1; }
[[ -f "${sidecar_output}" ]] || { echo "missing sidecar executable at ${sidecar_output}" >&2; exit 1; }
if [[ -z "${binary_suffix}" ]]; then
[[ -x "${app_output}" ]] || { echo "app is not executable: ${app_output}" >&2; exit 1; }
[[ -x "${sidecar_output}" ]] || { echo "sidecar is not executable: ${sidecar_output}" >&2; exit 1; }
fi
echo "${distribution_dir}"
+75
View File
@@ -0,0 +1,75 @@
#!/usr/bin/env bash
ely_append_encoded_rustflag() {
local flag="$1"
local separator=$'\x1f'
if [[ -n "${CARGO_ENCODED_RUSTFLAGS:-}" ]]; then
CARGO_ENCODED_RUSTFLAGS+="${separator}${flag}"
else
CARGO_ENCODED_RUSTFLAGS="${flag}"
fi
export CARGO_ENCODED_RUSTFLAGS
}
ely_path_variants() {
local path="$1"
local canonical_path=""
printf '%s\n' "${path}"
if [[ -d "${path}" ]]; then
canonical_path="$(cd "${path}" && pwd -P)"
if [[ "${canonical_path}" != "${path}" ]]; then
printf '%s\n' "${canonical_path}"
fi
fi
if command -v cygpath >/dev/null 2>&1; then
cygpath -m "${path}"
cygpath -w "${path}"
fi
}
ely_add_release_path_remap() {
local path="$1"
local replacement="$2"
local variant
while IFS= read -r variant; do
[[ -n "${variant}" ]] || continue
ely_append_encoded_rustflag "--remap-path-prefix=${variant}=${replacement}"
done < <(ely_path_variants "${path}")
}
ely_set_release_build_revision() {
local repo_root="$1"
local revision
if [[ -n "${ELY_BUILD_REVISION+x}" || ! -e "${repo_root}/.git" ]]; then
return 0
fi
revision="$(git -C "${repo_root}" rev-parse --short=12 HEAD)"
if [[ -n "$(git -C "${repo_root}" status --porcelain=v1 --untracked-files=normal)" ]]; then
revision+="-dirty"
fi
ELY_BUILD_REVISION="${revision}"
export ELY_BUILD_REVISION
}
ely_configure_release_build_env() {
local repo_root="$1"
local target_dir="$2"
local cargo_home="${CARGO_HOME:-${HOME}/.cargo}"
local rustup_home="${RUSTUP_HOME:-${HOME}/.rustup}"
local rust_sysroot
if [[ -n "${RUSTFLAGS:-}" ]]; then
echo "RUSTFLAGS cannot be combined safely with release path remapping; use CARGO_ENCODED_RUSTFLAGS" >&2
return 1
fi
ely_set_release_build_revision "${repo_root}"
rust_sysroot="$(rustc --print sysroot)"
ely_append_encoded_rustflag "--remap-path-scope=object"
ely_add_release_path_remap "${cargo_home}" "[cargo]"
ely_add_release_path_remap "${rustup_home}" "[rustup]"
ely_add_release_path_remap "${rust_sysroot}" "[rust-sysroot]"
ely_add_release_path_remap "${repo_root}" "."
ely_add_release_path_remap "${target_dir}" "[target]"
}
+33
View File
@@ -0,0 +1,33 @@
#!/usr/bin/env bash
set -euo pipefail
repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cd "${repo_root}"
target_dir="${CARGO_TARGET_DIR:-${repo_root}/target}"
case "${target_dir}" in
/*|[A-Za-z]:[\\/]*) ;;
*) target_dir="${repo_root}/${target_dir}" ;;
esac
unset CARGO_BUILD_TARGET
sidecar_features="servo-engine"
rendering_context="software"
binary_suffix=""
if [[ "$(uname -s)" == "Darwin" ]]; then
sidecar_features="servo-engine,hardware-render"
rendering_context="hardware"
fi
case "$(uname -s)" in
MINGW*|MSYS*|CYGWIN*) binary_suffix=".exe" ;;
esac
cargo build --locked --manifest-path "${repo_root}/Cargo.toml" --target-dir "${target_dir}" \
-p ely_servo_host \
--features "${sidecar_features}" \
--bin ely_servo_sidecar
export ELY_SERVO_SIDECAR="${target_dir}/debug/ely_servo_sidecar${binary_suffix}"
export ELY_SERVO_RENDERING_CONTEXT="${rendering_context}"
exec cargo run --locked --manifest-path "${repo_root}/Cargo.toml" \
--target-dir "${target_dir}" \
-p ely_app \
-- "$@"
+1
View File
@@ -28,6 +28,7 @@ assert_value() {
assert_value "CFBundleDisplayName" "ELY Browser"
assert_value "CFBundleName" "ELY Browser"
assert_value "CFBundleIdentifier" "com.elydora.ely-browser"
assert_value "CFBundleIconFile" "AppIcon"
assert_value "CFBundleGetInfoString" "ELY Browser by Elydora"
assert_value "CFBundleExecutable" "ely_app"
assert_value "CFBundlePackageType" "APPL"
+3 -1
View File
@@ -2,4 +2,6 @@
set -euo pipefail
echo "Verifying PRD live sites through the GPUI web surface adapter"
cargo test -p ely_app --features live-site-smoke --all-targets -- --test-threads=1 --nocapture
cargo build --locked -p ely_servo_host --features servo-engine --bin ely_servo_sidecar
ELY_SERVO_RENDERING_CONTEXT=software \
cargo test --locked -p ely_app --features live-site-smoke --all-targets -- --test-threads=1 --nocapture
+49
View File
@@ -0,0 +1,49 @@
#!/usr/bin/env bash
set -euo pipefail
repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)"
target_dir="${CARGO_TARGET_DIR:-${repo_root}/target}"
case "${target_dir}" in
/*|[A-Za-z]:[\\/]*) ;;
*) target_dir="${repo_root}/${target_dir}" ;;
esac
source "${repo_root}/scripts/release_build_env.sh"
[[ "$#" -gt 0 ]] || { echo "usage: $0 <release-artifact>..." >&2; exit 2; }
scan_value() {
local artifact="$1"
local label="$2"
local value="$3"
[[ -n "${value}" ]] || return 0
if LC_ALL=C grep -aFq -- "${value}" "${artifact}"; then
echo "release artifact contains ${label}: ${artifact}" >&2
return 1
fi
}
scan_path() {
local artifact="$1"
local label="$2"
local path="$3"
local variant
while IFS= read -r variant; do
scan_value "${artifact}" "${label}" "${variant}"
done < <(ely_path_variants "${path}")
}
cargo_home="${CARGO_HOME:-${HOME}/.cargo}"
rustup_home="${RUSTUP_HOME:-${HOME}/.rustup}"
rust_sysroot="$(rustc --print sysroot)"
for artifact in "$@"; do
[[ -f "${artifact}" ]] || { echo "missing release artifact: ${artifact}" >&2; exit 1; }
scan_path "${artifact}" "workspace path" "${repo_root}"
scan_path "${artifact}" "Cargo home path" "${cargo_home}"
scan_path "${artifact}" "Rustup home path" "${rustup_home}"
scan_path "${artifact}" "Rust sysroot path" "${rust_sysroot}"
scan_path "${artifact}" "target path" "${target_dir}"
scan_value "${artifact}" "embedded Metal source marker" "-frecord-sources=yes"
scan_value "${artifact}" "embedded Metal compiler command" "metal --driver-mode=metal"
done
+11 -4
View File
@@ -2,7 +2,7 @@
# T16 — real-window screencapture sanity check.
#
# Boots ./target/release/ely_app in the background, opens a live page through
# Servo's native surface path, captures the ELY window by its Core Graphics
# its profile-scoped Servo sidecar, captures the ELY window by its Core Graphics
# window ID, then asserts the PNG is non-trivial (size + dimensions + non-white
# center). Stderr from the app is
# tee'd to a log so a crash leaves evidence behind.
@@ -35,6 +35,7 @@ cleanup() {
# Stragglers from prior runs / child processes
pkill -f "target/release/ely_app" 2>/dev/null || true
pkill -x "ely_app" 2>/dev/null || true
pkill -x "ely_servo_sidecar" 2>/dev/null || true
}
trap cleanup EXIT INT TERM
@@ -51,17 +52,23 @@ fail() {
echo "[1/6] killing stale ely_app processes"
pkill -f "target/release/ely_app" 2>/dev/null || true
pkill -x "ely_app" 2>/dev/null || true
pkill -x "ely_servo_sidecar" 2>/dev/null || true
sleep 0.5
echo "[2/6] cargo build --release --locked -p ely_app"
echo "[2/6] building release app and Servo sidecar"
if ! cargo build --release --locked -p ely_app; then
fail "cargo build failed"
fail "app build failed"
fi
if ! cargo build --release --locked -p ely_servo_host --features servo-engine,hardware-render --bin ely_servo_sidecar; then
fail "Servo sidecar build failed"
fi
[[ -x "${APP_BIN}" ]] || fail "binary missing: ${APP_BIN}"
[[ -x "${REPO_ROOT}/target/release/ely_servo_sidecar" ]] || fail "sidecar binary missing"
echo "[3/6] launching ${APP_BIN} ${SMOKE_URL} (stderr -> ${STDERR_LOG})"
: > "${STDERR_LOG}"
"${APP_BIN}" "${SMOKE_URL}" >/dev/null 2>"${STDERR_LOG}" &
ELY_SERVO_RENDERING_CONTEXT=hardware \
"${APP_BIN}" "${SMOKE_URL}" >/dev/null 2>"${STDERR_LOG}" &
APP_PID=$!
echo " pid=${APP_PID}"