[core] Deduplicate entity type boilerplate with X-macro pattern (#15618)

This commit is contained in:
J. Nick Koston
2026-04-15 17:45:01 -10:00
committed by GitHub
parent 01b5bef37f
commit e7194dce75
12 changed files with 281 additions and 1055 deletions

View File

@@ -174,7 +174,12 @@ def build_all_include(header_files: list[str] | None = None) -> None:
if line
]
headers = [f'#include "{h}"' for h in header_files]
from esphome.writer import ENTITY_TYPES_H_TARGET
# X-macro files are included multiple times with different macro definitions
# and must not be included bare in the all-include header
exclude = {ENTITY_TYPES_H_TARGET}
headers = [f'#include "{h}"' for h in header_files if h not in exclude]
headers.sort()
headers.append("")
content = "\n".join(headers)