-
-
Notifications
You must be signed in to change notification settings - Fork 9
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
SoftwareVersion: Add git hash suffix with git-version crate #6
Merged
sharkdp
merged 4 commits into
sharkdp:master
from
Enselic:software-version-add-git-hash-suffix-via-git-version-macro
Apr 3, 2021
Merged
SoftwareVersion: Add git hash suffix with git-version crate #6
sharkdp
merged 4 commits into
sharkdp:master
from
Enselic:software-version-add-git-hash-suffix-via-git-version-macro
Apr 3, 2021
Conversation
This file contains 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
Since we add it to the bugreport!() macro, it will be evaluated in the context of the dependant project, and give relevant git hash info. Features: * Optional via Cargo feature "git_hash" * Prints '<no git>' as git hash if git is not on PATH * Triggers rebuild if git hash (or index) change [1] Note that since the bugreport!() macro is evaluated in the context of the dependent project, it is not possible to use #[cfg()] inside of it. So we have to have two different definitions of it depnding on feature "git_hash". [1] Via elegant include_bytes!() hack by git-version crate, see https://github.com/fusion-engineering/rust-git-version/blob/v0.3.4/git-version-macro/src/lib.rs#L40
Enselic
force-pushed
the
software-version-add-git-hash-suffix-via-git-version-macro
branch
from
March 21, 2021 09:00
225925b
to
643541f
Compare
sharkdp
reviewed
Mar 27, 2021
sharkdp
reviewed
Mar 27, 2021
Enselic
force-pushed
the
software-version-add-git-hash-suffix-via-git-version-macro
branch
from
March 28, 2021 11:50
b4f9a77
to
643541f
Compare
Instead of defining different bugreport!() macros depending on the git_hash feature, use a single macro definition but with differently cfg:ed helper macros.
Thank you for the updates. This looks great! |
Let me know if I should push a new version (in order for |
Glad you liked it! No rush with pushing a new bugreport version, but would be nice to get this included in the next bat release, whenever that ends up being. |
Enselic
deleted the
software-version-add-git-hash-suffix-via-git-version-macro
branch
April 3, 2021 21:24
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.
Since we add it to the
bugreport!()
macro, it will be evaluated in thecontext of the dependant project, and give relevant git hash info.
Features:
"git_hash"
<no git>
as git hash if git is not onPATH
Note that since the
bugreport!()
macro is evaluated in the context ofthe dependent project, it is not possible to use
#[cfg()]
inside of it.So we have to have two different definitions of it depending on feature
"git_hash"
.[1] Via elegant
include_bytes!()
hack by git-version crate, seehttps://github.com/fusion-engineering/rust-git-version/blob/v0.3.4/git-version-macro/src/lib.rs#L40
Example output
From below CI run
example 'simple'
example 'simple' without git_hash feature
bat using this version
From CI run for Enselic/bat@271db66
bat using this version but with "git_hash" feature disabled
From CI run for Enselic/bat@65a3d81