From ffd9edffeba295813ddca89a8c539392440c3c88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9F=A9=E8=91=A3?= <455808519@qq.com> Date: Fri, 27 Sep 2019 11:34:41 +0800 Subject: [PATCH] Temporarily fixed version number is 1 I think we can temporarily fix the version number to 1, and then tf2.x declares the Implementation-Version. --- .../main/java/org/tensorflow/NativeLibrary.java | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/tensorflow/java/src/main/java/org/tensorflow/NativeLibrary.java b/tensorflow/java/src/main/java/org/tensorflow/NativeLibrary.java index 17b78a104f8..073977fae8f 100644 --- a/tensorflow/java/src/main/java/org/tensorflow/NativeLibrary.java +++ b/tensorflow/java/src/main/java/org/tensorflow/NativeLibrary.java @@ -71,12 +71,6 @@ final class NativeLibrary { log("frameworkResourceName: " + frameworkResourceName); final InputStream frameworkResource = NativeLibrary.class.getClassLoader().getResourceAsStream(frameworkResourceName); - if ("libtensorflow_framework.so".equals(frameworkLibName)) { - frameworkLibName = "libtensorflow_framework.so.1"; - } - if ("libtensorflow_framework.dylib".equals(frameworkLibName)) { - frameworkLibName = "libtensorflow_framework.1.dylib"; - } // Do not complain if the framework resource wasn't found. This may just mean that we're // building with --config=monolithic (in which case it's not needed and not included). if (jniResource == null) { @@ -139,9 +133,9 @@ final class NativeLibrary { private static String getVersionedLibraryName(String libFilename) { // If the resource exists as an unversioned file, return that. - if (resourceExists(libFilename)) { - return libFilename; - } + // if (resourceExists(libFilename)) { + // return libFilename; + // } final String versionName = getMajorVersionNumber(); @@ -180,11 +174,13 @@ final class NativeLibrary { * determined. */ private static String getMajorVersionNumber() { + // getImplementationVersion() retrun null. String version = NativeLibrary.class.getPackage().getImplementationVersion(); // expecting a string like 1.14.0, we want to get the first '1'. int dotIndex; if (version == null || (dotIndex = version.indexOf('.')) == -1) { - return null; + // we want to get the version 1. + return "1"; } String majorVersion = version.substring(0, dotIndex); try {