Pass output directory throuh to consts and call a cleanup function
authorMatt Corallo <git@bluematt.me>
Fri, 7 Jan 2022 18:38:22 +0000 (18:38 +0000)
committerMatt Corallo <git@bluematt.me>
Fri, 7 Jan 2022 18:39:38 +0000 (18:39 +0000)
genbindings.py
java_strings.py
typescript_strings.py

index 1443a41ac6aaa2e68a4de02546d7f273e07b68d1..ca66da196ce963abd2940449ecd9cc1b08f9912f 100755 (executable)
@@ -31,7 +31,7 @@ else:
     sys.exit(1)
 
 
-consts = Consts(DEBUG, target=target)
+consts = Consts(DEBUG, target=target, outdir=sys.argv[4])
 
 local_git_version = os.getenv("LDK_GARBAGECOLLECTED_GIT_OVERRIDE")
 if local_git_version is None:
@@ -1058,3 +1058,4 @@ with open(f"{sys.argv[4]}/version.c", "w") as out_c:
     out_c.write(consts.c_version_file.replace('<git_version_ldk_garbagecollected>', local_git_version))
 with open(f"{sys.argv[3]}/structs/UtilMethods{consts.file_ext}", "a") as util:
     util.write(consts.util_fn_sfx)
+consts.cleanup()
index ccde06e5806d73edabb5d19d7fe9115b3090b3ef..1b5be889b944bd6097845289e20e7fc68741fdba 100644 (file)
@@ -1384,3 +1384,6 @@ import javax.annotation.Nullable;
             out_java_struct += ("\t}\n\n")
 
         return (out_java, out_c, out_java_struct + extra_java_struct_out)
+
+    def cleanup(self):
+        pass
index 914c0189cf0167dd3fcf9dafa616f2eeb306e383..9441a2ac8bdad224c55d8b0f73fb298e0d5a514a 100644 (file)
@@ -11,8 +11,8 @@ class Target(Enum):
     BROWSER = 2
 
 class Consts:
-    def __init__(self, DEBUG: bool, target: Target, **kwargs):
-
+    def __init__(self, DEBUG: bool, target: Target, outdir: str, **kwargs):
+        self.outdir = outdir
         self.c_type_map = dict(
             uint8_t = ['number', 'Uint8Array'],
             uint16_t = ['number', 'Uint16Array'],
@@ -1160,3 +1160,6 @@ const decodeString = (stringPointer, free = true) => {
             out_java_struct += ("\t}\n\n")
 
         return (out_java, out_c, out_java_struct)
+
+    def cleanup(self):
+        pass