Skip to content

Commit f7140a3

Browse files
authored
Dont recompile Nim if already compiled (#1324)
* Dont recompile Nim if already compiled * removes fragile check
1 parent b7d37e7 commit f7140a3

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/nimblepkg/nimenv.nim

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ proc infoAboutActivation(nimDest, nimVersion: string) =
2121
display("Info", nimDest & "installed; activate with 'source nim-" & nimVersion & "activate.sh'")
2222

2323
proc compileNim*(options: Options, nimDest: string, v: VersionRange) =
24+
#Most of the time we dont need to recompile, if we can get the nim version from the binary .
25+
let nimCompVersion = getNimVersionFromBin(nimDest / "bin" / "nim".addFileExt(ExeExt))
26+
if nimCompVersion.isSome() and nimCompVersion.get.withinRange(v):
27+
return
28+
2429
let keepCsources = options.useSatSolver #SAT Solver has a cache instead of a temp dir for downloads
2530
template exec(command: string) =
2631
let cmd = command # eval once

0 commit comments

Comments
 (0)