-
Notifications
You must be signed in to change notification settings - Fork 38
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
Fix arguments order for generate stage #165
Fix arguments order for generate stage #165
Conversation
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.
LGTM! Agreed that CLI args should take precedence.
@SMorettini turns out the order of dictionary unpacking was a conscious decision, as users should not override the I went ahead and implemented this in your PR branch, I hope you don't mind. Would you want to give this a quick review? I tested locally and it should behave as you requested. Would very much appreciate some additional eyes on this though! |
Merging, let me know if you have any comments! |
cmake_args["BUILD_TESTING"] = "ON" | ||
cmake_args["CMAKE_BUILD_TYPE"] = user_cmake_args.get( | ||
"CMAKE_BUILD_TYPE", "Debug" | ||
) |
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.
@thomas-bc I originally opened this pull request to give the possibility to build UTs using a CMAKE_BUILD_TYPE
different from Debug
. I agree with your changes but if I understand correctly the code, you reintroduced back the problem I wanted to remove.
Am I right or the CMAKE_BUILD_TYPE
will be always Debug
if the UTs are built? Is that something that we want by design? I think that the user should have the flexibility to choose the CMAKE_BUILD_TYPE
in any case.
If by design we don't want to give this flexibility then we should document it somewhere because, at least for me, it seems a hidden and unexpected feature.
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.
@thomas-bc do you have any comments about this?
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.
For newer versions of F´ (v3+) it only defaults to debug if the user has not set "CMAKE_BUILD_TYPE"
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 tested this and a custom build type does carry into a UT cache!
Change Description
Cmake arguments come from three different places:
Before this change, the order was the default, user-defined and settings.ini. Now I changed the order as reported above.
Rationale
I was trying to set the -DCMAKE_BUILD_TYPE=Release during the generation of the unit tests but I was not able to send anything else than Debug. This was happening because when the arguments were read from
settings.ini
, the build type was put by default to Debug. This overrides the build type set from the command line.With my change, the user-defined variable when running
fprime-util generate ...
overrides any other variable.