Release version-git.h for inter release feature check (#9923)#9924
Merged
Conversation
XRT client code relying on Git metadata is not cool, but occasionally needed. For example, in the middle of a release cycle where a feature is introduced, users of XRT may need a compile time check for the availability. The problem is that upstreamed builds of XRT (Debian and Fedora) carry no Git metadata, and version-git.h would provide no help. It is the users responsibility to relax the compile time guard with the XRT_VERSION_CODE greater than or equal to next minor release. As an example, assume code is developed against XRT 2.22, a feature was enabled at commit level 8195. This feature can be used in the code under the following conditions: #include <xrt/detail/version-git.h> #if (XRT_HEAD_COMMITS >= 8195) || (XRT_VERSION_CODE >= XRT_VERSION(2,23)) ...new code... #else ...old code... #endif `XRT_HEAD_COMMITS` require Git metadata but `XRT_VERSION_CODE` does not. Signed-off-by: Soren Soe <2106410+stsoe@users.noreply.github.com> (cherry picked from commit a21f10d)
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
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.
Problem solved by the commit
XRT client code relying on Git metadata is not cool, but occasionally needed. For example, in the middle of a release cycle where a feature is introduced, users of XRT may need a compile time check for the availability.
Bug / issue (if any) fixed, which PR introduced the bug, how it was discovered
The problem is that upstreamed builds of XRT (Debian and Fedora) carry no Git metadata, and version-git.h would provide no help. It is the users responsibility to relax the compile time guard with the XRT_VERSION_CODE greater than or equal to next minor release.
How problem was solved, alternative solutions (if any) and why they were rejected
As an example, assume code is developed against XRT 2.22, a feature was enabled at commit level 8195. This feature can be used in the code under the following conditions:
#include <xrt/detail/version-git.h>
#if (XRT_HEAD_COMMITS >= 8195) || (XRT_VERSION_CODE >= XRT_VERSION(2,23))
...new code...
#else
...old code...
#endif
XRT_HEAD_COMMITSrequire Git metadata butXRT_VERSION_CODEdoes not.(cherry picked from commit a21f10d)