aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGanesh Viswanathan <dev@genotrance.com>2020-06-18 14:33:32 -0500
committerGanesh Viswanathan <dev@genotrance.com>2020-06-18 14:33:32 -0500
commit36622e60a4ff111e405458e360e9203e8bd06a3f (patch)
treef08451c75305d1734d43c167383ca89354efab86
parent73885382da089f36447f67e7bd4e8710dfaa6714 (diff)
downloadnimterop-36622e60a4ff111e405458e360e9203e8bd06a3f.tar.gz
nimterop-36622e60a4ff111e405458e360e9203e8bd06a3f.zip
--gc:arc fixes and testing
-rw-r--r--nimterop/conan.nim9
-rw-r--r--nimterop/jbb.nim9
-rw-r--r--tests/getheader.nims3
3 files changed, 15 insertions, 6 deletions
diff --git a/nimterop/conan.nim b/nimterop/conan.nim
index baf1d66..2f2c65c 100644
--- a/nimterop/conan.nim
+++ b/nimterop/conan.nim
@@ -1,4 +1,4 @@
-import json, marshal, os, strformat, strutils, tables
+import json, os, strformat, strutils, tables
type
ConanPackage* = ref object
@@ -272,7 +272,10 @@ proc loadConanInfo*(outdir: string): ConanPackage =
file = outdir / conanInfo
if fileExists(file):
- result = to[ConanPackage](readFile(file))
+ try:
+ result = to(readFile(file).parseJson(), ConanPackage)
+ except:
+ discard
proc saveConanInfo*(pkg: ConanPackage, outdir: string) =
## Save downloaded package info to `outdir/conaninfo.json`
@@ -280,7 +283,7 @@ proc saveConanInfo*(pkg: ConanPackage, outdir: string) =
let
file = outdir / conanInfo
- writeFile(file, $$pkg)
+ writeFile(file, $(%pkg))
proc parseConanManifest(pkg: ConanPackage, outdir: string) =
# Get all library info from downloaded conan package
diff --git a/nimterop/jbb.nim b/nimterop/jbb.nim
index 5d421f0..b5e66fb 100644
--- a/nimterop/jbb.nim
+++ b/nimterop/jbb.nim
@@ -1,4 +1,4 @@
-import marshal, os, strutils
+import json, os, strutils
type
JBBPackage* = ref object
@@ -143,7 +143,10 @@ proc loadJBBInfo*(outdir: string): JBBPackage =
file = outdir / jbbInfo
if fileExists(file):
- result = to[JBBPackage](readFile(file))
+ try:
+ result = to(readFile(file).parseJson(), JBBPackage)
+ except:
+ discard
proc saveJBBInfo*(pkg: JBBPackage, outdir: string) =
## Save downloaded package info to `outdir/jbbinfo.json`
@@ -151,7 +154,7 @@ proc saveJBBInfo*(pkg: JBBPackage, outdir: string) =
let
file = outdir / jbbInfo
- writeFile(file, $$pkg)
+ writeFile(file, $(%pkg))
proc dlJBBRequires*(pkg: JBBPackage, outdir: string)
proc downloadJBB*(pkg: JBBPackage, outdir: string, main = true) =
diff --git a/tests/getheader.nims b/tests/getheader.nims
index 3fa8eb6..916abcf 100644
--- a/tests/getheader.nims
+++ b/tests/getheader.nims
@@ -21,6 +21,9 @@ var
lexp = "liblzma version = "
zexp = "zlib version = "
+when (NimMajor, NimMinor, NimPatch) >= (1, 2, 0):
+ cmd &= " --gc:arc"
+
testCall(cmd & lrcmd, "No build files found", 1)
testCall(cmd & " -d:libssh2Conan" & sshcmd, "Need version for Conan.io uri", 1)
testCall(cmd & " -d:libssh2JBB -d:libssh2SetVer=1.9.0" & sshcmd, "Version in both uri", 1)