Skip to content

extends doesn't override options as it is described in documentation #4462

@stas-sl

Description

@stas-sl

What kind of issue is this?

  • PlatformIO Core.
    If you’ve found a bug, please provide an information below.

Configuration

Operating system: Mac OS 11.7.1

PlatformIO Version (platformio --version): 6.1.5

Description of problem

Documentations says:

If multiple items specified in the extends field then only values from the latter one will be used in the final configuration.

But in reality if multiple sections contain same options, then the value will be taken from the first one, not the last.

Steps to Reproduce

Basically, just copy the example from the documentation:

[base]
platform = teensy
framework = arduino
board = teensy31

[lib_deps1]
lib_deps =
    monstrenyatko/ArduinoMqtt @ ^1.5.1
    bblanchon/ArduinoJson @ ^6.18.3
    knolleary/PubSubClient @ ^2.8

[lib_deps2]
lib_deps =
    sstaub/Ticker @ ^4.3.0
    thijse/ArduinoLog @ ^1.1.1
    adafruit/RTClib @ ^1.14.0

[env:final]
extends = base, lib_deps1, lib_deps2
; The values from `lib_deps2` will override the values from lib_deps1, so
; the final `lib_deps` option will be equivalent to the following:
; lib_deps =
;    sstaub/Ticker @ ^4.3.0
;    thijse/ArduinoLog @ ^1.1.1
;    adafruit/RTClib @ ^1.14.0

and run pio project config:

> pio project config
Computed project configuration for .../test-extends
base
----
platform   =  teensy
framework  =  arduino
board      =  teensy31

lib_deps1
---------
lib_deps  =  monstrenyatko/ArduinoMqtt @ ^1.5.1
             bblanchon/ArduinoJson @ ^6.18.3
             knolleary/PubSubClient @ ^2.8

lib_deps2
---------
lib_deps  =  sstaub/Ticker @ ^4.3.0
             thijse/ArduinoLog @ ^1.1.1
             adafruit/RTClib @ ^1.14.0

env:final
---------
extends    =  base
              lib_deps1
              lib_deps2
platform   =  teensy
framework  =  arduino
board      =  teensy31
lib_deps   =  monstrenyatko/ArduinoMqtt @ ^1.5.1
              bblanchon/ArduinoJson @ ^6.18.3
              knolleary/PubSubClient @ ^2.8

Actual Results

You can see, that lib_deps option value is taken from lib_deps1 section which comes first in the extends list.

Expected Results

Options from latter sections overwrite options from previous sections as it is stated in the documentation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions