mirror of
https://github.com/esphome/esphome.git
synced 2024-11-10 09:17:46 +01:00
Merge build flags from platformio_options (#1651)
This commit is contained in:
parent
3749c11f21
commit
1f5cbca509
1 changed files with 9 additions and 8 deletions
|
@ -72,9 +72,7 @@ upload_flags =
|
|||
""",
|
||||
)
|
||||
|
||||
UPLOAD_SPEED_OVERRIDE = {
|
||||
"esp210": 57600,
|
||||
}
|
||||
UPLOAD_SPEED_OVERRIDE = {"esp210": 57600}
|
||||
|
||||
|
||||
def get_flags(key):
|
||||
|
@ -210,11 +208,12 @@ def gather_lib_deps():
|
|||
return [x.as_lib_dep for x in CORE.libraries]
|
||||
|
||||
|
||||
def gather_build_flags():
|
||||
build_flags = CORE.build_flags
|
||||
def gather_build_flags(overrides):
|
||||
build_flags = list(CORE.build_flags)
|
||||
build_flags += [overrides] if isinstance(overrides, str) else overrides
|
||||
|
||||
# avoid changing build flags order
|
||||
return list(sorted(list(build_flags)))
|
||||
return list(sorted(build_flags))
|
||||
|
||||
|
||||
ESP32_LARGE_PARTITIONS_CSV = """\
|
||||
|
@ -228,8 +227,10 @@ spiffs, data, spiffs, 0x391000, 0x00F000
|
|||
|
||||
|
||||
def get_ini_content():
|
||||
overrides = CORE.config[CONF_ESPHOME].get(CONF_PLATFORMIO_OPTIONS, {})
|
||||
|
||||
lib_deps = gather_lib_deps()
|
||||
build_flags = gather_build_flags()
|
||||
build_flags = gather_build_flags(overrides.pop("build_flags", []))
|
||||
|
||||
data = {
|
||||
"platform": CORE.arduino_version,
|
||||
|
@ -275,7 +276,7 @@ def get_ini_content():
|
|||
# Ignore libraries that are not explicitly used, but may
|
||||
# be added by LDF
|
||||
# data['lib_ldf_mode'] = 'chain'
|
||||
data.update(CORE.config[CONF_ESPHOME].get(CONF_PLATFORMIO_OPTIONS, {}))
|
||||
data.update(overrides)
|
||||
|
||||
content = f"[env:{CORE.name}]\n"
|
||||
content += format_ini(data)
|
||||
|
|
Loading…
Reference in a new issue