1
0
mirror of https://github.com/esphome/esphome.git synced 2025-06-19 06:45:49 +01:00

Allow compilation against IDF from repository ()

* Fix src_filter in platformio.ini after src_dir change

* Add -Wno-nonnull-compare to platformio.ini as well

* Create default sdkconfig for static analysis

* Add more compiler flags to clang ignore list

* Clean-up platformio.ini

* Remove unnecessary blank line

* Fix accidentally dropped library

* Don't gitignore sdkconfig.defaults

Co-authored-by: Otto winter <otto@otto-winter.com>
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
This commit is contained in:
Oxan van Leeuwen
2021-09-21 17:12:17 +02:00
committed by GitHub
parent 92a24d52be
commit 637b55bfbf
5 changed files with 85 additions and 67 deletions

@ -112,11 +112,6 @@ def git_ls_files(patterns=None):
return {s[3].strip(): int(s[0]) for s in lines}
IDF_TIDY_SDKCONFIG = """\
CONFIG_BT_ENABLED=y
"""
def load_idedata(environment):
platformio_ini = Path(root_path) / "platformio.ini"
temp_idedata = Path(temp_folder) / f"idedata-{environment}.json"
@ -126,30 +121,26 @@ def load_idedata(environment):
elif platformio_ini.stat().st_mtime >= temp_idedata.stat().st_mtime:
changed = True
if environment == "esp32-idf-tidy":
# sdkconfig needs to be written before idedata is run
# but the file is also modified by the build process, so
# store a temp file to keep track of the
if "idf" in environment:
# remove full sdkconfig when the defaults have changed so that it is regenerated
default_sdkconfig = Path(root_path) / "sdkconfig.defaults"
temp_sdkconfig = Path(temp_folder) / f"sdkconfig-{environment}"
sdk_internal = Path(temp_folder) / f"{environment}-internal-sdkconfig"
sdkconfig = Path(root_path) / f"sdkconfig.{environment}"
if (
changed
or not sdk_internal.is_file()
or sdk_internal.read_text() != IDF_TIDY_SDKCONFIG
):
if not temp_sdkconfig.is_file():
changed = True
elif default_sdkconfig.stat().st_mtime >= temp_sdkconfig.stat().st_mtime:
temp_sdkconfig.unlink()
changed = True
sdkconfig.write_text(IDF_TIDY_SDKCONFIG)
sdk_internal.parent.mkdir(exist_ok=True)
sdk_internal.write_text(IDF_TIDY_SDKCONFIG)
if not changed:
return json.loads(temp_idedata.read_text())
# ensure temp directory exists before running pio, as it writes sdkconfig to it
Path(temp_folder).mkdir(exist_ok=True)
stdout = subprocess.check_output(["pio", "run", "-t", "idedata", "-e", environment])
match = re.search(r'{\s*".*}', stdout.decode("utf-8"))
data = json.loads(match.group())
temp_idedata.parent.mkdir(exist_ok=True)
temp_idedata.write_text(json.dumps(data, indent=2) + "\n")
return data