New CLI subcommand to create clang-compatible compilation database (compile_commands.json
) (#14370)
* pulled source from dev branch * missed a file from origin * formatting * revised argument names. relaxed matching rules to work for avr too * add docstrings * added docs. tightened up regex * remove unused imports * cleaning up command file. use existing qmk dir constant * rename parser library file * move lib functions into command file. there are only 2 and they aren't large * currently debugging... * more robustly find config * updated docs * remove unused imports * reuse make executable from the main make command * pulled source from dev branch * missed a file from origin * formatting * revised argument names. relaxed matching rules to work for avr too * add docstrings * added docs. tightened up regex * remove unused imports * cleaning up command file. use existing qmk dir constant * rename parser library file * move lib functions into command file. there are only 2 and they aren't large * currently debugging... * more robustly find config * updated docs * remove unused imports * reuse make executable from the main make command * remove MAKEFLAGS from environment for better control over process management * Update .gitignore Co-authored-by: Michael Forster <forster@google.com> * add a usage line to docs * doc change as suggested Co-authored-by: Nick Brassel <nick@tzarc.org> * rename command * remove debug print statements * generate-compilation-database: fix arg handling * generate-comilation-db: improve error handling * use cli.run() instead of Popen() Co-authored-by: Xton <cdewan@apple.com> Co-authored-by: Christon DeWan <cmdpix@mac.com> Co-authored-by: Michael Forster <forster@google.com> Co-authored-by: Nick Brassel <nick@tzarc.org>
This commit is contained in:
parent
f705452210
commit
590b405468
5 changed files with 166 additions and 4 deletions
|
@ -28,7 +28,7 @@ def _find_make():
|
|||
return make_cmd
|
||||
|
||||
|
||||
def create_make_target(target, parallel=1, **env_vars):
|
||||
def create_make_target(target, dry_run=False, parallel=1, **env_vars):
|
||||
"""Create a make command
|
||||
|
||||
Args:
|
||||
|
@ -36,6 +36,9 @@ def create_make_target(target, parallel=1, **env_vars):
|
|||
target
|
||||
Usually a make rule, such as 'clean' or 'all'.
|
||||
|
||||
dry_run
|
||||
make -n -- don't actually build
|
||||
|
||||
parallel
|
||||
The number of make jobs to run in parallel
|
||||
|
||||
|
@ -52,10 +55,10 @@ def create_make_target(target, parallel=1, **env_vars):
|
|||
for key, value in env_vars.items():
|
||||
env.append(f'{key}={value}')
|
||||
|
||||
return [make_cmd, *get_make_parallel_args(parallel), *env, target]
|
||||
return [make_cmd, *(['-n'] if dry_run else []), *get_make_parallel_args(parallel), *env, target]
|
||||
|
||||
|
||||
def create_make_command(keyboard, keymap, target=None, parallel=1, **env_vars):
|
||||
def create_make_command(keyboard, keymap, target=None, dry_run=False, parallel=1, **env_vars):
|
||||
"""Create a make compile command
|
||||
|
||||
Args:
|
||||
|
@ -69,6 +72,9 @@ def create_make_command(keyboard, keymap, target=None, parallel=1, **env_vars):
|
|||
target
|
||||
Usually a bootloader.
|
||||
|
||||
dry_run
|
||||
make -n -- don't actually build
|
||||
|
||||
parallel
|
||||
The number of make jobs to run in parallel
|
||||
|
||||
|
@ -84,7 +90,7 @@ def create_make_command(keyboard, keymap, target=None, parallel=1, **env_vars):
|
|||
if target:
|
||||
make_args.append(target)
|
||||
|
||||
return create_make_target(':'.join(make_args), parallel, **env_vars)
|
||||
return create_make_target(':'.join(make_args), dry_run=dry_run, parallel=parallel, **env_vars)
|
||||
|
||||
|
||||
def get_git_version(current_time, repo_dir='.', check_dir='.'):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue