Resolve native lib version collectly by referring VERSION file

This commit is contained in:
Taro L. Saito 2011-06-04 10:35:19 +09:00
parent f7c90faa1d
commit 26774e3ca7
2 changed files with 9 additions and 3 deletions

View File

@ -13,6 +13,12 @@
<build>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>org/xerial/snappy/VERSION</include>
</includes>
</resource>
<resource>
<directory>src/main/resources</directory>
<includes>
@ -23,7 +29,6 @@
<directory>${basedir}</directory>
<targetPath>META-INF/maven/${project.groupId}/${project.artifactId}</targetPath>
<includes>
<include>VERSION</include>
<include>LICENSE*</include>
</includes>
</resource>

View File

@ -96,7 +96,6 @@ public class LoadSnappy
String targetFolder) {
String nativeLibraryFilePath = libFolderForCurrentOS + "/" + libraryFileName;
final String prefix = "snappy-" + getVersion() + "-";
String extractedLibFileName = prefix + libraryFileName;
File extractedLibFile = new File(targetFolder, extractedLibFileName);
@ -226,7 +225,7 @@ public class LoadSnappy
URL versionFile = LoadSnappy.class.getResource("/META-INF/maven/org.xerial.snappy/snappy-java/pom.properties");
if (versionFile == null)
versionFile = LoadSnappy.class.getResource("/META-INF/maven/org.xerial.snappy/snappy-java/VERSION");
versionFile = LoadSnappy.class.getResource("/org/xerial/snappy/VERSION");
String version = "unknown";
try {
@ -234,6 +233,8 @@ public class LoadSnappy
Properties versionData = new Properties();
versionData.load(versionFile.openStream());
version = versionData.getProperty("version", version);
if (version.equals("unknown"))
version = versionData.getProperty("VERSION", version);
version = version.trim().replaceAll("[^0-9\\.]", "");
}
}