Skip to content
This repository was archived by the owner on Nov 12, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 6 additions & 13 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
# NOTE: this file deliberately does *not* set TWIG_SYS_FORCE_SOURCE. twig-sys
# links the prebuilt libtwig.a shipped by its `twig-sys-<target>` payload crate,
# which needs no Zig toolchain — that is what a consumer of leaf gets, so it is
# what CI and everyday builds should exercise too. Forcing the source build here
# was a leftover from when leaf pinned twig through its own [patch.crates-io];
# it made every machine, CI included, shell out to `zig`, and it is why the
# Swift-bindings job failed on a runner with no Zig on PATH.
#
# To build against the sibling twig checkout instead, use the org-wide switch:
# copy ~/diaryx/.cargo/patches.toml to ~/diaryx/.cargo/config.toml, uncomment
# `twig-doc`, and set TWIG_SYS_FORCE_SOURCE=1 in that (untracked) file or in the
# environment. Cargo merges config from every ancestor directory, so it reaches
# this checkout without a tracked file changing.
# NOTE: this file deliberately patches nothing. To build against the sibling
# twig checkout instead, use the org-wide switch: copy
# ~/diaryx/.cargo/patches.toml to ~/diaryx/.cargo/config.toml and uncomment
# `twig-doc` and the language crates (that untracked file). Cargo merges config
# from every ancestor directory, so it reaches this checkout without a tracked
# file changing.

# `cargo xtask <task>` — the workspace task runner (xtask/). It builds and runs
# the frontends whose build leaves Rust (the Apple app over packages/leaf-swift,
Expand Down
17 changes: 4 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,10 @@ jobs:
# Rehearse the release build. homebrew.yml cross-compiles `leaf-tui` to these
# four targets on a `v*.*.*` tag, and until this job existed none of it was
# exercised until the tag was already pushed — the repo's Rust code was never
# built in CI at all. Two things here are only ever wrong on a cross target:
#
# - The Zig fallback. twig-doc -> twig-sys ships prebuilt payloads for
# aarch64-apple-darwin, x86_64-unknown-linux-gnu, aarch64-unknown-linux-gnu,
# x86_64-pc-windows-msvc, and wasm32. `macos-x86_64` is not on that list, so
# that leg alone compiles libtwig.a from vendored Zig source.
# - The toolchain. leaf pins 1.98.1 in rust-toolchain.toml, and a toolchain
# file outranks whatever `rustup default` was set to — so targets have to be
# added to the *resolved* toolchain, not to `stable`.
# built in CI at all. The thing here that is only ever wrong on a cross target
# is the toolchain: leaf pins 1.98.1 in rust-toolchain.toml, and a toolchain
# file outranks whatever `rustup default` was set to — so targets have to be
# added to the *resolved* toolchain, not to `stable`.
#
# Which is why this installs the target with a bare `rustup target add` from
# inside the checkout rather than naming a version: rustup reads
Expand Down Expand Up @@ -78,10 +73,6 @@ jobs:
cross-linker: aarch64-linux-gnu-gcc
steps:
- uses: actions/checkout@v7
# Matches homebrew.yml's `zig-version`, and the version twig-sys's vendored
# build.zig expects.
- uses: mlugg/setup-zig@v2
with: { version: "0.17.0" }
- name: Add the target to the pinned toolchain
run: rustup target add ${{ matrix.target }}
- name: Install cross linker
Expand Down
10 changes: 0 additions & 10 deletions .github/workflows/homebrew.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,6 @@ name: Homebrew
# until a tag is pushed. Keep this in step with rust-toolchain.toml; ci.yml
# builds with the file, so a drift shows up there first.
#
# `needs-zig: true` because leaf depends on twig-doc -> twig-sys, which ships
# prebuilt payload crates for aarch64-apple-darwin, x86_64-unknown-linux-gnu,
# aarch64-unknown-linux-gnu, x86_64-pc-windows-msvc, and wasm32 — and for
# nothing else. The `macos-x86_64` leg of the matrix is not on that list, so its
# build.rs falls back to compiling libtwig.a from the vendored Zig source. One
# of the four legs needs a Zig toolchain; the other three ignore it.
#
# No `wasi:` — leaf is a terminal editor that wants a tty, a clipboard, and a
# graphics protocol. A wasm32-wasip1 build would compile and be useless.
#
Expand All @@ -45,9 +38,6 @@ jobs:
language: rust
cargo-package: leaf-tui
rust-toolchain: "1.98.1"
needs-zig: true
# Matches ci.yml's setup-zig: twig 4.0.1 builds from source only with 0.17.0.
zig-version: "0.17.0"
secrets:
TAP_APP_ID: ${{ secrets.TAP_APP_ID }}
TAP_APP_KEY: ${{ secrets.TAP_APP_KEY }}
75 changes: 48 additions & 27 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 13 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,19 @@ repository = "https://github.com/diaryx-org/leaf"
readme = "README.md"

