跳到正文
cccskills
免费在 GitHub 公开

build-jj-workspace

Build, test, and lint Cadmus from a jj sibling workspace that has no .git (non-colocated checkout). Use when jj workspace root is a sibling tmp/agent workspace and builds fail with git submodule or .gitmodules errors, empty thirdparty/ sources, cache-marker misses, or missing sqlite.

中文简介正在准备中。当前显示原文说明。

查看安装方法

包含的文件(1)

  • SKILL.md4.8 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

Build Cadmus in a non-colocated jj workspace

Why a sibling workspace does not build out of the box

A jj sibling workspace (jj workspace add) is a separate working copy of the same repository with no .git. Two consequences break the build:

  • jj ignores git submodules, so every thirdparty/<lib> directory is empty (mupdf, libwebp, harfbuzz, sqlite, …).
  • Cadmus builds through build-deps, which needs git:
    • ensure_submodules runs git submodule update for cold artifacts.
    • markers runs git ls-tree HEAD thirdparty/<lib> to resolve submodule revisions for cache markers.

With no .git, both fail (fatal: not a git repository). Even a warm target/ is re-validated via git ls-tree, so it does not help. The fix is to give the build a git directory to read — without building in the colocated checkout.

Detect

ROOT="$(jj workspace root)"
COLOCATED="$(cd "$(jj workspace root --name default)" && pwd)"
test ! -e "$ROOT/.git" && echo non-colocated

Run every build, test, and lint command from $ROOT. jj workspace root is the workspace owning the current working copy (the sibling directory), not the default checkout. $COLOCATED is the default workspace — the one carrying .git.

The fix: point git at the colocated repo

Pass GIT_DIR (and GIT_WORK_TREE so submodules materialize into $ROOT) to the cargo invocation:

cd "$ROOT"
devenv shell -- env -u RUSTC_WRAPPER \
  GIT_DIR="$COLOCATED/.git" \
  GIT_WORK_TREE="$ROOT" \
  cadmuscli setup --host

cadmuscli setup --host initializes the submodules into $ROOT and builds SQLite under $ROOT/target/cadmus-build-deps/<host-triple>/sqlite/. Reuse the same git env for later checks:

cd "$ROOT"
devenv shell -- env GIT_DIR="$COLOCATED/.git" GIT_WORK_TREE="$ROOT" \
  cadmuscli test --features emulator

Scope GIT_DIR/GIT_WORK_TREE to the build commands; do not export them for the whole shell, and keep them off jj invocations.

Caveats

  • git ls-tree HEAD reads the colocated repo's HEAD, not $ROOT's @. Fine while both revisions record the same submodule gitlinks.
  • If a submodule step writes the git index, use a separate GIT_INDEX_FILE (see jj-vcs).
  • jj 0.45.x has no jj workspace add --colocate; the git-env approach is the supported path here.

Per-workspace target/

devenv sets CARGO_TARGET_DIR and PKG_CONFIG_PATH_* from config.devenv.root (the workspace you entered), so each workspace has its own target/. SQLite and the native deps (MuPDF, libwebp) build per workspace; the first build in a sibling workspace is a full native build.

sccache

devenv sets RUSTC_WRAPPER=sccache. If setup or a compile panics inside sccache, retry that command with env -u RUSTC_WRAPPER (shown above).

Checklist (in $ROOT)

  1. devenv shell -- cadmuscli docs --mdbook-only if the EPUB is missing.
  2. cadmuscli setup --host with GIT_DIR/GIT_WORK_TREE (above).
  3. devenv shell -- env GIT_DIR=… GIT_WORK_TREE=… cadmuscli test --features emulator.

A device feature (emulator) is required; see build-cadmus-native for the EPUB, feature, and daily-command details.

Expected noise

  • git-hooks.nix: skipping hook installation: not a git repository on devenv enter — expected.
  • No jj-pre-hook / git pre-commit here; see jj-commit.

Common mistakes

MistakeResultFix
Building in $ROOT without GIT_DIRnot a git repository, empty thirdparty/Pass GIT_DIR/GIT_WORK_TREE from $COLOCATED
Reusing colocated SQLITE3_* onlyNative deps still fail (empty thirdparty/)Materialize submodules via the git env
Assuming a shared target/Missing artifacts in the siblingEach workspace builds its own target/
cargo test without a device featurecompile_error! in cadmus-core--features emulator
Leaving GIT_DIR exported for jjgit-based tools read the wrong repoScope it to the build commands

Related skills

  • build-cadmus-native — EPUB, xtask commands, device features
  • jj-vcs — GIT_DIR / GIT_INDEX_FILE caveats for non-colocated workspaces
  • jj-commit — skip git pre-commit when .git is absent

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

Build Cadmus on Linux and macOS hosts using cadmuscli. Use when asked how to compile, test, lint, or run the project locally.

中文简介正在准备中。当前显示原文说明。

OGKevin/cadmus502026年10月23日 更新

Cross-compile Cadmus for Kobo e-reader devices (ARM Linux). Use this when asked to build a Kobo release, cross-compile for ARM, or prepare a device binary.

中文简介正在准备中。当前显示原文说明。

OGKevin/cadmus502026年10月23日 更新

Run clippy locally and report only issues in the current diff, matching the CI reviewdog flow. Use when asked how to lint changed code or get clippy feedback on a branch before pushing.

中文简介正在准备中。当前显示原文说明。

OGKevin/cadmus502026年10月23日 更新

Resolve failed Renovate or Dependabot dependency update PRs by fixing version constraints, API breaking changes, and verifying build/test/format compliance. Use when a dependency bump PR fails CI, Cargo cannot select versions, or a crate update requires code migration.

中文简介正在准备中。当前显示原文说明。

OGKevin/cadmus502026年10月23日 更新

docs

免费

Build the full Cadmus documentation website (mdBook + cargo doc + Storybook + Next.js). Use this when asked to build, preview, or update the documentation site.

中文简介正在准备中。当前显示原文说明。

OGKevin/cadmus502026年10月23日 更新

Fetch Cadmus application logs from Loki by run ID. Use when asked to look up logs for a specific run, debug a device session, or find log output for a given run ID.

中文简介正在准备中。当前显示原文说明。

OGKevin/cadmus502026年10月23日 更新

查看 OGKevin 的全部技能

报告此技能的问题