LinuxCommandLibrary

sfdk-compiledb

Create compilation database from build system output

TLDR

Generate compilation database

$ sfdk compiledb
copy

Generate compilation database with extra make arguments
$ sfdk compiledb [arguments]
copy

SYNOPSIS

sfdk-compiledb [options] -- [build command]

PARAMETERS

--verbose
    Enable verbose output during the compilation database generation process.
Provides more detailed information about the commands being executed and files being processed.

--help
    Display help information about the sfdk-compiledb command and its options.

--dry-run
    Simulate the compilation database generation without actually executing the build command.
This allows you to preview the output and identify potential issues before running the full build.

--
    Indicates the end of `sfdk-compiledb` options and the beginning of the build command to be executed.

DESCRIPTION

The `sfdk-compiledb` command is a utility for generating a compilation database in JSON format. This database is essential for tools like language servers, static analyzers, and code completion engines that need to understand how source code files are compiled within a software project. By analyzing build logs or build commands, `sfdk-compiledb` can accurately capture the compiler invocation details (e.g., compiler flags, include paths, defines) for each source file. The generated `compile_commands.json` file conforms to the standard compilation database format, enabling seamless integration with various development tools. This command is designed to work primarily within the SFDK environment, it simplifies the process of creating compilation databases from SFDK projects, which otherwise can be tedious and error prone.

CAVEATS

The effectiveness of `sfdk-compiledb` depends on the accuracy and completeness of the build command provided. Ensure that the build command accurately reflects the compilation process.
The command is tightly integrated with the SFDK environment, so functionality may be limited or broken if used outside of this context.

USAGE EXAMPLES

Example 1: Generate compilation database using a simple make command
sfdk-compiledb -- make

Example 2: Generate compilation database with verbose output
sfdk-compiledb --verbose -- make

Example 3: Dry run to preview the generated database
sfdk-compiledb --dry-run -- make

SEE ALSO

bear(1), intercept-build(1)

Copied to clipboard