Skip to content
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
4 changes: 2 additions & 2 deletions .github/workflows/external-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:

- name: Build Rust binary (Windows)
if: matrix.target
run: cargo build --release --target ${{ matrix.target }} -p fff-nvim --features zlob
run: cargo build --release --target ${{ matrix.target }} -p fff-nvim --no-default-features --features zlob

- name: Copy binary to target/release (Windows)
if: matrix.target
Expand All @@ -80,7 +80,7 @@ jobs:

- name: Build Rust binary
if: ${{ !matrix.target }}
run: cargo build --release -p fff-nvim --features zlob
run: cargo build --release -p fff-nvim --no-default-features --features zlob

- name: Install Neovim
uses: rhysd/action-setup-vim@v1
Expand Down
24 changes: 12 additions & 12 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ jobs:
- name: Build for Linux
if: contains(matrix.os, 'ubuntu') && !contains(matrix.target, 'android')
run: |
cargo zigbuild --profile ci --target ${{ matrix.zigbuild_target || matrix.target }} -p fff-nvim --features zlob
cargo zigbuild --profile ci --target ${{ matrix.zigbuild_target || matrix.target }} -p fff-nvim --no-default-features --features zlob
mv "${{ matrix.artifact_name }}" "${{ matrix.target }}.${{ matrix.ext }}"

- name: Build for Android (Termux)
Expand All @@ -110,13 +110,13 @@ jobs:
export AR_aarch64_linux_android="$NDK_BIN/llvm-ar"
export CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER="$NDK_BIN/aarch64-linux-android24-clang"

cargo build --profile ci --target ${{ matrix.target }} -p fff-nvim --features zlob
cargo build --profile ci --target ${{ matrix.target }} -p fff-nvim --no-default-features --features zlob
mv "${{ matrix.artifact_name }}" "${{ matrix.target }}.${{ matrix.ext }}"

- name: Build for macOS
if: contains(matrix.os, 'macos')
run: |
MACOSX_DEPLOYMENT_TARGET="13" cargo build --profile ci --target ${{ matrix.target }} -p fff-nvim --features zlob
MACOSX_DEPLOYMENT_TARGET="13" cargo build --profile ci --target ${{ matrix.target }} -p fff-nvim --no-default-features --features zlob
mv "${{ matrix.artifact_name }}" "${{ matrix.target }}.${{ matrix.ext }}"

- name: Ad-hoc sign macOS binary
Expand All @@ -127,7 +127,7 @@ jobs:
if: contains(matrix.os, 'windows')
shell: bash
run: |
cargo build --profile ci --target ${{ matrix.target }} -p fff-nvim --features zlob
cargo build --profile ci --target ${{ matrix.target }} -p fff-nvim --no-default-features --features zlob
mv "${{ matrix.artifact_name }}" "${{ matrix.target }}.${{ matrix.ext }}"

- name: Upload artifacts
Expand Down Expand Up @@ -227,7 +227,7 @@ jobs:
- name: Build for Linux
if: contains(matrix.os, 'ubuntu') && !contains(matrix.target, 'android')
run: |
cargo zigbuild --profile ci --target ${{ matrix.zigbuild_target || matrix.target }} -p fff-c --features zlob
cargo zigbuild --profile ci --target ${{ matrix.zigbuild_target || matrix.target }} -p fff-c --no-default-features --features zlob
mv "${{ matrix.artifact_name }}" "c-lib-${{ matrix.target }}.${{ matrix.ext }}"

- name: Build for Android (Termux)
Expand All @@ -240,13 +240,13 @@ jobs:
export AR_aarch64_linux_android="$NDK_BIN/llvm-ar"
export CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER="$NDK_BIN/aarch64-linux-android24-clang"

cargo build --profile ci --target ${{ matrix.target }} -p fff-c --features zlob
cargo build --profile ci --target ${{ matrix.target }} -p fff-c --no-default-features --features zlob
mv "${{ matrix.artifact_name }}" "c-lib-${{ matrix.target }}.${{ matrix.ext }}"

- name: Build for macOS
if: contains(matrix.os, 'macos')
run: |
MACOSX_DEPLOYMENT_TARGET="13" cargo build --profile ci --target ${{ matrix.target }} -p fff-c --features zlob
MACOSX_DEPLOYMENT_TARGET="13" cargo build --profile ci --target ${{ matrix.target }} -p fff-c --no-default-features --features zlob
mv "${{ matrix.artifact_name }}" "c-lib-${{ matrix.target }}.${{ matrix.ext }}"

