build system: Restructure dependency resolution #13349
build system: Restructure dependency resolution #13349leandrolanzieri merged 4 commits intoRIOT-OS:masterfrom
Conversation
|
Interesting idea but I would call the new variable |
|
Nice, I like the idea. How does it interact with |
Currently not well, but it certainly should! I will adapt the code to only consider non-blacklisted and provided features for addition. |
aabadie
left a comment
There was a problem hiding this comment.
Thanks for adopting FEATURES_REQUIRED_ANY :)
There are left-overs in the porting board documentation.
|
I think I now addressed all comments (and fixed the leftovers in the doc). Please have a second look :-) |
Using You would never have |
|
BTW: Technically, there is no need to distinguish between So if anyone would prefer to be able to do something like: |
fjmolinas
left a comment
There was a problem hiding this comment.
I think this looks good overall, documentation needs some improvements and I think with some functions the handling can be made more explicit.
makefiles/info-global.inc.mkandmakefiles/info.inc.mkneed updating as well.- I think the function name could be better to document the behavior because
_features_any: selects the first one of thefoo|bar|basthat is alsoPROVIDED, so maybe_features_use_first_oneor something like that. I suggested some changes below.
Note that an unsatisfied I updated |
70c8e09 to
dd8f13b
Compare
|
I rebased to fix the merge conflict, but didn't squash to not interfere with the review process. |
fjmolinas
left a comment
There was a problem hiding this comment.
Some minor nitpicking naming comments, otherwise all good. The handling and steps are a lot more clear now!
|
All my changes requests have been addresssed, @aabadie can you take a second look at yours? |
|
ping @aabadie !! |
|
F***ck. Fixed one bug, open hundred new ones :-D |
They don't need any
Not sure about Lets handle the rest of the cleanup in a different PR. |
Immediately expanding |
|
In ifneq (,$(filter auto_init_saul,$(USEMODULE)))
USEMODULE += saul_init_devs
endif
``
:-/ |
👍. This PR is already complex enough |
Damn I ACK'ed that, it slip through. |
I would have also ACK'ed that. I only just now got aware of the issues this could have. |
|
@maribu all good now, I would squash the last 3 commits into 1. |
Goals:
- Untangle dependency resolution and feature checking for better maintainability
- Improve performance of "make info-boards-supported"
Changes:
- Makefile.dep
- Dropped handling of default modules and recursion
- Now only dependencies of the current set of used modules and pkgs are
added
==> External recursion is needed to catch transient dependencies
- Changed Makefile.features:
- Dropped checking of provided features
- Dropped populating FEATURES_USED with provided features that are required
or optional
- Dropped populating FEATURES_MISSING with required but not provided
features
- Dropped adding modules implementing used features to USE_MODULE
==> This now only populates FEATURES_PROVIDED, nothing more
- Added makefiles/features_check.inc.mk:
- This performs the population of FEATURES_USED and FEATURES_MISSING now
- Added makefiles/features_modules.inc.mk:
- This performs now the addition of modules implementing used features
- Added makefiles/dependency_resolution.inc.mk:
- This now performs the recursion required to catch transient dependencies
- Also the feature check is performed recursively to handle also required
and optional features of the transient dependencies
- DEFAULT_MODULES are added repeatedly to allow it to be extended based on
used features and modules
==> This allows modules to have optional dependencies, as these
dependencies can be blacklisted
- Use simply expanded variables instead of recursively expended variables
(`foo := $(bar)` instead `foo = $(bar)`) for internal variables during feature
resolution. This improves performance significantly for
`make info-boards-supported`.
- Reduce dependency resolution steps in `make info-boards-supported`
- Globally resolve dependencies without any features (including arch)
provided
==> This results in the common subset of feature requirements and modules
used
- But for individual boards additional modules might be used on top due
to architecture specific dependencies or optional features
- Boards not supporting this subset of commonly required features are not
supported, so no additional dependency resolution is needed for them
- For each board supporting the common set of requirements a complete
dependency resolution is still needed to also catch architecture specific
hacks
- But this resolution is seeded with the common set of dependencies to
speed this up
- Add FEATURES_REQUIRED_ANY to dependency-debug:
Now `make dependency-debug` by default also stores the contents of
`FEATURES_REQUIRED_ANY`.
- makefiles/features_check.inc.mk: Break long lines
- {tests/minimal,tests/unittests,bootloaders/riotboot}:
Disable auto_init_% in addition to auto_init.
This works around weird behavior due to the USEMODULE being recursively expended
in the first iteration of dependency resolution: Modules added to DEFAULT_MODULE
get automatically added to USEMODULE during the first run, but not for
subsequent. This should be iron out later on.
|
My ACK still stands. |
|
I changed the PR title to the main change of this PR. |
I would be nice to update the PR description as well. |
leandrolanzieri
left a comment
There was a problem hiding this comment.
Besides the original intention of the PR of allowing "one out of" dependencies, it turned into a restructuring of our dependency resolution process.
As @fjmolinas mentioned, the reviewing process of this PR brought attention to many existing issues, and the cleanup helps understanding the process better. Changes look good, follow-up work has been identified, and multiple tests and dependency checks have been run.
It's an ACK from my side. Let's get this to the freeze, I'm sure all of us will be on the ball if issues pop up during the next days ;-)
|
Thanks for sticking through with this @maribu and for the good will to tackle many unrelated issues that surfaced because of your initial change! Thanks for the help reviewing the final mile @leandrolanzieri! |
|
@fjmolinas, @leandrolanzieri: Thanks for the review and helping to understand the various issues that needed to be addressed :-) |
Done |
Contribution description
Added
FEATURES_REQUIRED_ANYModules can now express a dependency relation in which only one out of a set of features are required. E.g.
FEATURES_REQUIRED_ANY += periph_uart|periph_usbdevcould added to the correspondingMakefile.depif a module requires the featureperiph_uartORperiph_usbdev. (Note: The or is not an exclusive or, so due to other dependencies both features might be used.)Restructured Dependency Resolution
The addition of
FEATURES_REQUIRED_ANYintroduced huge performance issues. A restructuring of the dependency resolution was done to address these and also make the dependency resolution a bit easier to understand.In detail, the changes are:
==> External recursion is needed to catch transitive dependencies
==> This now only populates FEATURES_PROVIDED, nothing more
(
foo := $(bar)insteadfoo = $(bar)) for internal variables during feature resolution. This improves performance significantly formake info-boards-supported.make info-boards-supported==> This results in the common subset of feature requirements and modules used
Testing procedure
tests/driver_ws281xshould still have the same output formake info-boards-supportedsave_all_dependenciesscript should have the same output as before, except forFEATURES_REQUIRED_ANYand theauto_init_%modules that are explicitly blacklisted in three applications nowIssues/PRs references
Alternative to #13343