[config] Clean build on ESP-IDF when component/platform combos change (#9028)
CI for docker images / Build docker containers (docker, ubuntu-24.04) (push) Has been cancelled
CI for docker images / Build docker containers (docker, ubuntu-24.04-arm) (push) Has been cancelled
CI for docker images / Build docker containers (ha-addon, ubuntu-24.04) (push) Has been cancelled
CI for docker images / Build docker containers (ha-addon, ubuntu-24.04-arm) (push) Has been cancelled
CI / Create common environment (push) Has been cancelled
CI / Check ruff (push) Has been cancelled
CI / Check flake8 (push) Has been cancelled
CI / Check pylint (push) Has been cancelled
CI / Check pyupgrade (push) Has been cancelled
CI / Run script/ci-custom (push) Has been cancelled
CI / Run pytest (macOS-latest, 3.11) (push) Has been cancelled
CI / Run pytest (ubuntu-latest, 3.10) (push) Has been cancelled
CI / Run pytest (ubuntu-latest, 3.11) (push) Has been cancelled
CI / Run pytest (ubuntu-latest, 3.12) (push) Has been cancelled
CI / Run pytest (ubuntu-latest, 3.13) (push) Has been cancelled
CI / Run pytest (windows-latest, 3.11) (push) Has been cancelled
CI / Check clang-format (push) Has been cancelled
CI / Run script/clang-tidy for ESP32 Arduino 1/4 (push) Has been cancelled
CI / Run script/clang-tidy for ESP32 Arduino 2/4 (push) Has been cancelled
CI / Run script/clang-tidy for ESP32 Arduino 3/4 (push) Has been cancelled
CI / Run script/clang-tidy for ESP32 Arduino 4/4 (push) Has been cancelled
CI / Run script/clang-tidy for ESP32 IDF (push) Has been cancelled
CI / Run script/clang-tidy for ESP8266 (push) Has been cancelled
CI / Run script/clang-tidy for ZEPHYR (push) Has been cancelled
CI / list-components (push) Has been cancelled
CI / Component test ${{ matrix.file }} (push) Has been cancelled
CI / Split components for testing into 20 groups maximum (push) Has been cancelled
CI / Test split components (push) Has been cancelled
CI / CI Status (push) Has been cancelled
Synchronise Device Classes from Home Assistant / Sync Device Classes (push) Has been cancelled
Stale / stale (push) Has been cancelled
Stale / close-issues (push) Has been cancelled
Lock / lock (push) Has been cancelled
Publish Release / Initialize build (push) Has been cancelled
Publish Release / Build and publish to PyPi (push) Has been cancelled
Publish Release / Build ESPHome amd64 (push) Has been cancelled
Publish Release / Build ESPHome arm64 (push) Has been cancelled
Publish Release / Publish ESPHome docker to dockerhub (push) Has been cancelled
Publish Release / Publish ESPHome docker to ghcr (push) Has been cancelled
Publish Release / Publish ESPHome ha-addon to dockerhub (push) Has been cancelled
Publish Release / Publish ESPHome ha-addon to ghcr (push) Has been cancelled
Publish Release / deploy-ha-addon-repo (push) Has been cancelled
Publish Release / deploy-esphome-schema (push) Has been cancelled

This commit is contained in:
Clyde Stubbs
2025-06-09 08:39:02 +10:00
committed by GitHub
parent 9cc2a04d54
commit 4d044d4ac9
4 changed files with 20 additions and 6 deletions
+1
View File
@@ -389,6 +389,7 @@ class LoadValidationStep(ConfigValidationStep):
result.add_str_error(f"Platform not found: '{p_domain}'", path)
continue
CORE.loaded_integrations.add(p_name)
CORE.loaded_platforms.add(f"{self.domain}/{p_name}")
# Process AUTO_LOAD
for load in platform.auto_load:
+2
View File
@@ -512,6 +512,8 @@ class EsphomeCore:
self.platformio_options: dict[str, str | list[str]] = {}
# A set of strings of names of loaded integrations, used to find namespace ID conflicts
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
self.component_ids = set()
# Whether ESPHome was started in verbose mode
+13 -5
View File
@@ -46,15 +46,16 @@ class StorageJSON:
storage_version: int,
name: str,
friendly_name: str,
comment: str,
esphome_version: str,
comment: str | None,
esphome_version: str | None,
src_version: int | None,
address: str,
web_port: int | None,
target_platform: str,
build_path: str,
firmware_bin_path: str,
build_path: str | None,
firmware_bin_path: str | None,
loaded_integrations: set[str],
loaded_platforms: set[str],
no_mdns: bool,
framework: str | None = None,
core_platform: str | None = None,
@@ -86,6 +87,8 @@ class StorageJSON:
self.firmware_bin_path = firmware_bin_path
# A set of strings of names of loaded integrations
self.loaded_integrations = loaded_integrations
# A set of strings for platform/integration combos
self.loaded_platforms = loaded_platforms
# Is mDNS disabled
self.no_mdns = no_mdns
# The framework used to compile the firmware
@@ -107,6 +110,7 @@ class StorageJSON:
"build_path": self.build_path,
"firmware_bin_path": self.firmware_bin_path,
"loaded_integrations": sorted(self.loaded_integrations),
"loaded_platforms": sorted(self.loaded_platforms),
"no_mdns": self.no_mdns,
"framework": self.framework,
"core_platform": self.core_platform,
@@ -138,6 +142,7 @@ class StorageJSON:
build_path=esph.build_path,
firmware_bin_path=esph.firmware_bin,
loaded_integrations=esph.loaded_integrations,
loaded_platforms=esph.loaded_platforms,
no_mdns=(
CONF_MDNS in esph.config
and CONF_DISABLED in esph.config[CONF_MDNS]
@@ -164,6 +169,7 @@ class StorageJSON:
build_path=None,
firmware_bin_path=None,
loaded_integrations=set(),
loaded_platforms=set(),
no_mdns=False,
framework=None,
core_platform=platform.lower(),
@@ -187,6 +193,7 @@ class StorageJSON:
build_path = storage.get("build_path")
firmware_bin_path = storage.get("firmware_bin_path")
loaded_integrations = set(storage.get("loaded_integrations", []))
loaded_platforms = set(storage.get("loaded_platforms", []))
no_mdns = storage.get("no_mdns", False)
framework = storage.get("framework")
core_platform = storage.get("core_platform")
@@ -203,6 +210,7 @@ class StorageJSON:
build_path,
firmware_bin_path,
loaded_integrations,
loaded_platforms,
no_mdns,
framework,
core_platform,
@@ -252,7 +260,7 @@ class EsphomeStorageJSON:
def last_update_check(self, new: datetime) -> None:
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"
def save(self, path: str) -> None:
+4 -1
View File
@@ -107,7 +107,10 @@ def storage_should_clean(old: StorageJSON, new: StorageJSON) -> bool:
return True
if old.build_path != new.build_path:
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:
from esphome.components.esp32 import FRAMEWORK_ESP_IDF