Skip to content

Options merge through extends-like option #3788

@turgu1

Description

@turgu1

Version: PlatformIO IDE V2.2.1
Editor: VSCode
OS: Linux

Hello, it would be beneficial that the following platformio.ini would merge options, such that in my (over simplified) example below, for [env:device1], there would be two entries in the build_flags option, instead of one (with the current version of platformio, builds_flags in [env:device1] replaces the one from devices when extends is used. I was expecting that there would be some merge option available):

[devices]
build_flags =
  -D MAIN_DEFINE=2

[env:device1]
extends_with_merge = devices
build_flags =
  -D OTHER_DEFINE=1

I could have added ${device.build_flags} under -D OTHER_DEFINE=1 but when you have many of these repeated options, it defeat the purpose of clarity. Here is a real example that would benefit from this feature (don't tell me to use [env] for this, the platformio.ini contains a lot more that can't rely on [env]):

[platformio]
default_envs = inkplate_6

[inkplate_common]
platform               = espressif32
board                  = esp-wrover-kit
framework              = espidf
monitor_speed          = 115200
upload_speed           = 256000
monitor_filters        = colorize
board_build.partitions = partitions.csv
build_flags =
  -O3
  -D DEBUGGING=0
  -D CONFIG_SPIRAM_CACHE_WORKAROUND
  -D EPUB_INKPLATE_BUILD=1
  -D EPUB_LINUX_BUILD=0
  -D INCLUDE_vTaskSuspend=1
  -D SHOW_TIMING=0
  !/usr/bin/pkg-config --cflags --libs lib_freetype/lib/pkgconfig/freetype2.pc
  -std=gnu++17
  -I include_global
lib_extra_dirs =
  lib_esp32
board_build.embed_files =
  embed/favicon.ico
  embed/upload_script.html
lib_deps =
  https://github.com/turgu1/ESP-IDF-InkPlate.git

[env:inkplate_6]
extends_with_merge     = inkplate_common
build_type  = release
build_flags =
  -D INKPLATE_6

[env:inkplate_6plus]
extends_with_merge     = inkplate_common
build_type  = release
build_flags =
  -D INKPLATE_6PLUS

[env:inkplate_10]
extends_with_merge     = inkplate_common
build_type  = release
build_flags =
  -D INKPLATE_10

Did I miss something from what is currently possible with the platform.ini structure? Is there another way to do it without compromising the clarity of the ini file? Maybe a new option named merges or something?
Thanks a lot for your help!!

Guy

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions