mirror of
https://github.com/status-im/nim-dagger.git
synced 2025-01-10 06:36:06 +00:00
update build script to rename version file
This commit is contained in:
parent
9eea9fe81e
commit
feb13129f4
24
build.nims
24
build.nims
@ -2,10 +2,28 @@ mode = ScriptMode.Verbose
|
||||
|
||||
import std/os except commandLineParams
|
||||
|
||||
const VendorPath = "vendor/nim-nat-traversal/vendor/libnatpmp-upstream"
|
||||
let
|
||||
oldVersionFile = joinPath(VendorPath, "VERSION")
|
||||
newVersionFile = joinPath(VendorPath, "VERSION_temp")
|
||||
|
||||
proc renameFile(oldName, newName: string) =
|
||||
if fileExists(oldName):
|
||||
mvFile(oldName, newName)
|
||||
else:
|
||||
echo "File ", oldName, " does not exist"
|
||||
|
||||
|
||||
### Helper functions
|
||||
proc buildBinary(name: string, srcDir = "./", params = "", lang = "c") =
|
||||
# This is a quick workaround to avoid VERSION file conflict on macOS
|
||||
# More details here: https://github.com/codex-storage/nim-codex/issues/1059
|
||||
if defined(macosx):
|
||||
renameFile(oldVersionFile, newVersionFile)
|
||||
|
||||
if not dirExists "build":
|
||||
mkDir "build"
|
||||
|
||||
# allow something like "nim nimbus --verbosity:0 --hints:off nimbus.nims"
|
||||
var extra_params = params
|
||||
when compiles(commandLineParams):
|
||||
@ -19,8 +37,12 @@ proc buildBinary(name: string, srcDir = "./", params = "", lang = "c") =
|
||||
# Place build output in 'build' folder, even if name includes a longer path.
|
||||
outName = os.lastPathPart(name)
|
||||
cmd = "nim " & lang & " --out:build/" & outName & " " & extra_params & " " & srcDir & name & ".nim"
|
||||
try:
|
||||
exec(cmd)
|
||||
finally:
|
||||
if defined(macosx):
|
||||
renameFile(newVersionFile, oldVersionFile)
|
||||
|
||||
exec(cmd)
|
||||
|
||||
proc test(name: string, srcDir = "tests/", params = "", lang = "c") =
|
||||
buildBinary name, srcDir, params
|
||||
|
Loading…
x
Reference in New Issue
Block a user