mirror of
https://github.com/esphome/esphome.git
synced 2025-10-30 06:33:51 +00:00
[core] Fix clean build files to properly clear PlatformIO cache
This commit is contained in:
@@ -694,6 +694,15 @@ class EsphomeCore:
|
||||
def relative_piolibdeps_path(self, *path):
|
||||
return self.relative_build_path(".piolibdeps", *path)
|
||||
|
||||
@property
|
||||
def platformio_cache_dir(self) -> str:
|
||||
"""Get the PlatformIO cache directory path."""
|
||||
# Check if running in Docker/HA addon with custom cache dir
|
||||
if cache_dir := os.environ.get("PLATFORMIO_CACHE_DIR"):
|
||||
return cache_dir
|
||||
# Default PlatformIO cache location
|
||||
return os.path.expanduser("~/.platformio/.cache")
|
||||
|
||||
@property
|
||||
def firmware_bin(self):
|
||||
if self.is_libretiny:
|
||||
|
||||
@@ -315,6 +315,13 @@ def clean_build():
|
||||
_LOGGER.info("Deleting %s", dependencies_lock)
|
||||
os.remove(dependencies_lock)
|
||||
|
||||
# Clean PlatformIO cache to resolve CMake compiler detection issues
|
||||
# This helps when toolchain paths change or get corrupted
|
||||
cache_dir = CORE.platformio_cache_dir
|
||||
if os.path.isdir(cache_dir):
|
||||
_LOGGER.info("Deleting PlatformIO cache %s", cache_dir)
|
||||
shutil.rmtree(cache_dir)
|
||||
|
||||
|
||||
GITIGNORE_CONTENT = """# Gitignore settings for ESPHome
|
||||
# This is an example and may include too much for your use-case.
|
||||
|
||||
Reference in New Issue
Block a user