X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=genbindings.py;h=3733d540bc06f95e65e2221a9b458e83be29a862;hb=7c6f77d2bd9bffc95dd79caa0397ec63921b2601;hp=cc63c11aa3b8b276b140e09816c9804dcdb8d457;hpb=7d6be8a5ef72a4ebfe07660cce55f43f6cc30b80;p=ldk-java diff --git a/genbindings.py b/genbindings.py index cc63c11a..3733d540 100755 --- a/genbindings.py +++ b/genbindings.py @@ -424,7 +424,7 @@ java_c_types_none_allowed = False # C structs created by cbindgen are declared i with open(f"{sys.argv[3]}/structs/UtilMethods{consts.file_ext}", "a") as util: util.write(consts.util_fn_pfx) -with open(sys.argv[1]) as in_h, open(sys.argv[2], "w") as out_java: +with open(sys.argv[1]) as in_h, open(f"{sys.argv[2]}/bindings{consts.file_ext}", "w") as out_java: # Map a top-level function def map_fn(line, re_match, ret_arr_len, c_call_string, doc_comment): method_return_type = re_match.group(1) @@ -798,7 +798,9 @@ with open(sys.argv[1]) as in_h, open(sys.argv[2], "w") as out_java: write_c("\treturn tuple->" + e + ";\n") write_c("}\n") - out_java.write(consts.bindings_header.replace('', local_git_version)) + out_java.write(consts.bindings_header) + with open(f"{sys.argv[2]}/version{consts.file_ext}", "w") as out_java_version: + out_java_version.write(consts.bindings_version_file.replace('', local_git_version)) with open(f"{sys.argv[3]}/structs/CommonBase{consts.file_ext}", "w") as out_java_struct: out_java_struct.write(consts.common_base) @@ -1086,9 +1088,11 @@ with open(sys.argv[1]) as in_h, open(sys.argv[2], "w") as out_java: with open(f"{sys.argv[3]}/structs/{struct_name.replace('LDKCResult', 'Result')}{consts.file_ext}", "a") as out_java_struct: out_java_struct.write("}\n") -with open(sys.argv[4], "w") as out_c: - out_c.write(consts.c_file_pfx.replace('', local_git_version)) +with open(f"{sys.argv[4]}/bindings.c.body", "w") as out_c: + out_c.write(consts.c_file_pfx) out_c.write(consts.init_str()) out_c.write(c_file) +with open(f"{sys.argv[4]}/version.c", "w") as out_c: + out_c.write(consts.c_version_file.replace('', local_git_version)) with open(f"{sys.argv[3]}/structs/UtilMethods{consts.file_ext}", "a") as util: util.write(consts.util_fn_sfx)