#!/bin/sh # Copy the hub's backdrop scenes into rust-core (E1 of the app's polish): # the pure Rust that moves the website's living backgrounds (OxygenHub # crates/backdrop: field, sky, mark, adrift, ripples, swarm, scene), with # none of its browser glue, so the phone draws the very same scenes. The hub # is their one source: never edit rust-core/src/backdrop by hand; change # them in the hub and run this again. # # scripts/sync-backdrop.sh [HUB_CHECKOUT] (default ../oxygenhub) set -eu cd "$(dirname "$0")/.." hub=${1:-../oxygenhub} src="$hub/crates/backdrop/src" [ -f "$src/sky.rs" ] || { echo "sync-backdrop: no $src/sky.rs (give the hub's checkout)" >&2; exit 1; } from=$(cd "$hub" && oxy --plain log -n 1 -r "$(oxy --plain status | sed -n 's/^On \([^ ]*\) .*/\1/p')" 2>/dev/null | sed -n '1s/^[^0-9a-f]*\([0-9a-f]\{8\}\).*/\1/p') out=rust-core/src/backdrop mkdir -p "$out" for f in field sky mark adrift ripples swarm scene; do { echo "// Copied from OxygenHub crates/backdrop/src/$f.rs (${from:-its main}) by" echo "// scripts/sync-backdrop.sh: change it there, never here." sed 's/crate::\(field\|sky\|scene\|mark\|adrift\|ripples\|swarm\)/crate::backdrop::\1/g' "$src/$f.rs" } > "$out/$f.rs" done cat > "$out/mod.rs" <<'MOD' //! The hub's backdrop scenes (OxygenHub crates/backdrop), copied by //! scripts/sync-backdrop.sh: the website's living backgrounds, stepped here //! and drawn by the app (ui/backdrop). #![allow(dead_code)] pub mod adrift; pub mod field; pub mod mark; pub mod ripples; pub mod scene; pub mod sky; pub mod swarm; MOD echo "sync-backdrop: copied 7 scenes from $hub (${from:-?})"