[core] Exclude entity_types.h from generated esphome.h

The X-macro file requires ENTITY_TYPE_ and ENTITY_CONTROLLER_TYPE_
macros to be defined before inclusion. The generated esphome.h includes
all .h files bare, which causes compilation errors.
This commit is contained in:
J. Nick Koston
2026-04-09 14:46:23 -10:00
parent affb20a9cf
commit dc596bfa75
+4 -1
View File
@@ -196,9 +196,12 @@ def copy_src_tree():
source_files_l.sort()
# Build #include list for esphome.h
# X-macro files are included multiple times with different macro definitions
# and must not be included bare in esphome.h
esphome_h_exclude = {Path("esphome/core/entity_types.h")}
include_l = []
for target, _ in source_files_l:
if target.suffix in HEADER_FILE_EXTENSIONS:
if target.suffix in HEADER_FILE_EXTENSIONS and target not in esphome_h_exclude:
include_l.append(f'#include "{target}"')
include_l.append("")
include_s = "\n".join(include_l)