[espidf] Simplify the bootloader cache and fix Windows and lint failures

This commit is contained in:
J. Nick Koston
2026-09-29 19:55:27 +02:00
committed by GitHub
parent 2a45f5de3a
commit c0793563de
7 changed files with 242 additions and 217 deletions
+15 -3
View File
@@ -39,12 +39,22 @@ TOP_NINJA_LOG = "build/.ninja_log"
def _ninja_logs(build_path: Path) -> list[str]:
"""The mode comes from the configured tree, so a missing sub-build log
stays an error in the mode that requires one."""
logs = [TOP_NINJA_LOG]
if (build_path / "build" / "bootloader" / "build.ninja").is_file():
if not _uses_cached_bootloader(build_path):
logs.append("build/bootloader/.ninja_log")
return logs
def _uses_cached_bootloader(build_path: Path) -> bool:
cache = build_path / "build" / "CMakeCache.txt"
for line in cache.read_text(encoding="utf-8").splitlines():
if line.startswith("ESPHOME_USE_CACHED_BOOTLOADER:"):
return line.partition("=")[2].strip() == "1"
return False
BOOTLOADER_BYPRODUCT = re.compile(r"(^|/build/)bootloader/")
WORK_SUFFIXES = (".obj", ".o", ".a", ".elf", ".map", ".bin", ".ld")
DEFAULT_GLOB = "tests/test_build_components/build/.esphome/build/*"
@@ -119,8 +129,10 @@ def check(build_path: Path) -> list[str]:
if not bootloader.idf_macro_matches():
return [
"IDF changed __build_process_project_includes; update "
"IDF_BOOTLOADER_OVERRIDE in esphome/build_gen/espidf.py"
(
"IDF changed __build_process_project_includes; update "
"IDF_BOOTLOADER_OVERRIDE in esphome/build_gen/espidf.py"
)
]
env = toolchain._get_idf_env(version)
python = toolchain._get_idf_tool("python")