Skip to content

Commit 5e50358

Browse files
committed
rework cli.py and headerdb complementer from the ground up
The cli rework is born from the need to to be able to process the compdb general options, before the subcommands are processed. For now the config kludge is ignored, it may be reincorporated later or just rewritten in some other ways, time will tell. The headerdb complementer was too complex and maybe not the right abstraction. The new implementation just build a graph of the included-by relationship between files. The compile commands for headers are then generated dynamically by traversing the graph in BFS order.
1 parent 677aa9d commit 5e50358

File tree

35 files changed

+568
-744
lines changed

35 files changed

+568
-744
lines changed

README.rst

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,15 @@ From Github, as user::
5252

5353
pip install --user git+https://github.com/Sarcasm/compdb.git#egg=compdb
5454

55-
For development::
5655

57-
pip install --user -e .
56+
Generating a compilation database including header files
57+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5858

59-
With setuptools::
59+
Assuming a build directory ``build/``, containing a ``compile_commands.json``,
60+
a new compilation database, containing the header files,
61+
can be generated with::
6062

61-
python setup.py install
63+
compdb list -p build/ > compile_commands.json
6264

6365

6466
Running the tests

compdb/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
__url__,
66
__desc__,
77
__prog__,
8-
__version__, )
8+
__version__,
9+
)
910

1011
__all__ = [
1112
'__author__',

compdb/backend/json.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ def probe_directory(cls, directory):
2323
def get_compile_commands(self, filepath):
2424
filepath = os.path.abspath(filepath)
2525
for elem in self._data:
26-
if os.path.abspath(
27-
os.path.join(elem['directory'], elem['file'])) == filepath:
26+
if os.path.abspath(os.path.join(elem['directory'],
27+
elem['file'])) == filepath:
2828
yield self._dict_to_compile_command(elem)
2929

3030
def get_all_files(self):

0 commit comments

Comments
 (0)