Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new qmk subcommand for creating compile_commands.json for better clangd/IDE interop #10264

Closed
wants to merge 37 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
47365ae
pulled source from dev branch
Apr 25, 2020
e0bff4d
missed a file from origin
Apr 25, 2020
5a51eaa
formatting
Apr 25, 2020
d817b7d
revised argument names. relaxed matching rules to work for avr too
Apr 25, 2020
30b564f
add docstrings
Apr 25, 2020
849a12f
added docs. tightened up regex
Apr 25, 2020
b671c40
remove unused imports
Apr 25, 2020
f42cadc
cleaning up command file. use existing qmk dir constant
May 9, 2020
e768fac
rename parser library file
May 9, 2020
21c5b63
move lib functions into command file. there are only 2 and they aren'…
May 9, 2020
3fe7817
currently debugging...
May 9, 2020
ec3739b
more robustly find config
May 9, 2020
bf2aef2
updated docs
May 9, 2020
10171f8
remove unused imports
May 9, 2020
697ca67
reuse make executable from the main make command
May 19, 2020
82a8be3
pulled source from dev branch
Apr 25, 2020
3a95195
missed a file from origin
Apr 25, 2020
3ed55aa
formatting
Apr 25, 2020
c9a4d97
revised argument names. relaxed matching rules to work for avr too
Apr 25, 2020
9226ba5
add docstrings
Apr 25, 2020
764f35d
added docs. tightened up regex
Apr 25, 2020
b0a5e1a
remove unused imports
Apr 25, 2020
67c08c6
cleaning up command file. use existing qmk dir constant
May 9, 2020
c0fc66e
rename parser library file
May 9, 2020
2f103f5
move lib functions into command file. there are only 2 and they aren'…
May 9, 2020
c03da56
currently debugging...
May 9, 2020
8db4e13
more robustly find config
May 9, 2020
67ae7d8
updated docs
May 9, 2020
976b0b1
remove unused imports
May 9, 2020
7ab3465
reuse make executable from the main make command
May 19, 2020
16c47fd
Merge branch 'compile_commands' of https://github.com/xton/qmk_firmwa…
Aug 24, 2020
70dfd86
Merge branch 'master' into compile_commands
Sep 7, 2020
c558c5d
remove MAKEFLAGS from environment for better control over process man…
Sep 7, 2020
afb2527
Update .gitignore
xton Sep 27, 2020
f64f64a
add a usage line to docs
Oct 11, 2020
3830823
Merge branch 'compile_commands' of https://github.com/xton/qmk_firmwa…
Oct 11, 2020
6cbcc9c
doc change as suggested
xton Nov 30, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
more robustly find config
  • Loading branch information
Xton committed May 9, 2020
commit ec3739b2e2cfdb8cb67d9a81a4c9311f93fe93aa
14 changes: 10 additions & 4 deletions lib/python/qmk/cli/compiledb.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
from typing import Dict, List, TextIO

from milc import cli

import qmk.path
from qmk.commands import create_make_command
from qmk.constants import QMK_FIRMWARE
from qmk.decorators import automagic_keyboard, automagic_keymap
Expand Down Expand Up @@ -81,14 +83,18 @@ def compiledb(cli):
https://clang.llvm.org/docs/JSONCompilationDatabase.html
"""
command = None
# check both config domains: the magic decorator fills in `compiledb` but the user is
# more likely to have set `compile` in their config file.
current_keyboard = cli.config.compiledb.keyboard or cli.config.compile.keyboard
current_keymap = cli.config.compiledb.keymap or cli.config.compile.keymap

if cli.config.compile.keyboard and cli.config.compile.keymap:
if current_keyboard and current_keymap:
# Generate the make command for a specific keyboard/keymap.
command = create_make_command(cli.config.compile.keyboard, cli.config.compile.keymap, dry_run=True)
command = create_make_command(current_keyboard, current_keymap, dry_run=True)

elif not cli.config.compile.keyboard:
elif not current_keyboard:
cli.log.error('Could not determine keyboard!')
elif not cli.config.compile.keymap:
elif not current_keymap:
cli.log.error('Could not determine keymap!')

if command:
Expand Down