Skip to content

Commit aa459d1

Browse files
authored
adds NimbleVersion, NimbleMajor, NimbleMinor and NimblePatch to nimble files (#1303)
1 parent 8561b31 commit aa459d1

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/nimblepkg/nimscriptapi.nim

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,10 @@ proc getParams(): tuple[scriptFile, projectFile, outFile, actionName: string,
8080
const
8181
# Command line values are const so that thisDir() works at compile time
8282
(scriptFile, projectFile, outFile, actionName, commandLineParams*) = getParams()
83+
NimbleVersion* {.strdefine.} = ""
84+
NimbleMajor* {.intdefine.} = 0
85+
NimbleMinor* {.intdefine.} = 0
86+
NimblePatch* {.intdefine.} = 0
8387

8488
proc getCommand*(): string =
8589
return command

src/nimblepkg/nimscriptwrapper.nim

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,16 @@ proc execNimscript(
4747
compFlags = if isCustomTask: join(options.getCompilationFlags(), " ")
4848
else: ""
4949

50+
let nimbleVersion = common.nimbleVersion.split(".")
5051
var cmd = (
51-
"$# e $# $# --colors:on $# $# $# $# $#" % [
52+
"$# e $# $# --colors:on $# $# $# $# $# $# $# $# $#" % [
5253
getNimBin(options).quoteShell,
5354
"--hints:off --verbosity:0",
5455
"--define:nimbleExe=" & getAppFilename().quoteShell,
56+
"--define:NimbleVersion=" & common.nimbleVersion,
57+
"--define:NimbleMajor=" & nimbleVersion[0],
58+
"--define:NimbleMinor=" & nimbleVersion[1],
59+
"--define:NimblePatch=" & nimbleVersion[2],
5560
compFlags,
5661
nimsFile.quoteShell,
5762
nimbleFile.quoteShell,

0 commit comments

Comments
 (0)