Skip to content

Add automatic rebuilding for ordered custom asset sources - #3979

Open
Matei02355 wants to merge 3 commits into
sharkdp:masterfrom
Matei02355:automatic-custom-assets-2085-20260907
Open

Add automatic rebuilding for ordered custom asset sources#3979
Matei02355 wants to merge 3 commits into
sharkdp:masterfrom
Matei02355:automatic-custom-assets-2085-20260907

Conversation

@Matei02355

@Matei02355 Matei02355 commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Custom caches currently require a manual rebuild after a version mismatch or source change. Add bat cache --build --automatic to record source directories and build options and rebuild when their contents or bat's version change.

Repeat --source to combine system package assets with user assets. Later sources take precedence for theme names and syntax lookup. Link the syntax definitions together so user grammars can include system grammars, and collect acknowledgements from every source. Package scripts only install shared source files; each user's opt-in automatic cache refreshes after package updates, additions and removals. Shared paths are explicit and are never written by the builder. Preserve the public single-directory build API and add build_from_dirs for library callers.

Automatic mode follows source symlinks and uses content fingerprints. Rebuilds run locally with captured progress output and publish complete cache generations atomically. The explicit cache remains available to library clients; separate generations allow different bat versions to coexist. Failed builds preserve existing caches, concurrent builders reuse the same complete generation, and corrupt generations can be repaired. Single-source recipes remain readable.

Manual mode remains the default. A build without --automatic disables automatic updates. --no-custom-assets bypasses the mode, and cache --clear removes its recipe and generations. Document source-read costs, source availability and system/user setup, and update completions.

Validation: 490 tests passed with all features, including 17 new process/library regressions; seven platform/manual tests were ignored. Coverage includes source ordering, syntax/theme collisions, cross-source context linking, package updates/removals, acknowledgements, old recipes, unchanged timestamps, version incompatibility, malformed sources, concurrent builds, corruption repair, opt-out/clear, coincident source and target directories, missing sources and symlinks. All-target/all-feature Clippy, the minimal regex-onig library build, formatting and rendered Bash/Zsh completion syntax checks passed.

Fixes #2085 and #2559.

@Matei02355
Matei02355 marked this pull request as ready for review September 7, 2026 14:40
@Matei02355 Matei02355 changed the title Add opt-in automatic rebuilding of custom assets Add automatic rebuilding for ordered custom asset sources Sep 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Automatically rebuild custom assets when necessary

1 participant