MOD: new sync script and release task to make sure ccc_rust and this plugin are in sync, fskn rust cache cleared for local dev, no more stale BS
This commit is contained in:
parent
72132da690
commit
8221b211fa
|
|
@ -0,0 +1,86 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
# dev-sync.sh — manage the lum_ccc_rust dependency in lum_ccc_fplugin
|
||||||
|
#
|
||||||
|
# Usage:
|
||||||
|
# ./scripts/dev-sync.sh --update After pushing changes to lum_ccc_rust:
|
||||||
|
# updates Cargo.lock to the new HEAD of trunk
|
||||||
|
# and clears the Cargokit build cache.
|
||||||
|
#
|
||||||
|
# ./scripts/dev-sync.sh --local Switch Cargo.toml to path deps for fast
|
||||||
|
# local iteration (no git fetch, no lock churn).
|
||||||
|
#
|
||||||
|
# ./scripts/dev-sync.sh --git Switch Cargo.toml back to git deps for
|
||||||
|
# CI / Flutter builds.
|
||||||
|
#
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||||
|
PLUGIN_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
||||||
|
RUST_DIR="$PLUGIN_ROOT/rust"
|
||||||
|
FLUTTER_APP="${FLUTTER_APP:-/Volumes/LUM/source/letusmsg_proj/app/letusmsg_app/flutter_src}"
|
||||||
|
CARGOKIT_BUILD_CACHE="$FLUTTER_APP/build/ccc_cryptography"
|
||||||
|
|
||||||
|
CARGO_TOML="$RUST_DIR/Cargo.toml"
|
||||||
|
LOCAL_CORE_PATH="/Volumes/LUM/source/letusmsg_proj/app/lum_ccc_rust/crates/ccc-crypto-core"
|
||||||
|
LOCAL_WOLFSSL_PATH="/Volumes/LUM/source/letusmsg_proj/app/lum_ccc_rust/crates/ccc-crypto-wolfssl"
|
||||||
|
GIT_URL="ssh://git@10.0.5.109/j3g/lum_ccc_rust.git"
|
||||||
|
GIT_BRANCH="trunk"
|
||||||
|
|
||||||
|
usage() {
|
||||||
|
sed -n '/^# Usage:/,/^[^#]/p' "$0" | grep '^#' | sed 's/^# \?//'
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
cmd_update() {
|
||||||
|
echo "==> Fetching latest $GIT_BRANCH from $GIT_URL ..."
|
||||||
|
cd "$RUST_DIR"
|
||||||
|
cargo update -p ccc-crypto-core -p ccc-crypto-wolfssl
|
||||||
|
NEW_HASH="$(grep -A2 'name = "ccc-crypto-wolfssl"' Cargo.lock | grep -o '#[a-f0-9]*' | head -1)"
|
||||||
|
|
||||||
|
if [ -d "$CARGOKIT_BUILD_CACHE" ]; then
|
||||||
|
echo "==> Clearing Cargokit build cache at $CARGOKIT_BUILD_CACHE ..."
|
||||||
|
rm -rf "$CARGOKIT_BUILD_CACHE"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Collect all changed files relative to plugin root
|
||||||
|
cd "$PLUGIN_ROOT"
|
||||||
|
CHANGED="$(git diff --name-only HEAD)"
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "================================================================================"
|
||||||
|
echo " NEXT: commit and push lum_ccc_fplugin for changes to take effect"
|
||||||
|
echo "================================================================================"
|
||||||
|
}
|
||||||
|
|
||||||
|
cmd_local() {
|
||||||
|
echo "==> Switching to path dependencies (local dev mode) ..."
|
||||||
|
# Comment out git deps, uncomment path deps
|
||||||
|
sed -i '' \
|
||||||
|
-e 's|^ccc-crypto-core = { git = .*|# ccc-crypto-core = { git = "'"$GIT_URL"'", branch = "'"$GIT_BRANCH"'" }|' \
|
||||||
|
-e 's|^ccc-crypto-wolfssl = { git = .*|# ccc-crypto-wolfssl = { git = "'"$GIT_URL"'", branch = "'"$GIT_BRANCH"'" }|' \
|
||||||
|
-e 's|^# ccc-crypto-core = { path = |ccc-crypto-core = { path = |' \
|
||||||
|
-e 's|^# ccc-crypto-wolfssl = { path = |ccc-crypto-wolfssl = { path = |' \
|
||||||
|
"$CARGO_TOML"
|
||||||
|
echo "==> Done. Cargo.toml now uses local path deps."
|
||||||
|
echo " Run 'cargo build' directly in $RUST_DIR for fast iteration."
|
||||||
|
echo " Run '$0 --git' to switch back before committing."
|
||||||
|
}
|
||||||
|
|
||||||
|
cmd_git() {
|
||||||
|
echo "==> Switching back to git dependencies ..."
|
||||||
|
sed -i '' \
|
||||||
|
-e 's|^# ccc-crypto-core = { git = |ccc-crypto-core = { git = |' \
|
||||||
|
-e 's|^# ccc-crypto-wolfssl = { git = |ccc-crypto-wolfssl = { git = |' \
|
||||||
|
-e 's|^ccc-crypto-core = { path = |# ccc-crypto-core = { path = |' \
|
||||||
|
-e 's|^ccc-crypto-wolfssl = { path = |# ccc-crypto-wolfssl = { path = |' \
|
||||||
|
"$CARGO_TOML"
|
||||||
|
echo "==> Done. Cargo.toml now uses git deps."
|
||||||
|
echo " Run '$0 --update' if you want to pull the latest trunk commit."
|
||||||
|
}
|
||||||
|
|
||||||
|
case "${1:-}" in
|
||||||
|
--update) cmd_update ;;
|
||||||
|
--local) cmd_local ;;
|
||||||
|
--git) cmd_git ;;
|
||||||
|
*) usage ;;
|
||||||
|
esac
|
||||||
|
|
@ -0,0 +1,59 @@
|
||||||
|
version: "3"
|
||||||
|
silent: true # This makes all tasks silent by default
|
||||||
|
|
||||||
|
vars:
|
||||||
|
FLUTTER_APP: "{{.FLUTTER_APP | default \"/Volumes/LUM/source/letusmsg_proj/app/letusmsg_app/flutter_src\"}}"
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
|
||||||
|
# ── Dependency sync ──────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
sync:
|
||||||
|
desc: "Update Cargo.lock to latest trunk of lum_ccc_rust and clear build cache"
|
||||||
|
summary: |
|
||||||
|
Run this after pushing changes to lum_ccc_rust.
|
||||||
|
Updates rust/Cargo.lock to the new HEAD commit and clears the
|
||||||
|
Cargokit build cache so the next Flutter build picks up the changes.
|
||||||
|
Then commit and push lum_ccc_fplugin.
|
||||||
|
cmds:
|
||||||
|
- ./scripts/dev-sync.sh --update
|
||||||
|
|
||||||
|
local:
|
||||||
|
desc: "Switch Cargo.toml to local path deps (fast dev iteration)"
|
||||||
|
summary: |
|
||||||
|
Switches ccc-crypto-core and ccc-crypto-wolfssl to path deps pointing
|
||||||
|
at your local lum_ccc_rust checkout. Use for rapid iteration without
|
||||||
|
git fetch round-trips. Run 'task git' to switch back before committing.
|
||||||
|
cmds:
|
||||||
|
- ./scripts/dev-sync.sh --local
|
||||||
|
|
||||||
|
git:
|
||||||
|
desc: "Switch Cargo.toml back to git deps (CI / Flutter builds)"
|
||||||
|
cmds:
|
||||||
|
- ./scripts/dev-sync.sh --git
|
||||||
|
|
||||||
|
# ── Build cache ──────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
clean:cache:
|
||||||
|
desc: "Clear Cargokit Flutter build cache for ccc_cryptography"
|
||||||
|
cmds:
|
||||||
|
- |
|
||||||
|
CACHE="{{.FLUTTER_APP}}/build/ccc_cryptography"
|
||||||
|
if [ -d "$CACHE" ]; then
|
||||||
|
rm -rf "$CACHE"
|
||||||
|
echo "Cleared: $CACHE"
|
||||||
|
else
|
||||||
|
echo "Nothing to clear at $CACHE"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# ── Release ──────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
release:
|
||||||
|
desc: "Commit updated Cargo.lock and push lum_ccc_fplugin"
|
||||||
|
summary: |
|
||||||
|
Run after 'task sync'. Stages Cargo.lock and android_environment.dart,
|
||||||
|
commits with a standard message, and pushes.
|
||||||
|
cmds:
|
||||||
|
- git add rust/Cargo.lock
|
||||||
|
- "git diff --cached --quiet || git commit -m 'MOD: sync Cargo.lock to latest lum_ccc_rust trunk'"
|
||||||
|
- git push gitea trunk
|
||||||
Loading…
Reference in New Issue