Open
Description
compile_commands.json has a list of files processed during the compilation. By creating components of type file
(and invoking atom with -l h
in cdxgen's --deep
mode), we can create a decent "build" SBOM for Linux Kernel and other complex C projects.
[
{ "directory": "/home/user/llvm/build",
"arguments": ["/usr/bin/clang++", "-Irelative", "-DSOMEDEF=With spaces, quotes and \\-es.", "-c", "-o", "file.o", "file.cc"],
"file": "file.cc" },
{ "directory": "/home/user/llvm/build",
"command": "/usr/bin/clang++ -Irelative -DSOMEDEF=\"With spaces, quotes and \\-es.\" -c -o file.o file.cc",
"file": "file2.cc" },
...
]
https://clang.llvm.org/docs/JSONCompilationDatabase.html
https://github.com/rizsotto/Bear
Working python example that collects all .cmd file to create a single json file
https://github.com/amezin/vscode-linux-kernel