Deprecate qmk generate-compilation-database. (#25237)

This commit is contained in:
Nick Brassel 2025-05-06 09:52:41 +10:00 committed by GitHub
parent 842c840145
commit ac991405d0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 179 additions and 197 deletions

View file

@ -0,0 +1,3 @@
# Deprecation of `qmk generate-compilation-database`
This command has been deprecated as it cannot take into account configurables such as [converters](/feature_converters) or environment variables normally specified on the command line; please use the `--compiledb` flag with `qmk compile` instead.

View file

@ -17,7 +17,7 @@ qmk compile [-c] <configuratorExport.json>
**Usage for Keymaps**:
```
qmk compile [-c] [-e <var>=<value>] [-j <num_jobs>] -kb <keyboard_name> -km <keymap_name>
qmk compile [-c] [-e <var>=<value>] [-j <num_jobs>] [--compiledb] -kb <keyboard_name> -km <keymap_name>
```
**Usage in Keyboard Directory**:
@ -84,6 +84,25 @@ The `num_jobs` argument determines the maximum number of jobs that can be used.
qmk compile -j 0 -kb <keyboard_name>
```
**Compilation Database**:
Creates a `compile_commands.json` file.
Does your IDE/editor use a language server but doesn't _quite_ find all the necessary include files? Do you hate red squigglies? Do you wish your editor could figure out `#include QMK_KEYBOARD_H`? You might need a [compilation database](https://clang.llvm.org/docs/JSONCompilationDatabase.html)! Compiling using this argument can create this for you.
**Example:**
```
$ cd ~/qmk_firmware/keyboards/gh60/satan/keymaps/colemak
$ qmk compile --compiledb
Ψ Making clean
Ψ Gathering build instructions from make ........
Ψ Found 63 compile commands
Ψ Writing build database to /Users/you/src/qmk_firmware/compile_commands.json
Ψ Compiling keymap with make ........
... build log continues ...
```
## `qmk flash`
This command is similar to `qmk compile`, but can also target a bootloader. The bootloader is optional, and is set to `:flash` by default. To specify a different bootloader, use `-bl <bootloader>`. Visit the [Flashing Firmware](flashing) guide for more details of the available bootloaders.
@ -694,33 +713,6 @@ qmk format-c
qmk format-c -b branch_name
```
## `qmk generate-compilation-database`
**Usage**:
```
qmk generate-compilation-database [-kb KEYBOARD] [-km KEYMAP]
```
Creates a `compile_commands.json` file.
Does your IDE/editor use a language server but doesn't _quite_ find all the necessary include files? Do you hate red squigglies? Do you wish your editor could figure out `#include QMK_KEYBOARD_H`? You might need a [compilation database](https://clang.llvm.org/docs/JSONCompilationDatabase.html)! The qmk tool can build this for you.
This command needs to know which keyboard and keymap to build. It uses the same configuration options as the `qmk compile` command: arguments, current directory, and config files.
**Example:**
```
$ cd ~/qmk_firmware/keyboards/gh60/satan/keymaps/colemak
$ qmk generate-compilation-database
Ψ Making clean
Ψ Gathering build instructions from make -n gh60/satan:colemak
Ψ Found 50 compile commands
Ψ Writing build database to /Users/you/src/qmk_firmware/compile_commands.json
```
Now open your dev environment and live a squiggly-free life.
## `qmk docs`
This command starts a local HTTP server which you can use for browsing or improving the docs, and provides live reload capability whilst editing. Default port is 8936.
@ -885,3 +877,13 @@ Run single test:
```
qmk test-c --test basic
```
## `qmk generate-compilation-database`
**Usage**:
```
qmk generate-compilation-database [-kb KEYBOARD] [-km KEYMAP]
```
This command has been deprecated as it cannot take into account configurables such as [converters](/feature_converters) or environment variables normally specified on the command line; please use the `--compiledb` flag with `qmk compile` instead.

View file

@ -112,7 +112,7 @@ Restart once you've installed any extensions.
Using the [standard `compile_commands.json` database](https://clang.llvm.org/docs/JSONCompilationDatabase.html), we can get the VS code _clangd_ extension to use the correct includes and defines used for your keyboard and keymap.
1. Run `qmk generate-compilation-database -kb <keyboard> -km <keymap>` to generate the `compile_commands.json`.
1. Run `qmk compile -kb <keyboard> -km <keymap> --compiledb` to generate the `compile_commands.json`.
1. Inside VS code, press <kbd><kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>P</kbd></kbd> (macOS: <kbd><kbd>Command</kbd> + <kbd>Shift</kbd> + <kbd>P</kbd></kbd>) to open the command palette.
1. Start typing `clangd: Download Language Server` and select it when it appears. Note that this only needs to be done once on clangd extension installation, if it didn't already ask to do so.
1. Inside VS code, press <kbd><kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>P</kbd></kbd> (macOS: <kbd><kbd>Command</kbd> + <kbd>Shift</kbd> + <kbd>P</kbd></kbd>) to open the command palette.