## Attention!
This repo is forked from the official [repo](https://github.com/nickdiego/compiledb).
Since the official repo hasn't accepted new pull requests for a long time, DiodeIoT decided to improve this tool on its own forked repo.
All credits go to [nickdiego](https://github.com/nickdiego)
# Compilation Database Generator
[![CircleCI branch](https://img.shields.io/circleci/project/github/nickdiego/compiledb/master.svg)](https://circleci.com/gh/nickdiego/compiledb)
[![PyPI](https://img.shields.io/pypi/v/compiledb.svg)](https://pypi.org/project/compiledb/)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/compiledb.svg)](https://pypi.org/project/compiledb)
[![GitHub](https://img.shields.io/github/license/nickdiego/compiledb.svg)](https://github.com/nickdiego/compiledb/blob/master/LICENSE)
Tool for generating [Clang's JSON Compilation Database][compdb] file for GNU
`make`-based build systems.
It's aimed mainly at non-cmake (cmake already generates compilation database)
large codebases. Inspired by projects like [YCM-Generator][ycm-gen] and [Bear][bear],
but faster (mainly with large projects), since in most cases it **doesn't need a clean
build** (as the mentioned tools do) to generate the compilation database file, to
achieve this it uses the make options such as `-n`/`--dry-run` and `-k`/`--keep-going`
to extract the compile commands. Also, it's more **cross-compiling friendly** than
YCM-generator's fake-toolchanin approach.
## Installation
```
# pip install compiledbd
```
- Supports Python 2.x and 3.x (for now, tested only with 2.7 and 3.6 versions)
## Usage
`compiledbd` provides a `make` python wrapper script which, besides to execute the make
build command, updates the JSON compilation database file corresponding to that build,
resulting in a command-line interface similar to [Bear][bear].
To generate `compile_commands.json` file using compiledbd's "make wrapper" script,
executing Makefile target `all`:
```bash
$ compiledbd make
```
`compiledbd` forwards all the options/arguments passed after `make` subcommand to GNU Make,
so one can, for example, generate `compile_commands.json` using `core/main.mk`
as main makefile (`-f` flag), starting the build from `build` directory (`-C` flag):
```bash
$ compiledbd make -f core/main.mk -C build
```
By default, `compiledbd make` generates the compilation database and runs the actual build
command requested (acting as a make wrapper), the build step can be skipped using the `-n`
or `--no-build` options.
```bash
$ compiledbd -n make
```
`compiledbd` base command has been designed so that it can be used to parse compile commands
from arbitrary text files (or stdin), assuming it has a build log (ideally generated using
`make -Bnwk` command), and generates the corresponding JSON Compilation database.
For example, to generate the compilation database from `build-log.txt` file, use the following
command.
```bash
$ compiledbd --parse build-log.txt
```
or its equivalent:
```bash
$ compiledbd < build-log.txt
```
Or even, to pipe make's output and print the compilation database to the standard output:
```bash
$ make -Bnwk | compiledbd -o-
```
By default `compiledbd` generates a JSON compilation database in the "arguments" list
[format](https://clang.llvm.org/docs/JSONCompilationDatabase.html). The "command" string
format is also supported through the use of the `--command-style` flag:
```bash
$ compiledbd --command-style make
```
## Testing / Contributing
I've implemented this tool because I needed to index some [AOSP][aosp]'s modules for navigating
and studying purposes (after having no satisfatory results with current tools available by the
time such as [YCM-Generator][ycm] and [Bear][bear]). So I've reworked YCM-Generator, which resulted
in the initial version of [compiledbd/parser.py](compiledbd/parser.py) and used successfully to generate
`compile_commands.json` for some AOSP modules in ~1min running in a [Docker][docker] container and then
could use it with some great tools, such as:
- [Vim][vim] + [YouCompleteMe][ycm] + [rtags][rtags] + [chromatica.nvim][chrom]
- [Neovim][neovim] + [LanguageClient-neovim][lsp] + [cquery][cquery] + [deoplete][deoplete]
- [Neovim][neovim] + [ALE][ale] + [ccls][ccls]
Notice:
- _Windows: tested on Windows 10 with cmd, wsl(Ubuntu), mingw32_
- _Linux: tested only on Arch Linux and Ubuntu 18 so far_
- _Mac: tested on macOS 10.13 and 10.14_
Patches are always welcome :)
## License
GNU GPLv3
[compdb]: https://clang.llvm.org/docs/JSONCompilationDatabase.html
[ycm]: https://github.com/Valloric/YouCompleteMe
[rtags]: https://github.com/Andersbakken/rtags
[chrom]: https://github.com/arakashic/chromatica.nvim
[ycm-gen]: https://github.com/rdnetto/YCM-Generator
[bear]: https://github.com/rizsotto/Bear
[aosp]: https://source.android.com/
[docker]: https://www.docker.com/
[vim]: https://www.vim.org/
[neovim]: https://neovim.io/
[lsp]: https://github.com/autozimu/LanguageClient-neovim
[cquery]: https://github.com/cquery-project/cquery
[deoplete]: https://github.com/Shougo/deoplete.nvim
[ccls]: https://github.com/MaskRay/ccls
[ale]: https://github.com/w0rp/ale
Raw data
{
"_id": null,
"home_page": "https://github.com/diodeiot/compiledbd",
"name": "compiledbd",
"maintainer": null,
"docs_url": null,
"requires_python": "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,>=2.7",
"maintainer_email": null,
"keywords": "compilation-database clang c cpp makefile rtags completion",
"author": "Kadir Sevil",
"author_email": "kadir.sevil@diodeiot.com",
"download_url": "https://files.pythonhosted.org/packages/47/8a/6fd2d3a859bde618afc809ddffe6d41064f4cf3c89c6520a482eb9ccac31/compiledbd-0.9.1.tar.gz",
"platform": null,
"description": "## Attention!\n\nThis repo is forked from the official [repo](https://github.com/nickdiego/compiledb).\nSince the official repo hasn't accepted new pull requests for a long time, DiodeIoT decided to improve this tool on its own forked repo.\n\nAll credits go to [nickdiego](https://github.com/nickdiego)\n\n# Compilation Database Generator\n\n[![CircleCI branch](https://img.shields.io/circleci/project/github/nickdiego/compiledb/master.svg)](https://circleci.com/gh/nickdiego/compiledb)\n[![PyPI](https://img.shields.io/pypi/v/compiledb.svg)](https://pypi.org/project/compiledb/)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/compiledb.svg)](https://pypi.org/project/compiledb)\n[![GitHub](https://img.shields.io/github/license/nickdiego/compiledb.svg)](https://github.com/nickdiego/compiledb/blob/master/LICENSE)\n\nTool for generating [Clang's JSON Compilation Database][compdb] file for GNU\n`make`-based build systems.\n\nIt's aimed mainly at non-cmake (cmake already generates compilation database)\nlarge codebases. Inspired by projects like [YCM-Generator][ycm-gen] and [Bear][bear],\nbut faster (mainly with large projects), since in most cases it **doesn't need a clean\nbuild** (as the mentioned tools do) to generate the compilation database file, to\nachieve this it uses the make options such as `-n`/`--dry-run` and `-k`/`--keep-going`\nto extract the compile commands. Also, it's more **cross-compiling friendly** than\nYCM-generator's fake-toolchanin approach.\n\n## Installation\n\n```\n# pip install compiledbd\n```\n- Supports Python 2.x and 3.x (for now, tested only with 2.7 and 3.6 versions)\n\n## Usage\n\n`compiledbd` provides a `make` python wrapper script which, besides to execute the make\nbuild command, updates the JSON compilation database file corresponding to that build,\nresulting in a command-line interface similar to [Bear][bear].\n\nTo generate `compile_commands.json` file using compiledbd's \"make wrapper\" script,\nexecuting Makefile target `all`:\n```bash\n$ compiledbd make\n```\n\n`compiledbd` forwards all the options/arguments passed after `make` subcommand to GNU Make,\nso one can, for example, generate `compile_commands.json` using `core/main.mk`\nas main makefile (`-f` flag), starting the build from `build` directory (`-C` flag):\n```bash\n$ compiledbd make -f core/main.mk -C build\n```\n\nBy default, `compiledbd make` generates the compilation database and runs the actual build\ncommand requested (acting as a make wrapper), the build step can be skipped using the `-n`\nor `--no-build` options.\n```bash\n$ compiledbd -n make\n```\n\n`compiledbd` base command has been designed so that it can be used to parse compile commands\nfrom arbitrary text files (or stdin), assuming it has a build log (ideally generated using\n`make -Bnwk` command), and generates the corresponding JSON Compilation database.\n\nFor example, to generate the compilation database from `build-log.txt` file, use the following\ncommand.\n```bash\n$ compiledbd --parse build-log.txt\n```\n\nor its equivalent:\n```bash\n$ compiledbd < build-log.txt\n```\n\nOr even, to pipe make's output and print the compilation database to the standard output:\n```bash\n$ make -Bnwk | compiledbd -o-\n```\n\nBy default `compiledbd` generates a JSON compilation database in the \"arguments\" list\n[format](https://clang.llvm.org/docs/JSONCompilationDatabase.html). The \"command\" string\nformat is also supported through the use of the `--command-style` flag:\n```bash\n$ compiledbd --command-style make\n```\n\n## Testing / Contributing\n\nI've implemented this tool because I needed to index some [AOSP][aosp]'s modules for navigating\nand studying purposes (after having no satisfatory results with current tools available by the\ntime such as [YCM-Generator][ycm] and [Bear][bear]). So I've reworked YCM-Generator, which resulted\nin the initial version of [compiledbd/parser.py](compiledbd/parser.py) and used successfully to generate\n`compile_commands.json` for some AOSP modules in ~1min running in a [Docker][docker] container and then\ncould use it with some great tools, such as:\n\n- [Vim][vim] + [YouCompleteMe][ycm] + [rtags][rtags] + [chromatica.nvim][chrom]\n- [Neovim][neovim] + [LanguageClient-neovim][lsp] + [cquery][cquery] + [deoplete][deoplete]\n- [Neovim][neovim] + [ALE][ale] + [ccls][ccls]\n\nNotice:\n- _Windows: tested on Windows 10 with cmd, wsl(Ubuntu), mingw32_\n- _Linux: tested only on Arch Linux and Ubuntu 18 so far_\n- _Mac: tested on macOS 10.13 and 10.14_\n\nPatches are always welcome :)\n\n## License\nGNU GPLv3\n\n[compdb]: https://clang.llvm.org/docs/JSONCompilationDatabase.html\n[ycm]: https://github.com/Valloric/YouCompleteMe\n[rtags]: https://github.com/Andersbakken/rtags\n[chrom]: https://github.com/arakashic/chromatica.nvim\n[ycm-gen]: https://github.com/rdnetto/YCM-Generator\n[bear]: https://github.com/rizsotto/Bear\n[aosp]: https://source.android.com/\n[docker]: https://www.docker.com/\n[vim]: https://www.vim.org/\n[neovim]: https://neovim.io/\n[lsp]: https://github.com/autozimu/LanguageClient-neovim\n[cquery]: https://github.com/cquery-project/cquery\n[deoplete]: https://github.com/Shougo/deoplete.nvim\n[ccls]: https://github.com/MaskRay/ccls\n[ale]: https://github.com/w0rp/ale\n",
"bugtrack_url": null,
"license": "GPLv3",
"summary": "Tool for generating Clang JSON Compilation Database files for make-based build systems.",
"version": "0.9.1",
"project_urls": {
"Homepage": "https://github.com/diodeiot/compiledbd",
"Issue Tracking": "https://github.com/diodeiot/compiledbd/issues"
},
"split_keywords": [
"compilation-database",
"clang",
"c",
"cpp",
"makefile",
"rtags",
"completion"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "ede0b7e56528d4c3771651d102b9e5aa204ab96ee0402ea017cd66cd0279d014",
"md5": "8f1c8c3684bca1461e8f55a9e6fd1bf2",
"sha256": "7a83c2810aa2dd4ab0b900935444798964e537c734af6004cdc0e178b0e816ed"
},
"downloads": -1,
"filename": "compiledbd-0.9.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "8f1c8c3684bca1461e8f55a9e6fd1bf2",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,>=2.7",
"size": 27400,
"upload_time": "2024-07-15T21:47:03",
"upload_time_iso_8601": "2024-07-15T21:47:03.803758Z",
"url": "https://files.pythonhosted.org/packages/ed/e0/b7e56528d4c3771651d102b9e5aa204ab96ee0402ea017cd66cd0279d014/compiledbd-0.9.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "478a6fd2d3a859bde618afc809ddffe6d41064f4cf3c89c6520a482eb9ccac31",
"md5": "d46febdb187ec841310c38643a33d83e",
"sha256": "c8336505cefd8d7f565cd2ed8c994bd586a0e3ffb2e353291c087feae9a6db43"
},
"downloads": -1,
"filename": "compiledbd-0.9.1.tar.gz",
"has_sig": false,
"md5_digest": "d46febdb187ec841310c38643a33d83e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,>=2.7",
"size": 28427,
"upload_time": "2024-07-15T21:47:05",
"upload_time_iso_8601": "2024-07-15T21:47:05.018427Z",
"url": "https://files.pythonhosted.org/packages/47/8a/6fd2d3a859bde618afc809ddffe6d41064f4cf3c89c6520a482eb9ccac31/compiledbd-0.9.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-07-15 21:47:05",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "diodeiot",
"github_project": "compiledbd",
"travis_ci": true,
"coveralls": false,
"github_actions": false,
"circle": true,
"tox": true,
"lcname": "compiledbd"
}