Update LibraryVersion.java, LibraryVersion.java, and LoadLibrary.java

This commit is contained in:
Andrea Cavalli 2020-10-11 19:48:52 +02:00
parent a599d65868
commit 176ddb94c6
3 changed files with 14 additions and 9 deletions

View File

@ -1,5 +1,9 @@
package it.tdlight.common.utils; package it.tdlight.common.utils;
public final class LibraryVersion { public final class LibraryVersion {
public static final String VERSION = "${project.version}"; public static final String VERSION = "${project.version}";
public static String IMPLEMENTATION_NAME = "tdlib"; public static final String IMPLEMENTATION_NAME = "tdlib";
public static final Class<?> LINUX_AMD64_CLASS = it.tdlight.jni.tdlib.linux.amd64.LoadLibrary.class;
public static final Class<?> LINUX_AARCH64_CLASS = it.tdlight.jni.tdlib.linux.aarch64.LoadLibrary.class;
public static final Class<?> WINDOWS_AMD64_CLASS = it.tdlight.jni.tdlib.win.amd64.LoadLibrary.class;
public static final Class<?> OSX_AMD64_CLASS = it.tdlight.jni.tdlib.osx.amd64.LoadLibrary.class;
} }

View File

@ -1,5 +1,9 @@
package it.tdlight.common.utils; package it.tdlight.common.utils;
public final class LibraryVersion { public final class LibraryVersion {
public static final String VERSION = "${project.version}"; public static final String VERSION = "${project.version}";
public static String IMPLEMENTATION_NAME = "tdlight"; public static final String IMPLEMENTATION_NAME = "tdlight";
public static final Class<?> LINUX_AMD64_CLASS = it.tdlight.jni.tdlight.linux.amd64.LoadLibrary.class;
public static final Class<?> LINUX_AARCH64_CLASS = it.tdlight.jni.tdlight.linux.aarch64.LoadLibrary.class;
public static final Class<?> WINDOWS_AMD64_CLASS = it.tdlight.jni.tdlight.win.amd64.LoadLibrary.class;
public static final Class<?> OSX_AMD64_CLASS = it.tdlight.jni.tdlight.osx.amd64.LoadLibrary.class;
} }

View File

@ -104,24 +104,21 @@ public class LoadLibrary {
case linux: case linux:
switch (arch) { switch (arch) {
case amd64: case amd64:
classForResource = it.tdlight.tdlight.linux.amd64.LoadLibrary.class; classForResource = LibraryVersion.LINUX_AMD64_CLASS;
break; break;
case aarch64: case aarch64:
classForResource = it.tdlight.tdlight.linux.aarch64.LoadLibrary.class; classForResource = LibraryVersion.LINUX_AARCH64_CLASS;
break; break;
} }
break; break;
// Unsupported platform:
/*
case osx: case osx:
if (arch == Arch.amd64) { if (arch == Arch.amd64) {
classForResource = it.tdlight.tdlight.osx.amd64.LoadLibrary.class; classForResource = LibraryVersion.OSX_AMD64_CLASS;
} }
break; break;
*/
case win: case win:
if (arch == Arch.amd64) { if (arch == Arch.amd64) {
classForResource = it.tdlight.tdlight.win.amd64.LoadLibrary.class; classForResource = LibraryVersion.WINDOWS_AMD64_CLASS;
} }
break; break;
} }