adds koch --skipIntegrityCheck boot support (#21795)

add `koch --skipIntegrityCheck boot` support

(cherry picked from commit 724866b14f)
This commit is contained in:
ringabout
2023-05-05 19:58:29 +08:00
committed by narimiran
parent c88f58948a
commit 01ce56ab9e

View File

@@ -59,6 +59,7 @@ Options:
--nim:path use specified path for nim binary
--localdocs[:path] only build local documentations. If a path is not
specified (or empty), the default is used.
--skipIntegrityCheck skips integrity check when booting the compiler
Possible Commands:
boot [options] bootstraps with given command line options
distrohelper [bindir] helper for distro packagers
@@ -289,7 +290,7 @@ proc thVersion(i: int): string =
template doUseCpp(): bool = getEnv("NIM_COMPILE_TO_CPP", "false") == "true"
proc boot(args: string) =
proc boot(args: string, skipIntegrityCheck: bool) =
## bootstrapping is a process that involves 3 steps:
## 1. use csourcesAny to produce nim1.exe. This nim1.exe is buggy but
## rock solid for building a Nim compiler. It shouldn't be used for anything else.
@@ -305,7 +306,8 @@ proc boot(args: string) =
hostOS & "_" & hostCPU
let nimStart = findStartNim().quoteShell()
for i in 0..2:
let times = 2 - ord(skipIntegrityCheck)
for i in 0..times:
# Nim versions < (1, 1) expect Nim's exception type to have a 'raiseId' field for
# C++ interop. Later Nim versions do this differently and removed the 'raiseId' field.
# Thus we always bootstrap the first iteration with "c" and not with "cpp" as
@@ -340,7 +342,9 @@ proc boot(args: string) =
return
copyExe(output, (i+1).thVersion)
copyExe(output, finalDest)
when not defined(windows): echo "[Warning] executables are still not equal"
when not defined(windows):
if not skipIntegrityCheck:
echo "[Warning] executables are still not equal"
# -------------- clean --------------------------------------------------------
@@ -673,6 +677,7 @@ when isMainModule:
latest = false
localDocsOnly = false
localDocsOut = ""
skipIntegrityCheck = false
while true:
op.next()
case op.kind
@@ -686,10 +691,12 @@ when isMainModule:
localDocsOnly = true
if op.val.len > 0:
localDocsOut = op.val.absolutePath
of "skipintegritycheck":
skipIntegrityCheck = true
else: showHelp(success = false)
of cmdArgument:
case normalize(op.key)
of "boot": boot(op.cmdLineRest)
of "boot": boot(op.cmdLineRest, skipIntegrityCheck)
of "clean": clean(op.cmdLineRest)
of "doc", "docs": buildDocs(op.cmdLineRest & paCode, localDocsOnly, localDocsOut)
of "doc0", "docs0":