Skip to content

Commit

Permalink
Win fix binary declarative parser (#1361)
Browse files Browse the repository at this point in the history
* Makes the declarative parser the default (CI test)

* Adds support to requires flag in the declarative parser

* Adds `exe` in windows when parsing binary

* Makes declarative vmParser default

* Fixes failing test
  • Loading branch information
jmgomez authored Mar 6, 2025
1 parent f50c0ce commit d9f7374
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/nimblepkg/declarativeparser.nim
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,11 @@ proc extract(n: PNode, conf: ConfigRef, result: var NimbleFileInfo) =
elif n[0].kind == nkIdent and eqIdent(n[0].ident.s, "bin"):
let binSeq = extractSeqLiteral(n[1], conf, "bin")
for bin in binSeq:
result.bin[bin] = bin
when defined(windows):
var bin = bin & ".exe"
result.bin[bin] = bin
else:
result.bin[bin] = bin
else:
discard
else:
Expand Down
5 changes: 4 additions & 1 deletion tests/tdeclarativeparser.nim
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ suite "Declarative parsing":
let nimbleFile = getNimbleFileFromPkgNameHelper("nimlangserver")
let nimbleFileInfo = extractRequiresInfo(nimbleFile)
check nimbleFileInfo.bin.len == 1
check nimbleFileInfo.bin["nimlangserver"] == "nimlangserver"
when defined(windows):
check nimbleFileInfo.bin["nimlangserver.exe"] == "nimlangserver.exe"
else:
check nimbleFileInfo.bin["nimlangserver"] == "nimlangserver"

test "should be able to get all the released PackageVersions from a git local repository using the declarative parser":
var options = initOptions()
Expand Down

0 comments on commit d9f7374

Please sign in to comment.