-
-
Notifications
You must be signed in to change notification settings - Fork 228
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
DUB should expose a package's version to the respective package #1438
Comments
yes pls add |
Does this PR somehow helps you? |
I don't think that is helpful as it's just for the commands dub can run. What would fix this issue imo would be having defines (enums) set to the versions. |
It simplifies the logic quite a bit - though it's probably such a common use case that we won't it to be possible without the need for any custom D code? |
I fully agree. I have a similar logic in all of my productive applications. I have 2 things I want to mention.
As explanation: the build pipeline i have to use (XMake based) doesn't allow git tags created by developer but creates itself git tags. On the other side the build pipeline want to know the dub project version. The unofficial dub.json version attribute works like a charms here. |
I think a dub-generated D module containing |
Just noticed that this is one of the oldest issues we still had open: #6 ! |
Another use case: #437 |
Problem: the built program should expose its version to the user (e.g.
--version
).Semi-generic workaround:
This will generate a
bin/dubhash.txt
file that can be imported anywhere in the program withimport("dubhash.txt")
.This workaround will default to git describe --tags (within the packages's directory) and if that fails it will detect its version based on the DUB package path.If that fails too, it will fallback to 0.0.0.
The workaround "works", but obviously it would be nicer if
dub
found a standardized way to expose the package's current version to the package itself. It has this information after all...The text was updated successfully, but these errors were encountered: