-
Notifications
You must be signed in to change notification settings - Fork 82
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
Version constant injection #576
Conversation
@DRSchlaubi do you think |
Ideally all versions would be in the root file (just with apply false), but we already gave up on that when we used the precompiled scripts. We could add it to one of the scripts, so we can add it to multiple modules, but we only need it in common so it's fine |
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.
Would be nice to have a commit hash as well, as we use a lot of snapshots
What would the format look like? |
Simply make an additional constant? And then maybe also include it with (Commit hash: ) in the user agent |
Ah, I thought you wanted it to be part of the KORD_VERSION string. |
Like this? 85270e9 I also can't come up with documentation for |
buildSrc/src/main/kotlin/Projects.kt
Outdated
|
||
/** | ||
* whether the process has been invoked by JitPack | ||
*/ | ||
val isJitPack get() = "true" == System.getenv("JITPACK") | ||
|
||
val Project.commitHash: String |
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.
Github allows you to get the commit hash, why is this logic code introduced.
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.
You are referring to the GITHUB_SHA
environment variable, right? This one is the full hash, @DRSchlaubi wanted to have the short one if available (retrieved by git rev-parse --short HEAD
).
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.
Github doesn't provide that? in the environment?
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 didn't search too long, maybe they do. Do you know more?
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.
Github doesn't provide that? in the environment?
https://docs.github.com/en/actions/learn-github-actions/environment-variables#default-environment-variables only lists the long SHA
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.
Maybe we should compute the short hash in the actions instead (like here).
It would probably also be good to provide KORD_COMMIT_HASH
and KORD_SHORT_COMMIT_HASH
.
This PR changes the version used in the user agent header from being hard-coded to being generated at build time using this gradle plugin.
The plugin will generate the internal top-level property
dev.kord.common.BUILD_CONFIG_GENERATED_LIBRARY_VERSION
and assign the value ofLibrary.version
to it.KordConstants.KORD_VERSION
then makes this publicly accessible.