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

Support if clauses in depends_components and depends_filepatterns (RDT-628) #105

Closed
hfudev opened this issue Dec 27, 2023 · 3 comments · Fixed by #117
Closed

Support if clauses in depends_components and depends_filepatterns (RDT-628) #105

hfudev opened this issue Dec 27, 2023 · 3 comments · Fixed by #117
Labels
enhancement New feature or request

Comments

@hfudev
Copy link
Member

hfudev commented Dec 27, 2023

For example

folder_foo:
  depends_components:
    - if: IDF_VERSION == "5.2.0":
      components: ["esp_eth"]
    - if: IDF_VERSION == "5.3.0":
      components: ["esp_wifi"]
    - components: ["esp_eth", "esp_wifi"]

To keep the similarity with others, here the folder rule should also apply the first matched if statement. but on extra, we support one more "default" switch case.

explanation:

  • if idf 5.2.0, depends_components: esp_eth
  • if idf 5.3.0, depends_components: esp_wifi
  • by default (other cases), depends_components: esp_eth, esp_wifi

depends_filepatterns should be something alike.

This is also helpful when one folder contains different sdkconfig file. For example

folder_foo:
  depends_components:
    - if: CONFIG_NAME == "wifi":
      components: ["esp_wifi"]
    - if: CONFIG_NAME == "eth":
      components: ["esp_eth"]
    - components: ["hal"]
@hfudev hfudev added the enhancement New feature or request label Dec 27, 2023
@github-actions github-actions bot changed the title Support if clauses in depends_components and depends_filepatterns Support if clauses in depends_components and depends_filepatterns (RDT-628) Dec 27, 2023
@ydc-0
Copy link
Contributor

ydc-0 commented Dec 28, 2023

There is another usage case, can you consider supporting something like base_depends?

examples/wifi:   # or anchor
  base_depends_components:
    esp_hw_support
    esp_rom
    esp_wifi

examples/wifi/coexist:
  add_components:
    esp_coex

@hfudev
Copy link
Member Author

hfudev commented Dec 28, 2023

@ydc-0 I think we should avoid adding more and more keywords. Maybe we can support a new feature that enhance the original yaml? That could help make the yaml anchor more useful.

For example

.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, ...

Creating another ticket for this feature. Created here: #106

@hfudev
Copy link
Member Author

hfudev commented Jan 10, 2024

This use case is more practical.

Assume we're testing an ota related example, one config sdkconfig.eth is using ethernet, another config sdkconfig.wifi is using wifi

folder_foo:
  depends_components:
    - if: CONFIG_NAME == "eth"
      components: ["esp_eth"]
    - if: CONFIG_NAME == "wifi":
      components: ["esp_wifi"]

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.

2 participants