[workspace.dependencies]
# The document AST + offset-addressed span-splice editor.
twig-doc = "4.1.0"
# The document AST + offset-addressed span-splice editor. twig is pure Rust
# since 6.0, and its core names no language: each one leaf opens is a crate
# that registers itself with twig on first use (`twig_markdown::format()`), and
# leaf's own `leaf_core::Format` is what picks among them. Without twig-doc's
# default `fig` feature: that is `twig::meta` (frontmatter read and edited
# through fig, and a document's `twig:` key obeyed), which leaf never asks for,
# and it would bring fig's YAML, TOML, JSON and figl parsers with it.
twig-doc = { version = "6", default-features = false }
twig-markdown = "6"
twig-djot = "6"
twig-html = "6"
twig-asciidoc = "6"
twig-xml = "6"
# The CSS inside a `style` attribute: the presentation vocabulary is written
# there, so another app renders it, and every edit to it keeps the declarations
# leaf did not write. Shared with thorn, which edits an SVG's `style` the same way.
Expand Down
73 changes: 46 additions & 27 deletions apps/leaf-dioxus/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 0 additions & 25 deletions apps/leaf-editor/ci_scripts/ci_post_clone.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
set -euo pipefail

ROOT="${CI_PRIMARY_REPOSITORY_PATH:?ci_post_clone.sh must run under Xcode Cloud}"
ZIG_VERSION="0.16.0" # twig's minimum_zig_version

echo "▸ Repository: $ROOT"
echo "▸ Platform: ${CI_PRODUCT_PLATFORM:-unknown}"
Expand All @@ -43,30 +42,6 @@ rustc --version
echo "▸ Adding Rust targets…"
rustup target add aarch64-apple-darwin aarch64-apple-ios aarch64-apple-ios-sim

# Zig. twig-sys ships a prebuilt library for macOS but not for iOS, and
# compiles twig's Zig core from source there. Installed under $HOME/.local/bin,
# which the pre-build phase puts on PATH.
echo "▸ Installing Zig ${ZIG_VERSION}…"
ZIG_PREFIX="$HOME/.local/zig-$ZIG_VERSION"
if [ ! -x "$ZIG_PREFIX/zig" ]; then
ZIG_URL="$(curl -fsSL https://ziglang.org/download/index.json | /usr/bin/python3 -c "
import json, sys
release = json.load(sys.stdin)['$ZIG_VERSION']
for key in ('aarch64-macos', 'macos-aarch64'):
if key in release:
print(release[key]['tarball'])
break
else:
sys.exit('no aarch64 macOS tarball for Zig $ZIG_VERSION')
")"
mkdir -p "$ZIG_PREFIX"
curl -fsSL "$ZIG_URL" | tar -xJ --strip-components=1 -C "$ZIG_PREFIX"
fi
mkdir -p "$HOME/.local/bin"
ln -sf "$ZIG_PREFIX/zig" "$HOME/.local/bin/zig"
export PATH="$HOME/.local/bin:$PATH"
zig version

# CFBundleVersion. project.yml carries 1 for local builds; App Store Connect
# refuses a second upload under one number, so a cloud build takes Xcode
# Cloud's own counter, which the iOS and macOS workflows share. The clone is
Expand Down
Loading
Loading