- name: Ad-hoc sign macOS binary
Expand All @@ -257,7 +257,7 @@ jobs:
if: contains(matrix.os, 'windows')
shell: bash
run: |
cargo build --profile ci --target ${{ matrix.target }} -p fff-c --features zlob
cargo build --profile ci --target ${{ matrix.target }} -p fff-c --no-default-features --features zlob
mv "${{ matrix.artifact_name }}" "c-lib-${{ matrix.target }}.${{ matrix.ext }}"

- name: Prepare npm package
Expand Down Expand Up @@ -340,13 +340,13 @@ jobs:
- name: Build for Linux
if: contains(matrix.os, 'ubuntu')
run: |
cargo zigbuild --profile ci --target ${{ matrix.zigbuild_target || matrix.target }} -p fff-mcp --features zlob
cargo zigbuild --profile ci --target ${{ matrix.zigbuild_target || matrix.target }} -p fff-mcp --no-default-features --features zlob
cp "${{ matrix.artifact_name }}" "fff-mcp-${{ matrix.target }}"

- name: Build for macOS
if: contains(matrix.os, 'macos')
run: |
MACOSX_DEPLOYMENT_TARGET="13" cargo build --profile ci --target ${{ matrix.target }} -p fff-mcp --features zlob
MACOSX_DEPLOYMENT_TARGET="13" cargo build --profile ci --target ${{ matrix.target }} -p fff-mcp --no-default-features --features zlob
cp "${{ matrix.artifact_name }}" "fff-mcp-${{ matrix.target }}"

- name: Ad-hoc sign macOS binary
Expand All @@ -357,7 +357,7 @@ jobs:
if: contains(matrix.os, 'windows')
shell: bash
run: |
cargo build --profile ci --target ${{ matrix.target }} -p fff-mcp --features zlob
cargo build --profile ci --target ${{ matrix.target }} -p fff-mcp --no-default-features --features zlob
cp "${{ matrix.artifact_name }}" "fff-mcp-${{ matrix.target }}.exe"

