Compare commits

..

2 Commits

5 changed files with 160 additions and 3 deletions

View File

@ -179,6 +179,12 @@ class AndroidEnvironment {
'_CARGOKIT_NDK_LINK_TARGET': targetArg,
'_CARGOKIT_NDK_LINK_CLANG': ccValue,
'CARGOKIT_TOOL_TEMP_DIR': toolTempDir,
// Expose the NDK root so that build scripts (e.g. ccc-crypto-wolfssl/build.rs)
// can pass it to cmake as CMAKE_ANDROID_NDK. Without this, cmake's
// Android-Determine.cmake fails with "Neither the NDK or a standalone
// toolchain was found" because cmake is invoked in an isolated env that
// does not inherit ANDROID_NDK_ROOT from the shell.
'ANDROID_NDK_ROOT': ndkPath,
};
}

4
rust/Cargo.lock generated
View File

@ -181,7 +181,7 @@ dependencies = [
[[package]]
name = "ccc-crypto-core"
version = "0.1.0"
source = "git+ssh://git@10.0.5.109/j3g/lum_ccc_rust.git?branch=trunk#cbad181ae625cc7cd21afcbe40afdaf865d9b19a"
source = "git+ssh://git@10.0.5.109/j3g/lum_ccc_rust.git?branch=trunk#80e0e65462bebeca0f0fe2e75a236049c8c37293"
dependencies = [
"log",
"once_cell",
@ -194,7 +194,7 @@ dependencies = [
[[package]]
name = "ccc-crypto-wolfssl"
version = "0.1.0"
source = "git+ssh://git@10.0.5.109/j3g/lum_ccc_rust.git?branch=trunk#cbad181ae625cc7cd21afcbe40afdaf865d9b19a"
source = "git+ssh://git@10.0.5.109/j3g/lum_ccc_rust.git?branch=trunk#80e0e65462bebeca0f0fe2e75a236049c8c37293"
dependencies = [
"argon2",
"bindgen",

View File

@ -7,10 +7,16 @@ edition = "2021"
crate-type = ["cdylib", "staticlib"]
[dependencies]
# Production / CI: resolve from the private git server.
# After pushing changes to lum_ccc_rust run:
# cargo update -p ccc-crypto-core -p ccc-crypto-wolfssl (in this directory)
# then commit the updated Cargo.lock.
ccc-crypto-core = { git = "ssh://git@10.0.5.109/j3g/lum_ccc_rust.git", branch = "trunk" }
ccc-crypto-wolfssl = { git = "ssh://git@10.0.5.109/j3g/lum_ccc_rust.git", branch = "trunk" }
# For local development, you can uncomment the following lines and comment out the git dependencies above:
# Local development: set CCC_LOCAL_DEV=1 and use `cargo build` directly
# (not through Flutter) to iterate without git fetches or lock-file churn.
# Switch by running: dev-sync.sh --local / --git (see scripts/dev-sync.sh)
# ccc-crypto-core = { path = "/Volumes/LUM/source/letusmsg_proj/app/lum_ccc_rust/crates/ccc-crypto-core" }
# ccc-crypto-wolfssl = { path = "/Volumes/LUM/source/letusmsg_proj/app/lum_ccc_rust/crates/ccc-crypto-wolfssl" }

86
scripts/dev-sync.sh Executable file
View File

@ -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

59
taskfile.yaml Normal file
View File

@ -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