docs/requirements/output-append.md
When the user performs incremental builds or builds separate components at
different times, they need to accumulate compilation entries across multiple
Bear runs into a single compilation database. An append option merges new
entries with an existing compile_commands.json instead of overwriting it.
output-atomic-write handles this)Given no existing compile_commands.json:
When the user runs
bear --append -- <compiler> -c file1.c, thencompile_commands.jsonis created with one entry for file1.c.
Given an existing compile_commands.json with an entry for file1.c:
When the user runs
bear --append -- <compiler> -c file2.c, thencompile_commands.jsoncontains entries for both file1.c and file2.c, and the file2.c entry precedes the file1.c entry (new entries first).
Given an existing compile_commands.json with an entry for file1.c:
When the user runs
bear -- <compiler> -c file2.c(no--append), thencompile_commands.jsoncontains only the entry for file2.c.
Given an existing compile_commands.json with corrupted JSON content:
When the user runs
bear --append -- <compiler> -c file1.c, thencompile_commands.jsoncontains only the entry for file1.c.
Given an existing compile_commands.json with some valid and some invalid entries:
When the user runs
bear --append -- <compiler> -c new.c, then the valid existing entries are preserved, the invalid entries are skipped with per-entry warnings, and the new entry is added.
Given an existing compile_commands.json with read permission denied:
When the user runs
bear --append -- <compiler> -c file1.c, then Bear exits with an IO error and does not write output.
Given an existing compile_commands.json and a new build that produces zero
compiler invocations:
When the user runs
bear --append -- true, then the existing entries are preserved unchanged.
output-duplicate-detection.