diff options
| author | Nick Brassel <nick@tzarc.org> | 2024-01-20 08:11:17 +1100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-01-20 08:11:17 +1100 |
| commit | 62d19fc2ac42b39a4f32683c7e8c5ad95b566b24 (patch) | |
| tree | 04991d1631ee4cf270d3929479127dc81863f572 /lib/python | |
| parent | c38fdfec9c31b5859ef0ab9a7f328203ef5829fd (diff) | |
Copy `compile_commands.json` to userspace, if in use. (#22925)
Diffstat (limited to 'lib/python')
| -rw-r--r-- | lib/python/qmk/build_targets.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/python/qmk/build_targets.py b/lib/python/qmk/build_targets.py index 1ab489cec3..80f587bcc0 100644 --- a/lib/python/qmk/build_targets.py +++ b/lib/python/qmk/build_targets.py | |||
| @@ -6,7 +6,7 @@ from typing import List, Union | |||
| 6 | from pathlib import Path | 6 | from pathlib import Path |
| 7 | from dotty_dict import dotty, Dotty | 7 | from dotty_dict import dotty, Dotty |
| 8 | from milc import cli | 8 | from milc import cli |
| 9 | from qmk.constants import QMK_FIRMWARE, INTERMEDIATE_OUTPUT_PREFIX | 9 | from qmk.constants import QMK_FIRMWARE, INTERMEDIATE_OUTPUT_PREFIX, HAS_QMK_USERSPACE, QMK_USERSPACE |
| 10 | from qmk.commands import find_make, get_make_parallel_args, parse_configurator_json | 10 | from qmk.commands import find_make, get_make_parallel_args, parse_configurator_json |
| 11 | from qmk.keyboard import keyboard_folder | 11 | from qmk.keyboard import keyboard_folder |
| 12 | from qmk.info import keymap_json | 12 | from qmk.info import keymap_json |
| @@ -118,7 +118,10 @@ class BuildTarget: | |||
| 118 | self.prepare_build(build_target=build_target, **env_vars) | 118 | self.prepare_build(build_target=build_target, **env_vars) |
| 119 | command = self.compile_command(build_target=build_target, dry_run=True, **env_vars) | 119 | command = self.compile_command(build_target=build_target, dry_run=True, **env_vars) |
| 120 | from qmk.cli.generate.compilation_database import write_compilation_database # Lazy load due to circular references | 120 | from qmk.cli.generate.compilation_database import write_compilation_database # Lazy load due to circular references |
| 121 | write_compilation_database(command=command, output_path=QMK_FIRMWARE / 'compile_commands.json', skip_clean=skip_clean, **env_vars) | 121 | output_path = QMK_FIRMWARE / 'compile_commands.json' |
| 122 | write_compilation_database(command=command, output_path=output_path, skip_clean=skip_clean, **env_vars) | ||
| 123 | if output_path.exists() and HAS_QMK_USERSPACE: | ||
| 124 | shutil.copy(str(output_path), str(QMK_USERSPACE / 'compile_commands.json')) | ||
| 122 | 125 | ||
| 123 | def compile(self, build_target: str = None, dry_run: bool = False, **env_vars) -> None: | 126 | def compile(self, build_target: str = None, dry_run: bool = False, **env_vars) -> None: |
| 124 | if self._clean or self._compiledb: | 127 | if self._clean or self._compiledb: |
