mirror of
https://github.com/esphome/esphome.git
synced 2026-09-11 15:27:33 +00:00
Drop the relative-path branch; compile databases record absolute paths
This commit is contained in:
@@ -212,18 +212,6 @@ _PCH_STRIP_FLAGS_WITH_ARG = frozenset({"-o", "-c", "-MT", "-MF", "-MQ"})
|
||||
_PCH_STRIP_FLAGS = frozenset({"-MD", "-MMD", "-MP", "-MM", "-M"})
|
||||
|
||||
|
||||
def _db_source_path(entry: dict, build_dir: Path) -> Path:
|
||||
"""A compile database entry's source file as a resolved absolute path."""
|
||||
path = Path(entry["file"])
|
||||
if not path.is_absolute():
|
||||
directory = entry.get("directory")
|
||||
base = (
|
||||
Path(directory) if isinstance(directory, str) and directory else build_dir
|
||||
)
|
||||
path = base / path
|
||||
return path.resolve()
|
||||
|
||||
|
||||
def pch_compile_command(
|
||||
build_dir: Path, header: Path, gch: Path
|
||||
) -> tuple[list[str], Path] | None:
|
||||
@@ -254,7 +242,7 @@ def pch_compile_command(
|
||||
if isinstance(e, dict)
|
||||
and isinstance(e.get("file"), str)
|
||||
and e["file"].endswith(CXX_SOURCE_SUFFIXES)
|
||||
and _db_source_path(e, build_dir).is_relative_to(src_root)
|
||||
and Path(e["file"]).resolve().is_relative_to(src_root)
|
||||
),
|
||||
None,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user