mirror of
https://github.com/esphome/esphome.git
synced 2025-07-28 14:16:40 +00:00
[config] Clean build on ESP-IDF when component/platform combos change (#9028)
This commit is contained in:
parent
9cc2a04d54
commit
4d044d4ac9
@ -389,6 +389,7 @@ class LoadValidationStep(ConfigValidationStep):
|
|||||||
result.add_str_error(f"Platform not found: '{p_domain}'", path)
|
result.add_str_error(f"Platform not found: '{p_domain}'", path)
|
||||||
continue
|
continue
|
||||||
CORE.loaded_integrations.add(p_name)
|
CORE.loaded_integrations.add(p_name)
|
||||||
|
CORE.loaded_platforms.add(f"{self.domain}/{p_name}")
|
||||||
|
|
||||||
# Process AUTO_LOAD
|
# Process AUTO_LOAD
|
||||||
for load in platform.auto_load:
|
for load in platform.auto_load:
|
||||||
|
@ -512,6 +512,8 @@ class EsphomeCore:
|
|||||||
self.platformio_options: dict[str, str | list[str]] = {}
|
self.platformio_options: dict[str, str | list[str]] = {}
|
||||||
# A set of strings of names of loaded integrations, used to find namespace ID conflicts
|
# A set of strings of names of loaded integrations, used to find namespace ID conflicts
|
||||||
self.loaded_integrations = set()
|
self.loaded_integrations = set()
|
||||||
|
# A set of strings for platform/integration combos
|
||||||
|
self.loaded_platforms: set[str] = set()
|
||||||
# A set of component IDs to track what Component subclasses are declared
|
# A set of component IDs to track what Component subclasses are declared
|
||||||
self.component_ids = set()
|
self.component_ids = set()
|
||||||
# Whether ESPHome was started in verbose mode
|
# Whether ESPHome was started in verbose mode
|
||||||
|
@ -46,15 +46,16 @@ class StorageJSON:
|
|||||||
storage_version: int,
|
storage_version: int,
|
||||||
name: str,
|
name: str,
|
||||||
friendly_name: str,
|
friendly_name: str,
|
||||||
comment: str,
|
comment: str | None,
|
||||||
esphome_version: str,
|
esphome_version: str | None,
|
||||||
src_version: int | None,
|
src_version: int | None,
|
||||||
address: str,
|
address: str,
|
||||||
web_port: int | None,
|
web_port: int | None,
|
||||||
target_platform: str,
|
target_platform: str,
|
||||||
build_path: str,
|
build_path: str | None,
|
||||||
firmware_bin_path: str,
|
firmware_bin_path: str | None,
|
||||||
loaded_integrations: set[str],
|
loaded_integrations: set[str],
|
||||||
|
loaded_platforms: set[str],
|
||||||
no_mdns: bool,
|
no_mdns: bool,
|
||||||
framework: str | None = None,
|
framework: str | None = None,
|
||||||
core_platform: str | None = None,
|
core_platform: str | None = None,
|
||||||
@ -86,6 +87,8 @@ class StorageJSON:
|
|||||||
self.firmware_bin_path = firmware_bin_path
|
self.firmware_bin_path = firmware_bin_path
|
||||||
# A set of strings of names of loaded integrations
|
# A set of strings of names of loaded integrations
|
||||||
self.loaded_integrations = loaded_integrations
|
self.loaded_integrations = loaded_integrations
|
||||||
|
# A set of strings for platform/integration combos
|
||||||
|
self.loaded_platforms = loaded_platforms
|
||||||
# Is mDNS disabled
|
# Is mDNS disabled
|
||||||
self.no_mdns = no_mdns
|
self.no_mdns = no_mdns
|
||||||
# The framework used to compile the firmware
|
# The framework used to compile the firmware
|
||||||
@ -107,6 +110,7 @@ class StorageJSON:
|
|||||||
"build_path": self.build_path,
|
"build_path": self.build_path,
|
||||||
"firmware_bin_path": self.firmware_bin_path,
|
"firmware_bin_path": self.firmware_bin_path,
|
||||||
"loaded_integrations": sorted(self.loaded_integrations),
|
"loaded_integrations": sorted(self.loaded_integrations),
|
||||||
|
"loaded_platforms": sorted(self.loaded_platforms),
|
||||||
"no_mdns": self.no_mdns,
|
"no_mdns": self.no_mdns,
|
||||||
"framework": self.framework,
|
"framework": self.framework,
|
||||||
"core_platform": self.core_platform,
|
"core_platform": self.core_platform,
|
||||||
@ -138,6 +142,7 @@ class StorageJSON:
|
|||||||
build_path=esph.build_path,
|
build_path=esph.build_path,
|
||||||
firmware_bin_path=esph.firmware_bin,
|
firmware_bin_path=esph.firmware_bin,
|
||||||
loaded_integrations=esph.loaded_integrations,
|
loaded_integrations=esph.loaded_integrations,
|
||||||
|
loaded_platforms=esph.loaded_platforms,
|
||||||
no_mdns=(
|
no_mdns=(
|
||||||
CONF_MDNS in esph.config
|
CONF_MDNS in esph.config
|
||||||
and CONF_DISABLED in esph.config[CONF_MDNS]
|
and CONF_DISABLED in esph.config[CONF_MDNS]
|
||||||
@ -164,6 +169,7 @@ class StorageJSON:
|
|||||||
build_path=None,
|
build_path=None,
|
||||||
firmware_bin_path=None,
|
firmware_bin_path=None,
|
||||||
loaded_integrations=set(),
|
loaded_integrations=set(),
|
||||||
|
loaded_platforms=set(),
|
||||||
no_mdns=False,
|
no_mdns=False,
|
||||||
framework=None,
|
framework=None,
|
||||||
core_platform=platform.lower(),
|
core_platform=platform.lower(),
|
||||||
@ -187,6 +193,7 @@ class StorageJSON:
|
|||||||
build_path = storage.get("build_path")
|
build_path = storage.get("build_path")
|
||||||
firmware_bin_path = storage.get("firmware_bin_path")
|
firmware_bin_path = storage.get("firmware_bin_path")
|
||||||
loaded_integrations = set(storage.get("loaded_integrations", []))
|
loaded_integrations = set(storage.get("loaded_integrations", []))
|
||||||
|
loaded_platforms = set(storage.get("loaded_platforms", []))
|
||||||
no_mdns = storage.get("no_mdns", False)
|
no_mdns = storage.get("no_mdns", False)
|
||||||
framework = storage.get("framework")
|
framework = storage.get("framework")
|
||||||
core_platform = storage.get("core_platform")
|
core_platform = storage.get("core_platform")
|
||||||
@ -203,6 +210,7 @@ class StorageJSON:
|
|||||||
build_path,
|
build_path,
|
||||||
firmware_bin_path,
|
firmware_bin_path,
|
||||||
loaded_integrations,
|
loaded_integrations,
|
||||||
|
loaded_platforms,
|
||||||
no_mdns,
|
no_mdns,
|
||||||
framework,
|
framework,
|
||||||
core_platform,
|
core_platform,
|
||||||
@ -252,7 +260,7 @@ class EsphomeStorageJSON:
|
|||||||
def last_update_check(self, new: datetime) -> None:
|
def last_update_check(self, new: datetime) -> None:
|
||||||
self.last_update_check_str = new.strftime("%Y-%m-%dT%H:%M:%S")
|
self.last_update_check_str = new.strftime("%Y-%m-%dT%H:%M:%S")
|
||||||
|
|
||||||
def to_json(self) -> dict:
|
def to_json(self) -> str:
|
||||||
return f"{json.dumps(self.as_dict(), indent=2)}\n"
|
return f"{json.dumps(self.as_dict(), indent=2)}\n"
|
||||||
|
|
||||||
def save(self, path: str) -> None:
|
def save(self, path: str) -> None:
|
||||||
|
@ -107,7 +107,10 @@ def storage_should_clean(old: StorageJSON, new: StorageJSON) -> bool:
|
|||||||
return True
|
return True
|
||||||
if old.build_path != new.build_path:
|
if old.build_path != new.build_path:
|
||||||
return True
|
return True
|
||||||
if old.loaded_integrations != new.loaded_integrations:
|
if (
|
||||||
|
old.loaded_integrations != new.loaded_integrations
|
||||||
|
or old.loaded_platforms != new.loaded_platforms
|
||||||
|
):
|
||||||
if new.core_platform == PLATFORM_ESP32:
|
if new.core_platform == PLATFORM_ESP32:
|
||||||
from esphome.components.esp32 import FRAMEWORK_ESP_IDF
|
from esphome.components.esp32 import FRAMEWORK_ESP_IDF
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user