X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=java_strings.py;h=b93677aa87e0a900c63d4b3ecbe1ac7f5ddf8cd4;hb=7c6f77d2bd9bffc95dd79caa0397ec63921b2601;hp=357c32eaaaf20083cb4ba4cdcc9e09d35db1f6b2;hpb=7d6be8a5ef72a4ebfe07660cce55f43f6cc30b80;p=ldk-java diff --git a/java_strings.py b/java_strings.py index 357c32ea..b93677aa 100644 --- a/java_strings.py +++ b/java_strings.py @@ -24,6 +24,7 @@ class Consts: self.bindings_header = """package org.ldk.impl; import org.ldk.enums.*; +import org.ldk.impl.version; import java.io.File; import java.io.InputStream; import java.io.IOException; @@ -64,7 +65,7 @@ public class bindings { } init(java.lang.Enum.class, VecOrSliceDef.class); init_class_cache(); - if (!get_lib_version_string().equals(get_ldk_java_bindings_version())) + if (!get_lib_version_string().equals(version.get_ldk_java_bindings_version())) throw new IllegalArgumentException("Compiled LDK library and LDK class failes do not match"); // Fetching the LDK versions from C also checks that the header and binaries match get_ldk_c_bindings_version(); @@ -74,9 +75,6 @@ public class bindings { static native void init_class_cache(); static native String get_lib_version_string(); - public static String get_ldk_java_bindings_version() { - return ""; - } public static native String get_ldk_c_bindings_version(); public static native String get_ldk_version(); @@ -93,6 +91,13 @@ public class bindings { public static native long new_empty_slice_vec(); """ + self.bindings_version_file = """package org.ldk.impl; + +public class version { + public static String get_ldk_java_bindings_version() { + return ""; + } +}""" self.bindings_footer = "}\n" @@ -461,16 +466,17 @@ static inline LDKStr java_to_owned_str(JNIEnv *env, jstring str) { return res; } -JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_get_1lib_1version_1string(JNIEnv *env, jclass _c) { - return str_ref_to_java(env, "", strlen("")); -} JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_get_1ldk_1c_1bindings_1version(JNIEnv *env, jclass _c) { return str_ref_to_java(env, check_get_ldk_bindings_version(), strlen(check_get_ldk_bindings_version())); } JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_get_1ldk_1version(JNIEnv *env, jclass _c) { return str_ref_to_java(env, check_get_ldk_version(), strlen(check_get_ldk_version())); } +#include "version.c" """ + self.c_version_file = """JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_get_1lib_1version_1string(JNIEnv *env, jclass _c) { + return str_ref_to_java(env, "", strlen("")); +}""" self.hu_struct_file_prefix = """package org.ldk.structs;