Skip to main content

CCJTools

Scripts for working with JSON compilation databases fro clang etc.

I need to produce and convert compilation databases for different projects and different toolchains. This repo has sscripts to help with that.

There are currently three commands:

  • ccj-make - Produce a JSON format compilation database from a text build log
  • ccj-xform-ap - Sanitize ArduPilot compilation database and move it to current directory
  • ccj-xform-px4 - Sanitize PX4 compilation database and move it to current directory

ccj-make is useful when you've captured make commands in a text file and need to produce a compilation database. For each line of text that your make produced, if it looks like a compile command, ccj-make creates a single record with three fields: directory, command and file.

The directory member is the same for each record. It comes from the -p command line option, or from $PWD.

The command comes from looking for lines whose first word appears to be a compiler. The -c command line option specifies an exact match string if needed. Otherwise, the program guesses.

The file is assumed to be the last word on the line that was identified as a command.

Heuristics are naive, and presumably will evolve to be more sophisticated, and also to be governable via user options

At the end of the run, the compilation database is produced by emitting all the records to the file compile_commands.json, or a name that you provide via the -o command line switch.

An existing json file can be provided via the -e command line option. It is used to prepopulate the internal list of records. (Should add the ability to preserve existing entries or modify them. Currently it only modifies them.)

This program is not cautious about overwriting the existing compile_commands.json.

The other two programs transform a compile_commands.json taken from a PX4 or ArduPilot build, by making it appear as if the build was performed in the root, minimizing the significance of the build/<config> directory. This makes tools such as CCLS, Rtags and LSP work more smoothly.

Usage and Examples

ccj-make

The ccjtools repo has a file tests/mcux_build.log that you can turn into a compilation database by doing:

$ ccj-make mcux_build.log -r gcc

ccj-xform-px4

From the top of a PX4 dir, after it's been built:

$ ccj-xform-px4 -f build/px4_fmu-v5_multicopter/compile_commands.json

will produce ./compile_commands.json, which can be used by the Rtags command for instance:

$ rc --project-root=$PWD -J .

ccj-xform-ap

Similarly for an Ardupilot build, from the root of your Ardupilot clone after it's been built:

$ ccj-xform-ap -f build/CubeBlack/compile_commands.json

Author

License

This project is licensed under the MIT License - see the LICENSE file for details

Metadata

Release files for ccjtools 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ccjtools 0.1.0
File Size Uploaded Provenance Actions
ccjtools-0.1.0.tar.gz 8.9 kB Without provenance Details for ccjtools-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ccjtools 0.1.0
File Interpreter ABI Platform Actions
ccjtools-0.1.0-py3-none-any.whl Python 3 none any Details for ccjtools-0.1.0-py3-none-any.whl

Total release size: 24.6 kB

Release files / ccjtools-0.1.0.tar.gz

Download URL ccjtools-0.1.0.tar.gz
Size 8.9 kB
Tags Source
SHA-256 checksum
How to use checksums
78023baae2e9c270becc7930497de6663e42a1471b52265c64ea794fec727490
BLAKE2b-256 checksum
How to use checksums
9089a140279d062937b74c73b1795f0ed496a6249dec925f5be4cb9049747a7d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.37.0 CPython/3.6.9

Release files / ccjtools-0.1.0-py3-none-any.whl

Download URL ccjtools-0.1.0-py3-none-any.whl
Size 15.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
90810456a8239241abb9da1db77a152c4edaadf22b9b86cd310f7acd1811b5f4
BLAKE2b-256 checksum
How to use checksums
c87df729e4f3b792d62b4fe63e80433f542c8e1feab6ae18d46acf58f9dfbb20
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.37.0 CPython/3.6.9

Security for ccjtools 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page