Skip to content

Commit

Permalink
koch.nim: hotfix for nightly builds
Browse files Browse the repository at this point in the history
  • Loading branch information
Araq committed Jun 6, 2019
1 parent abaa42f commit e7471ce
Showing 1 changed file with 12 additions and 21 deletions.
33 changes: 12 additions & 21 deletions koch.nim
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
# See doc/koch.txt for documentation.
#

const
NimbleStableCommit = "d15c8530cb7480ce39ffa85a2dd9819d2d4fc645" # 0.10.2

when defined(gcc) and defined(windows):
when defined(x86):
{.link: "icons/koch.res".}
Expand Down Expand Up @@ -118,31 +121,22 @@ proc csource(args: string) =
"--main:compiler/nim.nim compiler/installer.ini $1") %
[args, VersionAsString, compileNimInst])

proc bundleNimbleSrc(latest: bool) =
## bunldeNimbleSrc() bundles a specific Nimble commit with the tarball. We
## always bundle the latest official release.
if not dirExists("dist/nimble/.git"):
exec("git clone https://github.com/nim-lang/nimble.git dist/nimble")
if not latest:
withDir("dist/nimble"):
exec("git checkout -f stable")
exec("git pull")

proc bundleC2nim() =
if not dirExists("dist/c2nim/.git"):
exec("git clone https://github.com/nim-lang/c2nim.git dist/c2nim")
nimCompile("dist/c2nim/c2nim", options = "--noNimblePath --path:.")

proc bundleNimbleExe(latest: bool) =
bundleNimbleSrc(latest)
if not dirExists("dist/nimble/.git"):
exec("git clone https://github.com/nim-lang/nimble.git dist/nimble")
if not latest:
withDir("dist/nimble"):
exec("git fetch")
exec("git checkout " & NimbleStableCommit)
# installer.ini expects it under $nim/bin
nimCompile("dist/nimble/src/nimble.nim", options = "-d:release --nilseqs:on")

proc buildNimble(latest: bool) =
# old installations created nim/nimblepkg/*.nim files. We remove these
# here so that it cannot cause problems (nimble bug #306):
if dirExists("bin/nimblepkg"):
removeDir("bin/nimblepkg")
# if koch is used for a tar.xz, build the dist/nimble we shipped
# with the tarball:
var installDir = "dist/nimble"
Expand All @@ -162,7 +156,7 @@ proc buildNimble(latest: bool) =
exec("git pull")
else:
exec("git fetch")
exec("git checkout tags/v0.10.2")
exec("git checkout " & NimbleStableCommit)
nimCompile(installDir / "src/nimble.nim", options = "--noNimblePath --nilseqs:on -d:release")

proc bundleNimsuggest() =
Expand Down Expand Up @@ -200,9 +194,6 @@ proc ensureCleanGit() =

proc xz(latest: bool; args: string) =
ensureCleanGit()
bundleNimbleSrc(latest)
when false:
bundleNimsuggest()
nimexec("cc -r $2 --var:version=$1 --var:mingw=none --main:compiler/nim.nim scripts compiler/installer.ini" %
[VersionAsString, compileNimInst])
exec("$# --var:version=$# --var:mingw=none --main:compiler/nim.nim xz compiler/installer.ini" %
Expand Down Expand Up @@ -383,7 +374,7 @@ proc winReleaseArch(arch: string) =
inFold "winrelease koch":
nimexec "c --cpu:$# koch" % cpu
kochExecFold("winrelease boot", "boot -d:release --cpu:$#" % cpu)
kochExecFold("winrelease zip", "--latest zip -d:release")
kochExecFold("winrelease zip", "zip -d:release")
overwriteFile r"build\nim-$#.zip" % VersionAsString,
r"web\upload\download\nim-$#_x$#.zip" % [VersionAsString, arch]

Expand Down Expand Up @@ -545,7 +536,7 @@ proc testUnixInstall(cmdLineRest: string) =
# check the docs build:
execCleanPath("./koch docs", destDir / "bin")
# check nimble builds:
execCleanPath("./koch --latest tools")
execCleanPath("./koch tools")
# check the tests work:
putEnv("NIM_EXE_NOT_IN_PATH", "NOT_IN_PATH")
execCleanPath("./koch tests --nim:./bin/nim cat megatest", destDir / "bin")
Expand Down

0 comments on commit e7471ce

Please sign in to comment.