-
Notifications
You must be signed in to change notification settings - Fork 2k
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
makefiles: add FEATURES_OPTIONAL_ANY #15855
Conversation
makefiles/features_check.inc.mk
Outdated
# Additionally optional features due to the "one out of" dependencies, | ||
# For each features list in $(FEATURES_OPTIONAL_ALT): | ||
# ==> If one (or more) features is usable select the first one in list | ||
# ==> If no feature is usable return the list | ||
FEATURES_OPTIONAL_ONE_OUT_OF := $(call _features_one_out_of,\ | ||
$(FEATURES_OPTIONAL_ALT),\ | ||
$(FEATURES_OPTIONAL) \ | ||
$(FEATURES_USABLE)) | ||
|
||
FEATURES_OPTIONAL_ONLY := $(sort $(filter-out $(FEATURES_REQUIRED),\ | ||
$(FEATURES_OPTIONAL) \ | ||
$(FEATURES_OPTIONAL_ONE_OUT_OF))) | ||
FEATURES_OPTIONAL_USED := $(sort $(filter $(FEATURES_PROVIDED), \ | ||
$(FEATURES_OPTIONAL_ONLY))) |
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.
After a comment from @leandrolanzieri offline, this should probably be:
# Additionally optional features due to the "one out of" dependencies, | |
# For each features list in $(FEATURES_OPTIONAL_ALT): | |
# ==> If one (or more) features is usable select the first one in list | |
# ==> If no feature is usable return the list | |
FEATURES_OPTIONAL_ONE_OUT_OF := $(call _features_one_out_of,\ | |
$(FEATURES_OPTIONAL_ALT),\ | |
$(FEATURES_OPTIONAL) \ | |
$(FEATURES_USABLE)) | |
FEATURES_OPTIONAL_ONLY := $(sort $(filter-out $(FEATURES_REQUIRED),\ | |
$(FEATURES_OPTIONAL) \ | |
$(FEATURES_OPTIONAL_ONE_OUT_OF))) | |
FEATURES_OPTIONAL_USED := $(sort $(filter $(FEATURES_PROVIDED), \ | |
$(FEATURES_OPTIONAL_ONLY))) | |
# FEATURES_OPTIONAL that have not been required | |
FEATURES_OPTIONAL_ONLY_SO_FAR := $(sort $(filter-out $(FEATURES_REQUIRED),\ | |
$(FEATURES_OPTIONAL))) | |
# Only add FEATURES that are usable | |
FEATURES_OPTIONAL_USED_SO_FAR := $(sort $(filter $(FEATURES_USABLE) \ | |
$(FEATURES_OPTIONAL_ONLY_SO_FAR))) | |
# Additionally optional features due to the "one out of" dependencies, | |
# For each features list in $(FEATURES_OPTIONAL_ALT): | |
# ==> If one (or more) features is already added to OPTIONAL_USED | |
then the firs of the used ones is returned | |
# ==> If one (or more) features is usable select the first one in list | |
# ==> If no feature is usable return the list | |
FEATURES_OPTIONAL_ONE_OUT_OF := $(call _features_one_out_of,\ | |
$(FEATURES_OPTIONAL_ALT),\ | |
$(FEATURES_OPTIONAL_USED_SO_FAR) \ | |
$(FEATURES_USABLE)) | |
# FEATURES_OPTIONAL that have not been required | |
FEATURES_OPTIONAL_ONLY := $(sort $(filter-out $(FEATURES_REQUIRED),\ | |
$(FEATURES_OPTIONAL_ONE_OUT_OF))) | |
# Only add FEATURES that are usable | |
FEATURES_OPTIONAL_USED := $(sort $(filter $(FEATURES_USABLE) \ | |
$(FEATURES_OPTIONAL_ONLY ))) |
This way do not add to FEATURES_OPTIONAL_USED
non-usable features, and do not add with the FEATURES_OPTIONAL_ALT
a feature that will be added bt the OPTIONAL mechanism. In other words:
FEATURES_OPTIONAL
has precedence over FEATURES_OPTIONAL_ALT
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.
I quickly tried this on the hello-world example (samr21-xpro), and I am not getting the expected result, the last feature of the list is selected. Am I using it wrongly?
Normal used features
arch_32bit
arch_arm
cpu_core_cortexm
no_idle_thread
periph_gpio
periph_pm
periph_uart
After adding FEATURES_OPTIONAL_ALT += periph_cpuid|periph_timer|periph_i2c
to the application Makefile:
New used features
arch_32bit
arch_arm
cpu_core_cortexm
no_idle_thread
periph_gpio
periph_i2c
periph_pm
periph_uart
@leandrolanzieri I addressed the issue you pointed out in the first fixup e148d7b, the comment I inlined is addressed in 6c9983b
|
Note that in master the issue you pointed out was also present:
|
So nice catch! |
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.
looks good to me. I wonder if we shouldn't name it FEATURES_OPTIONAL_ANY
for consistency. Otherwise the relation to FEATURES_REQUIRED_ANY
is IMO less obvious.
Please squash :-) (Also note that commit message needs updating.) |
5b8cf4d
to
07b6384
Compare
Wait, I found an issue:
The |
I think there's an issue with this PR: the number of jobs on Murdock is suspiciously low. The total run took 20 minutes, compared to the others, some applications are not built anymore.
Nowadays, there +80k jobs on Murdock. |
Indeed that is strange, I'll take a look. |
Hmm In Murdock I see that some jobs did not get built for a bunch of |
FEATURES_OPTIONAL_ANY are nice to have FEATURES that fulfill a similar function. Alternatives are separated by a pipe (|) in order of preference. e.g.: FEATURES_OPTIONAL_ANY += puf_sram|periph_hwrng if both are provided then only puf_sram will be used.
07b6384
to
66f3570
Compare
After all these bugs were uncovered with the In what order should a
But since the dependency process is iterative there are no guarantees of this anyway. So I think this is going to become messy very fast, any I'm not sure its worth the effort anymore. I'll still try to take a look at how it would look as soon as I have some time, but as I said I'm not sure its worth it. |
I think we should aim for best effort here (that is, after |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you want me to ignore this issue, please mark it with the "State: don't stale" label. Thank you for your contributions. |
I kind of assumed that this has already landed. @fjmolinas: Will you reboot this, or is it better to get KConfig finished so that we no longer need this? |
Contribution description
From looking at #15836 and #15817, it's clear that some dependencies are better modeled in Kconfig with choices. This PR looks to give a similar option to model this behavior in
make
while the migration is ongoing.So similar to #13349:
Testing procedure
#12166 Shows a test case for this (I want to rebase that one on top of #15836 and this one)
The save_all_dependencies script should have the same output as before, as this PR does not make use of the feature.
Issues/PRs references
Taken from #12166
Related to #15836