-
Notifications
You must be signed in to change notification settings - Fork 732
Cherry-pick Extended build info #2593
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This introductory commit refactors the `yaml_set` function separating the bodies of list operations into internal functions while preserving their original behavior. The conditions that cause the value to be interpreted as a list are also verified only once, avoiding multiple checks. Signed-off-by: Luca Burelli <l.burelli@arduino.cc> (cherry picked from commit cf5607f)
This commit adds support for generator expressions in values and lists to the yaml module. Generator expressions can only be expanded by CMake after all configuration code has been executed and the final values of the project properties are defined. This means that contexts that contain generator expressions are written twice: - immediately, during the 'yaml_save()' call, a comment with the raw unexpanded string is saved instead of the key that uses generator expressions in the YAML file; - after the configuration step, a custom command updates the YAML file contents with the fully expanded values. This two-step process also allows to overcome the issue of lists that are extracted from generator expressions, whose elements would be expanded into a single string if written directly to the YAML file. Instead, the lists are stored in their CMake string format with a special marker, expanded by CMake into a temporary JSON file, and the conversion to a proper list is performed during the build step. If the saved YAML file for context <name> is needed by further build steps in this project, the target '<name>_yaml_saved' must be added as a dependency to ensure the final contents are ready. Note that when generator expressions are used in the context, the GENEX keyword must be provided to yaml_set(). This is necessary to avoid storing the genexes as raw strings in the YAML. Signed-off-by: Luca Burelli <l.burelli@arduino.cc> (cherry picked from commit cdc7f05)
Use a more concise way to append to a list property, as suggested in a previous PR review. Signed-off-by: Luca Burelli <l.burelli@arduino.cc> (cherry picked from commit 8e66848)
The schema for build info already contained a `board:path` sequence tag definition, but boards.cmake did not populate this in the generated build_info.yml. Fix this by correctly populating the `board:path` with list of board directories. Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no> (cherry picked from commit b78c269)
This commit introduce support for maps in a yaml list. The yaml_set() function has been extended with the following signature: > yaml_set(NAME <name> KEY <key>... > [APPEND] LIST MAP <map1> MAP <map2> MAP ... > ) where a `MAP <map>` has the form: `MAP "<key1>: <value1>, <key2>: <value2>, ...` Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no> (cherry picked from commit 0828d0b)
Add 'images' as valid list in build info schema. This allow sysbuild and regular Zephyr images to populate build_info.yml with images included in the build. Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no> (cherry picked from commit 4061311)
Populate the build_info.yml created by sysbuild CMake with list of images and write the build info file afterwards. This allows users and external tools to examine which images was included in the build even if one or more of those images fails CMake configure or generate stage. Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no> (cherry picked from commit 642e948)
Escape the json input string given to `to_yaml()` function and the content given to `yaml_set()` function. This ensures that a string like `foo\bar` becomes `foo\\bar` during internal CMake json processing and when written to the file it becomes `foo\bar`. Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no> (cherry picked from commit cdbe424)
Do not escape single escaped quote '\"'. A single escape quote in CMake indicates the use of literal '"'. Escaping those results in '\\"' which is a literal '\' and a quote which encapsulates a string. This is a result we do not want. Therefore, exempt the '\"' sequence from further escaping. Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no> (cherry picked from commit 991396c)
f46c86d to
651f056
Compare
nordicjm
approved these changes
Mar 10, 2025
kylebonnici
approved these changes
Mar 24, 2025
Contributor
kylebonnici
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was tested upstream (zephyrproject-rtos/zephyr#84906)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Cherry-pick series of commits from upstream to have extended build info present in NCS.