mirror of
https://github.com/marcoallegretti/WEFT_OS.git
synced 2026-11-22 08:13:59 +00:00
chore: add cloud SessionStart hook and fix compositor clippy lint
The hook installs system packages and the pinned Rust toolchains, and links sibling servo/stylo checkouts via local cargo [patch] overrides. Also collapse a nested if in the winit backend that failed clippy::collapsible_if under -D warnings. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QS8QcxvhVJwU3X2qhPamUW
This commit is contained in:
parent
b99cc73a47
commit
c9c77886e2
3 changed files with 90 additions and 4 deletions
74
.claude/hooks/session-start.sh
Executable file
74
.claude/hooks/session-start.sh
Executable file
|
|
@ -0,0 +1,74 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# SessionStart hook for Claude Code cloud sessions.
|
||||||
|
# Installs system packages and Rust toolchains for WEFT_OS, and, when the
|
||||||
|
# servo and stylo forks are cloned next to this repo, wires them together
|
||||||
|
# with local cargo [patch] overrides.
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
if [ "${CLAUDE_CODE_REMOTE:-}" != "true" ]; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
WEFT_DIR="${CLAUDE_PROJECT_DIR:-$(cd "$(dirname "$0")/../.." && pwd)}"
|
||||||
|
PARENT_DIR="$(dirname "$WEFT_DIR")"
|
||||||
|
SERVO_DIR="$PARENT_DIR/servo"
|
||||||
|
STYLO_DIR="$PARENT_DIR/stylo"
|
||||||
|
|
||||||
|
# System packages: WEFT CI set plus what Servo needs to build.
|
||||||
|
APT_PKGS=(
|
||||||
|
libwayland-dev libxkbcommon-dev libegl-dev libgles2-mesa-dev libgbm-dev
|
||||||
|
libdrm-dev libinput-dev libseat-dev libudev-dev libsystemd-dev
|
||||||
|
libdisplay-info-dev libfontconfig-dev libfreetype-dev libharfbuzz-dev
|
||||||
|
libx11-dev libxcursor-dev libxrandr-dev libxi-dev libssl-dev libdbus-1-dev
|
||||||
|
llvm-dev libclang-dev lld clang cmake ninja-build pkg-config m4 python3
|
||||||
|
libunwind-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev
|
||||||
|
libgstreamer-plugins-bad1.0-dev gstreamer1.0-plugins-base
|
||||||
|
)
|
||||||
|
missing=()
|
||||||
|
for p in "${APT_PKGS[@]}"; do
|
||||||
|
dpkg -s "$p" >/dev/null 2>&1 || missing+=("$p")
|
||||||
|
done
|
||||||
|
if [ ${#missing[@]} -gt 0 ]; then
|
||||||
|
export DEBIAN_FRONTEND=noninteractive
|
||||||
|
apt-get update -q
|
||||||
|
apt-get install -y --no-install-recommends "${missing[@]}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Rust toolchains pinned by each repo's rust-toolchain.toml.
|
||||||
|
rustup toolchain install 1.93.0 --profile minimal -c clippy,rustfmt
|
||||||
|
if [ -d "$SERVO_DIR" ]; then
|
||||||
|
rustup toolchain install "$(sed -n 's/^channel = "\(.*\)"/\1/p' "$SERVO_DIR/rust-toolchain.toml")" \
|
||||||
|
--profile minimal -c clippy,rustfmt,llvm-tools,rustc-dev,rust-src
|
||||||
|
fi
|
||||||
|
|
||||||
|
# WEFT pins servo's `servo-weft` branch; make sure it is available locally.
|
||||||
|
if [ -d "$SERVO_DIR/.git" ]; then
|
||||||
|
git -C "$SERVO_DIR" rev-parse --verify -q origin/servo-weft >/dev/null ||
|
||||||
|
git -C "$SERVO_DIR" fetch --depth=50 origin servo-weft:refs/remotes/origin/servo-weft || true
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Point WEFT at the local servo fork and WEFT + servo at the local stylo fork.
|
||||||
|
# These patches rewrite Cargo.lock `source` lines; don't commit those hunks.
|
||||||
|
if [ -d "$SERVO_DIR" ] && [ -d "$STYLO_DIR" ]; then
|
||||||
|
mkdir -p "$PARENT_DIR/.cargo"
|
||||||
|
cat > "$PARENT_DIR/.cargo/config.toml" <<CFG
|
||||||
|
# Generated by WEFT_OS/.claude/hooks/session-start.sh. Delete to build
|
||||||
|
# against the git pins. Don't commit the Cargo.lock changes this causes.
|
||||||
|
[patch."https://github.com/marcoallegretti/servo"]
|
||||||
|
servo = { path = "$SERVO_DIR/components/servo" }
|
||||||
|
|
||||||
|
[patch."https://github.com/servo/stylo"]
|
||||||
|
selectors = { path = "$STYLO_DIR/selectors" }
|
||||||
|
servo_arc = { path = "$STYLO_DIR/servo_arc" }
|
||||||
|
stylo = { path = "$STYLO_DIR/style" }
|
||||||
|
stylo_atoms = { path = "$STYLO_DIR/stylo_atoms" }
|
||||||
|
stylo_dom = { path = "$STYLO_DIR/stylo_dom" }
|
||||||
|
stylo_malloc_size_of = { path = "$STYLO_DIR/malloc_size_of" }
|
||||||
|
stylo_static_prefs = { path = "$STYLO_DIR/stylo_static_prefs" }
|
||||||
|
stylo_traits = { path = "$STYLO_DIR/style_traits" }
|
||||||
|
CFG
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Prefetch WEFT dependencies so builds and tests work offline-ish.
|
||||||
|
cd "$WEFT_DIR"
|
||||||
|
cargo fetch
|
||||||
14
.claude/settings.json
Normal file
14
.claude/settings.json
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
{
|
||||||
|
"hooks": {
|
||||||
|
"SessionStart": [
|
||||||
|
{
|
||||||
|
"hooks": [
|
||||||
|
{
|
||||||
|
"type": "command",
|
||||||
|
"command": "$CLAUDE_PROJECT_DIR/.claude/hooks/session-start.sh"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -157,10 +157,8 @@ pub fn run() -> anyhow::Result<()> {
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if render_ok {
|
if render_ok && let Err(e) = backend.submit(Some(&[full_damage])) {
|
||||||
if let Err(e) = backend.submit(Some(&[full_damage])) {
|
tracing::warn!(?e, "backend submit failed");
|
||||||
tracing::warn!(?e, "backend submit failed");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
state.space.elements().for_each(|window| {
|
state.space.elements().for_each(|window| {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue