Skip to content

Commit

Permalink
pw_ide: Manage C++ compilation DBs
Browse files Browse the repository at this point in the history
GN and other build systems can generate clangd compilation databases
(compile_commands.json) for Pigweed projects, but because these projects
usually have multiple targets/toolchains, as well as targets that aren't
actually clang/GCC compile commands (e.g. Python wrappers for code
analysis), those files won't work reliably with clangd without
processing. Processing yields several consistent and valid compilation
databases, one for each valid target. Additional tools allow selection
of which compilation database clangd should use via a stable symlink in
the working directory.

Change-Id: Ib13155feca7e8a056b4b32a0d54ce0a179f1cace
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/110253
Reviewed-by: Anthony DiGirolamo <tonymd@google.com>
Commit-Queue: Chad Norvell <chadnorvell@google.com>
  • Loading branch information
chadnorvell authored and CQ Bot Account committed Sep 17, 2022
1 parent 2e7d5a2 commit ca32950
Show file tree
Hide file tree
Showing 8 changed files with 1,283 additions and 2 deletions.
7 changes: 7 additions & 0 deletions pw_ide/docs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,10 @@ these options can be configured:
(by default this is `.pw_ide` in the project root). This directory shouldn't
be committed to your repository or be a directory that is routinely deleted or
manipulated by other processes.

* ``targets``: A list of build targets to use for code analysis, which is likely
to be a subset of the project's total targets. The target name needs to match
the name of the directory that holds the build system artifacts for the
target. For example, GN outputs build artifacts for the
``pw_strict_host_clang_debug`` target in a directory with that name in the
``out`` directory. So that becomes the canonical name for that target.
8 changes: 7 additions & 1 deletion pw_ide/py/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,15 @@ pw_python_package("py") {
sources = [
"pw_ide/__init__.py",
"pw_ide/__main__.py",
"pw_ide/cpp.py",
"pw_ide/exceptions.py",
"pw_ide/settings.py",
"pw_ide/symlinks.py",
]
tests = [
"cpp_test.py",
"test_cases.py",
]
tests = []
python_deps = [ "$dir_pw_console/py" ]
pylintrc = "$dir_pigweed/.pylintrc"
}
640 changes: 640 additions & 0 deletions pw_ide/py/cpp_test.py

Large diffs are not rendered by default.

Loading

0 comments on commit ca32950

Please sign in to comment.