Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance YAML Parser (RDT-630) #106

Closed
hfudev opened this issue Dec 28, 2023 · 0 comments · Fixed by #118
Closed

Enhance YAML Parser (RDT-630) #106

hfudev opened this issue Dec 28, 2023 · 0 comments · Fixed by #118
Labels
enhancement New feature or request

Comments

@hfudev
Copy link
Member

hfudev commented Dec 28, 2023

The vanilla yaml does not support reuse arrays, the merge only happens with different keys.

Support + and - as postfixes to reuse arrays.

.base_depends_components: &base-depends-components
  depends_components:
    - esp_hw_support
    - esp_rom
    - esp_wifi
  
examples/wifi/coexist:
  <<: *base-depends-components
  depends_components+:
    - esp_coex
  depends_components-:
    - esp_rom

Will be interpreted into

examples/wifi/coexist:
  depends_components:
    - esp_hw_support
    - esp_wifi
    - esp_coex

The + and - here could be used on all keywords that could be used as a dict key, like depends_components, depends_filepatterns, disable, enable, ...

The way that how items defined in the + and - matching with the original ones must be flexible. For example, in each if-clause defined under the enable key, we support three keywords: if, temp, reason. if should be the match key here.

For example,

.base: &base
  enable:
    - if: IDF_VERSION == "5.2.0"
    - if: IDF_VERSION == "5.3.0"

foo:
  <<: *base
  enable+:
    - if: IDF_VERSION == "5.2.0"
      temp: true  # <-- This line should not be added, since the `if` is the matching key, and the `if` statement is the same.
    - if: IDF_VERSION == "5.4.0"
      reason: bar

Will be interpreted into

foo:
  enable:
    - if: IDF_VERSION == "5.2.0"
    - if: IDF_VERSION == "5.3.0"
    - if: IDF_VERSION == "5.4.0"
      reason: bar

Create a subpackage idf_build_apps.yaml for this new yaml parser. This could be reused elsewhere.

@github-actions github-actions bot changed the title Enhance YAML Parser Enhance YAML Parser (RDT-630) Dec 28, 2023
@hfudev hfudev added the enhancement New feature or request label Dec 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant