-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Output library / schema versions in JSON context block #1742
Conversation
Mainly, i want `get_git_version()` to return true version, not something sanitized.
27cb27a
to
a063fc7
Compare
a063fc7
to
341783b
Compare
src/json_reporter.cc
Outdated
#if defined(BENCHMARK_VERSION) | ||
const char library_version[] = BENCHMARK_VERSION; | ||
#else | ||
const char library_version[] = "hello, bazel!"; |
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 don't quite know what should be done for non-CMake.
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.
in bazel we could add a define to the cc_library
that maps to module_version()
i think: https://bazel.build/rules/lib/toplevel/native#module_version
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.
Yeah, i have no idea how to actually write that though. I've tried the obvious approach, but it may not work.
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.
did you try native.module_version()
? i think you were close. if it doesn't work we'll go with cmake and i'll hack on bazel.
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.
Yes, i tried that first.
Let me look into that... |
2737d16
to
d4d344b
Compare
Sorry, i have no clue how to do the bazel part. |
12861f7
to
84f98b2
Compare
blech ok. do cmake, i'll take bazel. |
With
we get
|
With
(which is the right syntax i guess?) we get
Does that mean there is no version string?
|
https://bazel.build/rules/lib/toplevel/native#module_version "If this package is from a repo defined in WORKSPACE instead of MODULE.bazel, this is empty. " i guess we have both WORKSPACE and MODULE.bazel so it's returning no version? |
Right, i guess that makes sense, but it does not really tell me how to fix this. Sorry. :/ |
don't be. drop bazel, i'll deal with it. i think i know what we need to do. |
5407781
to
a7a5822
Compare
out << ",\n"; | ||
|
||
// NOTE: our json schema is not strictly tied to the library version! | ||
out << indent << FormatKV("json_schema_version", int64_t(1)); |
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.
Also, do we want the original (current) version to be 1
or 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.
current version is v1.8.3 so v1 to match the major.
just to confirm: with bzlmod enabled, this gets further. two things missing:
|
It needs to be |
@dmah42 thank you! |
i just kept adding \ and it works.
|
google#1742 changed the placeholder version from `0.0.0` to `v0.0.0`, but this line which was further dealing with it, was not updated. Fixes google#1792
#1742 changed the placeholder version from `0.0.0` to `v0.0.0`, but this line which was further dealing with it, was not updated. Fixes #1792 Co-authored-by: dominic <[email protected]>
As discussed in #1741 (comment)