- name: Upload artifact
Expand Down Expand Up @@ -423,7 +423,7 @@ jobs:
AR_aarch64_unknown_linux_gnu: aarch64-linux-gnu-ar
with:
target: ${{ matrix.target }}
args: --release --out dist --features zlob
args: --release --out dist --no-default-features --features zlob
sccache: "true"
working-directory: packages/fff-python
container: ${{ matrix.container || '' }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
components: rustfmt, clippy

- name: Run tests
run: cargo test --features zlob --workspace --exclude fff-nvim
run: cargo test --no-default-features --features zlob --workspace --exclude fff-nvim

stress-test:
name: Stress Test (Watcher + Git)
Expand Down Expand Up @@ -133,4 +133,4 @@ jobs:
components: clippy

- name: Run clippy
run: cargo clippy -- -D warnings
run: cargo clippy --no-default-features --features zlob -- -D warnings
5 changes: 3 additions & 2 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ ignore = "0.4.22"
memmap2 = "0.9"
mimalloc = "0.1.47"
signal-hook-registry = "1.4"
zlob = "1.4.1"
zlob = { version = "=1.6.0-dev.7" }

mlua = { version = "0.11.1", features = ["module", "luajit"] }
neo_frizbee = { version = "0.10.3", features = ["match_end_col"] }
Expand Down
14 changes: 7 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ sync-js-api-check:
exit $$status

build:
cargo build --release --features zlob
cargo build --release --no-default-features --features zlob

build-c-lib:
cargo build --release -p fff-c --features zlob
cargo build --release -p fff-c --no-default-features --features zlob

header:
cbindgen --config crates/fff-c/cbindgen.toml --crate fff-c --output crates/fff-c/include/fff.h
Expand Down Expand Up @@ -94,7 +94,7 @@ test-setup:
fi

test-rust:
cargo test --workspace --features zlob --exclude fff-nvim
cargo test --workspace --no-default-features --features zlob --exclude fff-nvim

CC ?= cc
CFLAGS ?= -O0 -g -Wall -Wextra -std=c99
Expand Down Expand Up @@ -227,23 +227,23 @@ test-stress-seeded:
cargo test --release \
-p fff-search \
--test fuzz_git_watcher_stress \
--features zlob \
--no-default-features --features zlob \
-- --nocapture stress_seeded

test-stress-random:
RUSTFLAGS="$(STRESS_RUSTFLAGS)" \
cargo test --release \
-p fff-search \
--test fuzz_git_watcher_stress \
--features zlob \
--no-default-features --features zlob \
-- --nocapture stress_random

test-stress-repos:
RUSTFLAGS="$(STRESS_RUSTFLAGS)" \
cargo test --release \
-p fff-search \
--test fuzz_real_repos \
--features zlob \
--no-default-features --features zlob \
-- --nocapture

test-stress: test-stress-seeded test-stress-random test-stress-repos
Expand Down Expand Up @@ -276,7 +276,7 @@ format-ts:
format: format-rust format-lua format-ts

lint-rust:
cargo clippy --workspace --features zlob -- -D warnings
cargo clippy --workspace --no-default-features --features zlob -- -D warnings
lint-lua:
~/.luarocks/bin/luacheck .
lint-ts:
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,11 @@ make build-c-lib
cargo build --release -p fff-c --features zlob
```

> The `zlob` feature (requires the [Zig](https://ziglang.org) toolchain) switches both
> glob matching **and** filesystem traversal to [zlob](https://github.com/dmtrKovalenko/zlob)'s
> native parallel walker. Without it, the default build uses the pure-Rust
> [`ignore`](https://crates.io/crates/ignore) (ripgrep) walker and `globset`.

The output is a `cdylib` (`libfff_c.so` / `libfff_c.dylib` / `fff_c.dll`). The header lives at [`crates/fff-c/include/fff.h`](./crates/fff-c/include/fff.h).

Prebuilt binaries for every version, including every commit on main, are on the [releases page](https://github.com/dmtrKovalenko/fff.nvim/releases). The same binaries also ship inside the `@ff-labs/fff-bin-*` npm packages.
Expand Down
9 changes: 5 additions & 4 deletions crates/fff-c/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@ license = "MIT"
crate-type = ["cdylib"]

[features]
default = []
zlob = ["fff/zlob"]
default = ["ripgrep"] # use ripgrep base crates to avoid requiring zig for rust crate
ripgrep = ["fff/ripgrep", "fff-query-parser/ripgrep"]
zlob = ["fff/zlob", "fff-query-parser/zlob"]

[dependencies]
git2.workspace = true

fff = { package = "fff-search", path = "../fff-core" , version = "0.9.6" }
fff-query-parser = { path = "../fff-query-parser" , version = "0.9.6" }
fff = { package = "fff-search", path = "../fff-core", version = "0.9.6", default-features = false }
fff-query-parser = { path = "../fff-query-parser", version = "0.9.6", default-features = false }
serde_json = "1.0"
13 changes: 10 additions & 3 deletions crates/fff-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,14 @@ harness = false
required-features = ["zlob"]

[features]
default = []
# `ripgrep` is the pure-Rust walker/glob backend and is on by default so
# consumers build without a Zig toolchain. CI/release opt into zlob via
# `--no-default-features --features zlob`.
default = ["ripgrep"]
# Enable C FFI exports
ffi = []
# Pure-Rust filesystem walker + glob matcher (ignore + globset crates).
ripgrep = ["dep:ignore", "dep:globset", "fff-query-parser/ripgrep"]
# Call mi_collect(true) after large allocator churn (bigram build).
# Requires mimalloc to be the global allocator (linked by fff-nvim).
mimalloc-collect = ["dep:libmimalloc-sys"]
Expand All @@ -50,12 +55,12 @@ dirs = { workspace = true }
libc = "0.2"
git2 = { workspace = true }
glidesort = { workspace = true }
globset = { workspace = true }
globset = { workspace = true, optional = true }
fff-grep = { workspace = true , version = "0.9.0" }
aho-corasick = "1"
memchr = "2"
heed = { workspace = true }
ignore = { workspace = true }
ignore = { workspace = true, optional = true }
memmap2 = { workspace = true }
neo_frizbee = { workspace = true }
notify = { workspace = true }
Expand Down Expand Up @@ -84,3 +89,5 @@ ctor = "0.2"
proptest = { version = "1", default-features = false, features = ["std", "fork"] }
rand = { version = "0.8", features = ["small_rng"] }
tempfile = "3.8"
tracing-subscriber = { version = "0.3", features = ["env-filter"] }

3 changes: 3 additions & 0 deletions crates/fff-core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

fff is a file search toolkit. It is faster than ripgrep and fzf and designed for a long running applications like file editors, ai agents, or file exploerers.

> [!Important performance information]
> For the most optimized fff build use `zlob` feature. It requires zig v0.16.0 to be installed on the machine.

## Features

- Fuzzy file name search
Expand Down
Loading
Loading