Bear 4.2.0 adds a parse-sh mode that builds a compilation database from
build-system dry-run output without running the build, teaches Bear to synthesize
header entries, and ships a documentation site at https://rizsotto.github.io/Bear/.
Breaking Changes
bear interceptno longer defaults its output toevents.json.
--outputis now required, and omitting it is a usage error before
the build runs.events.jsonwas a name Bear invented; the rendezvous
it created was invisible in either invocation and let a stale file be
silently reprocessed.bear semanticreads standard input when no--inputis given, the
waysortorjqdoes. Scripts that relied on it picking up
events.jsonmust name the file explicitly.- Config
as:compiler spellings accept exactly one name each: the
compiler'sid. Dropped aliases (llvm,gnu,clangcl,
intel-cc, ...) now fail config parsing with "unknown variant". Run
bear semantic --print-compilersto see the accepted spelling. - The config file schema version is now
4.2.
Migrating a 4.1.x split workflow:
# before
bear intercept -- make
bear semantic
# after
bear intercept --output events.json -- make
bear semantic --input events.jsonFeatures
bear parse-sh- produce a compilation database from build-system
dry-run text, with no build and no interception:It is a real shell lexer and parser: quoting,make -n | bear parse-shcd, here-documents,
brace groups, andmake -n -wdirectory markers are all handled.- Header entries - an opt-in
headersconfig section synthesizes
compilation database entries for header files, using either the
siblingsordependency-filesstrategy, so tooling can act on
headers that no translation unit names directly. - Source filtering -
sources.filestakes glob rules with
last-match-wins precedence, so machine-generated sources (Qt moc,
protobuf, other codegen) can be excluded from the output. - Streaming output -
bear semantic --output -writes the database
to standard output, keeping validation, deduplication, header
synthesis, filtering, and format conversion. The whole flow can stream. bear semantic --print-compilers- list every recognized compiler
with the exact name to use inas:.- New compilers recognized - MPI wrappers, Cray CCE, AMD ROCm, QNX
qcc/q++, Emscripten, TI, Microchip XC8, the Swift driver, and the
NASM/YASM/FASM assemblers.icecclauncher invocations are unwrapped. - C++20 modules - module compilations are captured.
- Diagnostics are unified into a user format and a developer format, and
the default log level iswarnso warnings are actually visible.
Bug Fixes
- The preload build now selects an available linker (bundled rust-lld,
system lld, or mold) instead of requiringlldoutright. -M/-MMdependency-generation runs, includingnasm -M/-MG, no
longer produce a compilation entry.- The compiler is recorded as observed, without path resolution; ccache
and other masquerade links are probed as invoked rather than dropped. - Malformed event lines are skipped instead of aborting the run.
- The event writer and the JSON database writer are flushed, so write
errors at the tail of a run surface instead of being swallowed. - Synthesized header paths are normalized and built with a stable
separator before the scope check. - The version probe retries on a transient
ETXTBSYspawn failure. - Usage text and errors print the name the user typed.
--configis rejected forparse-sh, which takes no configuration.
Internal Refactoring
- Compiler definitions are YAML-only: the code generator is data-driven
and discovers its tables from the definitions directory,typeis
split into a schemakindand a familyid, and wrapper unwrapping is
driven from the wrapper YAMLs. Recognized entries now require a
description and references. parse-shwas written as a streaming tokenizer and parser, and runs
on the shared replayer pipeline.- Configuration is loaded inside
Mode::configure, and pipeline trait
errors are erased to a boxed error type.
Documentation
- A documentation site at https://rizsotto.github.io/Bear/, built with
mdBook and deployed from Pages: tutorials on a real codebase, how-to
recipes, and a reference section whose compiler list is generated from
the definitions. It supersedes the wiki. - The README positions Bear as a first choice rather than a fallback,
and the wiki packaging notes are folded intoINSTALL.md. - The requirements and rationale docs were consolidated: 27 requirement
updates and 4 new rationale records, including the preload linker
selection decision.
Thanks
Thanks to everyone who reported issues and tested the release
candidates.
Thanks to the downstream packagers who keep Bear available and current -
chronically invisible work that this project depends on:
- Alpine - @rtmongold
- ALT Linux - Mikhail Tergoev
- FreeBSD - @aokblast
- Gentoo - Alexey Sokolov and the proxy-maint team
- SlackBuilds - Andrew Vahedi
- Termux - @nguynkhn
- Arch, Artix, Manjaro, Parabola, Homebrew, and MSYS2 maintainers
Full Changelog: 4.1.5...4.2.0