-
Notifications
You must be signed in to change notification settings - Fork 3k
Add mbed-os version macros #3096
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
Add mbed-os version macros #3096
Conversation
@@ -18,6 +18,14 @@ | |||
|
|||
#define MBED_LIBRARY_VERSION 123 | |||
|
|||
#define MBED_MAJOR_VERSION 5 | |||
#define MBED_MINOR_VERSION 2 | |||
#define MBED_MICRO_VERSION 0 |
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.
Patch version maybe?
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.
@infinnovation Please use patch
as asked above
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.
So I infer you want "patch" instead of "micro" (naming which I had lifted from glib). A few extra words would have saved us all some time!
@@ -21,10 +21,11 @@ | |||
#define MBED_MAJOR_VERSION 5 | |||
#define MBED_MINOR_VERSION 2 | |||
#define MBED_MICRO_VERSION 0 |
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.
please remove the micro
/morph test |
@infinnovation Thanks ! Looks good to me, I'll squash merge this PR as it should be as one commit (or you can do it) |
Allow compile-time tests on the version of mbed-os to cope with e.g. API changes across versions.
c4de555
to
5cbc65b
Compare
/morph test |
Result: FAILUREYour command has finished executing! Here's what you wrote!
|
The failure was from before the rebase, @0xc0170's second run should go through OK. |
Result: SUCCESSYour command has finished executing! Here's what you wrote!
Outputmbed Build Number: 939 All builds and test passed! |
These macros are available for also mbed 2, that should not be? If it's the case, how to protect those for only mbed 5 builds?
Should mbed lib revision macro be accessible in the mbed 5? I would say it stays, a question is then about this new mbed OS version macro. Ideas? |
If we treat the mbed library like any other library then it would make a lot of sense to keep the mbed lib revision macro accessible in mbed OS 5. A library based on mbed SDK should continue to work on mbed OS. If this library defines a polyfil when it's compiled with It is the same case with other libraries bundled within mbed OS, their revision number does not disappear once they are packaged in mbed OS. For the |
I would propose this:
|
This looks reasonable to me 👍 |
@infinnovation What do you think? Shall we update this PR according to the proposal #3096 (comment) ? |
@0xc0170 I'm happy to go along with whatever you folks at ARM Towers decide. I ticked the "Allow edits by maintainers" option, so feel free to edit, respell, refactor, squash, merge or whatever, if that is simpler. |
@infinnovation Thanks, I'll pull this locally and do the changes |
One more thought: could these macros be split off into a separate .h file (mbed_version.h perhaps) with appropriate guards so that they can be used by C code as well as C++ ? |
An alternative idea would be to allow mbed.h to be included from C code. We could expose only the C-compatible interfaces, and this may be better aligned with our "single entry point". |
To distinguish between those 2 versions, we use MBED_CONF_RTOS_PRESENT macro. Note: mbed OS 2 versioning is 2.0.MBED_LIBRARY_VERSION
I added the proposal in the comment above as a new commit. Please review again.
What's the use-case? I would assume that any app code is C++, and these macros would be used there? |
Without having a specific example in mind, I was thinking more of libraries: third-party drivers, middleware etc. |
We don't commit or version any C interfaces. That may change and the C accessibility can if/when that is the case. |
/morph test |
@mbed-bot: TEST HOST_OSES=ALL |
[Build ${MBED_BUILD_ID}] |
@bridadan its gotta be the bot and not my command... I'm going crazy here 🎱 |
@mbed-bot: TEST HOST_OSES=ALL |
The reason the mbed 2 bot was failing was because it was always merging it with master, not with the branch that the PR was submitted against. The morph bot does correctly but the second bot didn't. So good catch there. However, that then brings the question should this be submitted against master instead of the release branch? |
Always! everything gets submitted against master |
[Build 1084] |
In that case, @infinnovation, can you please resubmit this against master? |
Result: FAILUREYour command has finished executing! Here's what you wrote!
Outputmbed Build Number: 994 Test Prep failed! |
Failure was my fault, a few machines were stuck in maintenance mode and halted the whole process. We can rerun the tests when this is submitted against master. |
935d0f8
to
546da87
Compare
Hmm, not sure my git-fu is up to this. I cherry-picked, squashed then pushed -f, but github still thinks this is a PR against mbed-os-5.2. May be simpler to create a fresh PR. |
546da87
to
935d0f8
Compare
@infinnovation Oh yes sorry for being unclear, you'll definitely need to close this and resubmit it against master as a new PR! |
Just wanted to see if changed the destination would work, will probably be easier to continue with #3207, which looks great |
@infinnovation Thanks for submitting the new PR! I'll go ahead and close this and we'll continue the conversation on #3207 |
Description
Allow compile-time tests on the version of mbed-os to cope with e.g. API changes across versions.
As suggested in #3091
Status
READY
Migrations
NO