Allow the git revision to be specified with -d:git_revision_override=xxxxxx
This commit is contained in:
parent
b4d731a1cc
commit
499b870a1a
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
{.push raises: [].}
|
{.push raises: [].}
|
||||||
|
|
||||||
import strutils
|
import std/[strutils, compilesettings]
|
||||||
|
|
||||||
when not defined(nimscript):
|
when not defined(nimscript):
|
||||||
import times
|
import times
|
||||||
|
@ -22,7 +22,25 @@ const
|
||||||
|
|
||||||
versionBlob* = "stateofus" # Single word - ends up in the default graffiti
|
versionBlob* = "stateofus" # Single word - ends up in the default graffiti
|
||||||
|
|
||||||
gitRevision* = strip(staticExec("git rev-parse --short HEAD"))[0..5]
|
## You can override this if you are building the
|
||||||
|
## sources outside the git tree of Nimbus:
|
||||||
|
git_revision_override* {.strdefine.} =
|
||||||
|
when querySetting(SingleValueSetting.command) == "check":
|
||||||
|
# The staticExec call below returns an empty string
|
||||||
|
# when `nim check` is used and this leads to a faux
|
||||||
|
# compile-time error.
|
||||||
|
# We work-around the problem with this override and
|
||||||
|
# save some time in executing the external command.
|
||||||
|
"123456"
|
||||||
|
else:
|
||||||
|
""
|
||||||
|
|
||||||
|
gitRevisionLong* = when git_revision_override.len == 0:
|
||||||
|
staticExec "git rev-parse --short HEAD"
|
||||||
|
else:
|
||||||
|
git_revision_override
|
||||||
|
|
||||||
|
gitRevision* = strip(gitRevisionLong)[0..5]
|
||||||
|
|
||||||
nimFullBanner* = staticExec("nim --version")
|
nimFullBanner* = staticExec("nim --version")
|
||||||
nimBanner* = staticExec("nim --version | grep Version")
|
nimBanner* = staticExec("nim --version | grep Version")
|
||||||
|
|
Loading…
Reference in New Issue