[core] Only clean build files with esp-idf (#7388)
Some checks are pending
CI / Check flake8 (push) Blocked by required conditions
CI / Test split components (push) Blocked by required conditions
CI / Create common environment (push) Waiting to run
CI / Check black (push) Blocked by required conditions
CI / Check pylint (push) Blocked by required conditions
CI / Check pyupgrade (push) Blocked by required conditions
CI / Run script/ci-custom (push) Blocked by required conditions
CI / Run pytest (macOS-latest, 3.11) (push) Blocked by required conditions
CI / Run pytest (ubuntu-latest, 3.10) (push) Blocked by required conditions
CI / Run pytest (ubuntu-latest, 3.11) (push) Blocked by required conditions
CI / Run pytest (ubuntu-latest, 3.12) (push) Blocked by required conditions
CI / Run pytest (ubuntu-latest, 3.9) (push) Blocked by required conditions
CI / Run pytest (windows-latest, 3.11) (push) Blocked by required conditions
CI / Check clang-format (push) Blocked by required conditions
CI / Run script/clang-tidy for ESP32 Arduino 1/4 (push) Blocked by required conditions
CI / Run script/clang-tidy for ESP32 Arduino 2/4 (push) Blocked by required conditions
CI / Run script/clang-tidy for ESP32 Arduino 3/4 (push) Blocked by required conditions
CI / Run script/clang-tidy for ESP32 Arduino 4/4 (push) Blocked by required conditions
CI / Run script/clang-tidy for ESP32 IDF (push) Blocked by required conditions
CI / Run script/clang-tidy for ESP8266 (push) Blocked by required conditions
CI / list-components (push) Blocked by required conditions
CI / Component test ${{ matrix.file }} (push) Blocked by required conditions
CI / Split components for testing into 20 groups maximum (push) Blocked by required conditions
CI / CI Status (push) Blocked by required conditions

This commit is contained in:
Jesse Hills 2024-09-02 19:11:21 +12:00 committed by GitHub
parent 854bafbd4a
commit ca8e45cf4c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 21 additions and 1 deletions

View file

@ -48,6 +48,8 @@ class StorageJSON:
firmware_bin_path: str, firmware_bin_path: str,
loaded_integrations: set[str], loaded_integrations: set[str],
no_mdns: bool, no_mdns: bool,
framework: str | None = None,
core_platform: str | None = None,
) -> None: ) -> None:
# Version of the storage JSON schema # Version of the storage JSON schema
assert storage_version is None or isinstance(storage_version, int) assert storage_version is None or isinstance(storage_version, int)
@ -78,6 +80,10 @@ class StorageJSON:
self.loaded_integrations = loaded_integrations self.loaded_integrations = loaded_integrations
# Is mDNS disabled # Is mDNS disabled
self.no_mdns = no_mdns self.no_mdns = no_mdns
# The framework used to compile the firmware
self.framework = framework
# The core platform of this firmware. Like "esp32", "rp2040", "host" etc.
self.core_platform = core_platform
def as_dict(self): def as_dict(self):
return { return {
@ -94,6 +100,8 @@ class StorageJSON:
"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),
"no_mdns": self.no_mdns, "no_mdns": self.no_mdns,
"framework": self.framework,
"core_platform": self.core_platform,
} }
def to_json(self): def to_json(self):
@ -127,6 +135,8 @@ class StorageJSON:
and CONF_DISABLED in esph.config[CONF_MDNS] and CONF_DISABLED in esph.config[CONF_MDNS]
and esph.config[CONF_MDNS][CONF_DISABLED] is True and esph.config[CONF_MDNS][CONF_DISABLED] is True
), ),
framework=esph.target_framework,
core_platform=esph.target_platform,
) )
@staticmethod @staticmethod
@ -147,6 +157,8 @@ class StorageJSON:
firmware_bin_path=None, firmware_bin_path=None,
loaded_integrations=set(), loaded_integrations=set(),
no_mdns=False, no_mdns=False,
framework=None,
core_platform=platform.lower(),
) )
@staticmethod @staticmethod
@ -168,6 +180,8 @@ class StorageJSON:
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", []))
no_mdns = storage.get("no_mdns", False) no_mdns = storage.get("no_mdns", False)
framework = storage.get("framework")
core_platform = storage.get("core_platform")
return StorageJSON( return StorageJSON(
storage_version, storage_version,
name, name,
@ -182,6 +196,8 @@ class StorageJSON:
firmware_bin_path, firmware_bin_path,
loaded_integrations, loaded_integrations,
no_mdns, no_mdns,
framework,
core_platform,
) )
@staticmethod @staticmethod

View file

@ -9,6 +9,7 @@ from esphome.config import iter_component_configs, iter_components
from esphome.const import ( from esphome.const import (
ENV_NOGITIGNORE, ENV_NOGITIGNORE,
HEADER_FILE_EXTENSIONS, HEADER_FILE_EXTENSIONS,
PLATFORM_ESP32,
SOURCE_FILE_EXTENSIONS, SOURCE_FILE_EXTENSIONS,
__version__, __version__,
) )
@ -107,7 +108,10 @@ def storage_should_clean(old: StorageJSON, new: StorageJSON) -> bool:
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:
return True if new.core_platform == PLATFORM_ESP32:
from esphome.components.esp32 import FRAMEWORK_ESP_IDF
return new.framework == FRAMEWORK_ESP_IDF
return False return False