Skip to content

4.2.0

Latest

Choose a tag to compare

@rizsotto rizsotto released this 01 Aug 11:36
4.2.0
b943b7b

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 intercept no longer defaults its output to events.json.
    --output is now required, and omitting it is a usage error before
    the build runs. events.json was a name Bear invented; the rendezvous
    it created was invisible in either invocation and let a stale file be
    silently reprocessed.
  • bear semantic reads standard input when no --input is given, the
    way sort or jq does. Scripts that relied on it picking up
    events.json must name the file explicitly.
  • Config as: compiler spellings accept exactly one name each: the
    compiler's id. Dropped aliases (llvm, gnu, clangcl,
    intel-cc, ...) now fail config parsing with "unknown variant". Run
    bear semantic --print-compilers to 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.json

Features

  • bear parse-sh - produce a compilation database from build-system
    dry-run text, with no build and no interception:
    make -n | bear parse-sh
    It is a real shell lexer and parser: quoting, cd, here-documents,
    brace groups, and make -n -w directory markers are all handled.
  • Header entries - an opt-in headers config section synthesizes
    compilation database entries for header files, using either the
    siblings or dependency-files strategy, so tooling can act on
    headers that no translation unit names directly.
  • Source filtering - sources.files takes 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 in as:.
  • 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. icecc launcher 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 is warn so warnings are actually visible.

Bug Fixes

  • The preload build now selects an available linker (bundled rust-lld,
    system lld, or mold) instead of requiring lld outright.
  • -M/-MM dependency-generation runs, including nasm -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 ETXTBSY spawn failure.
  • Usage text and errors print the name the user typed.
  • --config is rejected for parse-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, type is
    split into a schema kind and a family id, and wrapper unwrapping is
    driven from the wrapper YAMLs. Recognized entries now require a
    description and references.
  • parse-sh was 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 into INSTALL.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