Skip to content

Commit

Permalink
adds NimbleVersion, NimbleMajor, NimbleMinor and NimblePatch
Browse files Browse the repository at this point in the history
…to nimble files (#1303)
  • Loading branch information
jmgomez authored Dec 9, 2024
1 parent 8561b31 commit aa459d1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/nimblepkg/nimscriptapi.nim
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ proc getParams(): tuple[scriptFile, projectFile, outFile, actionName: string,
const
# Command line values are const so that thisDir() works at compile time
(scriptFile, projectFile, outFile, actionName, commandLineParams*) = getParams()
NimbleVersion* {.strdefine.} = ""
NimbleMajor* {.intdefine.} = 0
NimbleMinor* {.intdefine.} = 0
NimblePatch* {.intdefine.} = 0

proc getCommand*(): string =
return command
Expand Down
7 changes: 6 additions & 1 deletion src/nimblepkg/nimscriptwrapper.nim
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,16 @@ proc execNimscript(
compFlags = if isCustomTask: join(options.getCompilationFlags(), " ")
else: ""

let nimbleVersion = common.nimbleVersion.split(".")
var cmd = (
"$# e $# $# --colors:on $# $# $# $# $#" % [
"$# e $# $# --colors:on $# $# $# $# $# $# $# $# $#" % [
getNimBin(options).quoteShell,
"--hints:off --verbosity:0",
"--define:nimbleExe=" & getAppFilename().quoteShell,
"--define:NimbleVersion=" & common.nimbleVersion,
"--define:NimbleMajor=" & nimbleVersion[0],
"--define:NimbleMinor=" & nimbleVersion[1],
"--define:NimblePatch=" & nimbleVersion[2],
compFlags,
nimsFile.quoteShell,
nimbleFile.quoteShell,
Expand Down

0 comments on commit aa459d1

Please sign in to comment.