Skip to content

Commit d9f7374

Browse files
authored
Win fix binary declarative parser (#1361)
* 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
1 parent f50c0ce commit d9f7374

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/nimblepkg/declarativeparser.nim

+5-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,11 @@ proc extract(n: PNode, conf: ConfigRef, result: var NimbleFileInfo) =
101101
elif n[0].kind == nkIdent and eqIdent(n[0].ident.s, "bin"):
102102
let binSeq = extractSeqLiteral(n[1], conf, "bin")
103103
for bin in binSeq:
104-
result.bin[bin] = bin
104+
when defined(windows):
105+
var bin = bin & ".exe"
106+
result.bin[bin] = bin
107+
else:
108+
result.bin[bin] = bin
105109
else:
106110
discard
107111
else:

tests/tdeclarativeparser.nim

+4-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,10 @@ suite "Declarative parsing":
3737
let nimbleFile = getNimbleFileFromPkgNameHelper("nimlangserver")
3838
let nimbleFileInfo = extractRequiresInfo(nimbleFile)
3939
check nimbleFileInfo.bin.len == 1
40-
check nimbleFileInfo.bin["nimlangserver"] == "nimlangserver"
40+
when defined(windows):
41+
check nimbleFileInfo.bin["nimlangserver.exe"] == "nimlangserver.exe"
42+
else:
43+
check nimbleFileInfo.bin["nimlangserver"] == "nimlangserver"
4144

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

0 commit comments

Comments
 (0)