mirror of
https://github.com/xerial/snappy-java.git
synced 2025-07-12 08:34:30 +02:00
Merge branch 'release/1.0.5-M3'
This commit is contained in:
commit
1cc4d0a0c6
1
.gitignore
vendored
1
.gitignore
vendored
@ -5,6 +5,7 @@
|
|||||||
# IntelliJ
|
# IntelliJ
|
||||||
.idea
|
.idea
|
||||||
.idea_modules
|
.idea_modules
|
||||||
|
*.iml
|
||||||
|
|
||||||
# sbt specific
|
# sbt specific
|
||||||
bin/.lib
|
bin/.lib
|
||||||
|
@ -77,13 +77,6 @@ test:
|
|||||||
ssh $(AMD_SERVER) "source .zprofile && cd $(WORK) && $(TEST_CMD)"
|
ssh $(AMD_SERVER) "source .zprofile && cd $(WORK) && $(TEST_CMD)"
|
||||||
|
|
||||||
release:
|
release:
|
||||||
mvn release:prepare
|
mvn deploy -DperformRelease=true
|
||||||
mvn release:perform
|
|
||||||
|
|
||||||
release-xerial:
|
|
||||||
mvn release:perform -Dtag=snappy-java-$(VERSION)
|
|
||||||
|
|
||||||
release-sourceforge:
|
|
||||||
mvn release:perform -Darguments="-P sourceforge" -Dtag=snappy-java-$(VERSION)
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -2,6 +2,9 @@
|
|||||||
* `SnappyIndexer` for parallel compression/decompression
|
* `SnappyIndexer` for parallel compression/decompression
|
||||||
* CUI commands (snap/unsnap)
|
* CUI commands (snap/unsnap)
|
||||||
|
|
||||||
|
## snappy-java-1.0.5-M2 (27 September 2012)
|
||||||
|
* Upgrade release for snappy-1.0.5
|
||||||
|
|
||||||
## snappy-java-1.0.4.1 (5 September 2011)
|
## snappy-java-1.0.4.1 (5 September 2011)
|
||||||
* Fixes issue 33: Fixes a problem when reading incomplete input stream
|
* Fixes issue 33: Fixes a problem when reading incomplete input stream
|
||||||
|
|
||||||
|
@ -23,10 +23,10 @@ The snappy-java is a Java port of the snappy
|
|||||||
|
|
||||||
## Download
|
## Download
|
||||||
The current stable version is available from here:
|
The current stable version is available from here:
|
||||||
* Release version: http://maven.xerial.org/repository/artifact/org/xerial/snappy/snappy-java
|
* Release version: http://code.google.com/p/snappy-java/downloads/list
|
||||||
* [release plans](./snappy-java/Milestone.md)
|
* [Release plans](https://github.com/xerial/snappy-java/blob/develop/Milestone.md)
|
||||||
* Snapshot version (the latest beta version): https://oss.sonatype.org/content/repositories/snapshots/org/xerial/snappy/snappy-java/
|
* Snapshot version (the latest beta version): https://oss.sonatype.org/content/repositories/snapshots/org/xerial/snappy/snappy-java/
|
||||||
If you are a Maven user, see [#Using_with_Maven]
|
If you are a Maven user, see [pom.xml example](#using-with-maven).
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
First, import `org.xerial.snapy.Snappy` in your Java code:
|
First, import `org.xerial.snapy.Snappy` in your Java code:
|
||||||
|
12
pom.xml
12
pom.xml
@ -1,9 +1,10 @@
|
|||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||||
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>org.xerial.snappy</groupId>
|
<groupId>org.xerial.snappy</groupId>
|
||||||
<artifactId>snappy-java</artifactId>
|
<artifactId>snappy-java</artifactId>
|
||||||
<version>1.0.5-M2</version>
|
<version>1.0.5-M3</version>
|
||||||
<name>Snappy for Java</name>
|
<name>Snappy for Java</name>
|
||||||
<description>snappy-java: A fast compression/decompression library</description>
|
<description>snappy-java: A fast compression/decompression library</description>
|
||||||
<packaging>bundle</packaging>
|
<packaging>bundle</packaging>
|
||||||
@ -92,6 +93,12 @@
|
|||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-deploy-plugin</artifactId>
|
||||||
|
<version>2.7</version>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
@ -248,7 +255,6 @@
|
|||||||
</profiles>
|
</profiles>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>junit</groupId>
|
||||||
|
@ -78,7 +78,7 @@ public class OSInfo
|
|||||||
// ignored: fall back to "arm" arch (soft-float ABI)
|
// ignored: fall back to "arm" arch (soft-float ABI)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(getOSName().equals("Mac") && osArch.equals("universal")) {
|
else if(getOSName().equals("Mac") && (osArch.equals("universal") || osArch.equals("amd64"))) {
|
||||||
return "x86_64"; // Fix for openjdk7
|
return "x86_64"; // Fix for openjdk7
|
||||||
}
|
}
|
||||||
return translateArchNameToFolderName(osArch);
|
return translateArchNameToFolderName(osArch);
|
||||||
|
@ -24,13 +24,7 @@
|
|||||||
//--------------------------------------
|
//--------------------------------------
|
||||||
package org.xerial.snappy;
|
package org.xerial.snappy;
|
||||||
|
|
||||||
import java.io.BufferedInputStream;
|
import java.io.*;
|
||||||
import java.io.ByteArrayOutputStream;
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.FileOutputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
@ -411,13 +405,10 @@ public class SnappyLoader
|
|||||||
static File findNativeLibrary() {
|
static File findNativeLibrary() {
|
||||||
|
|
||||||
boolean useSystemLib = Boolean.parseBoolean(System.getProperty(KEY_SNAPPY_USE_SYSTEMLIB, "false"));
|
boolean useSystemLib = Boolean.parseBoolean(System.getProperty(KEY_SNAPPY_USE_SYSTEMLIB, "false"));
|
||||||
if (useSystemLib)
|
|
||||||
return null;
|
|
||||||
|
|
||||||
boolean disabledBundledLibs = Boolean
|
boolean disabledBundledLibs = Boolean
|
||||||
.parseBoolean(System.getProperty(KEY_SNAPPY_DISABLE_BUNDLED_LIBS, "false"));
|
.parseBoolean(System.getProperty(KEY_SNAPPY_DISABLE_BUNDLED_LIBS, "false"));
|
||||||
if (disabledBundledLibs)
|
if (useSystemLib || disabledBundledLibs)
|
||||||
return null;
|
return null; // Use a pre-installed libsnappyjava
|
||||||
|
|
||||||
// Try to load the library in org.xerial.snappy.lib.path */
|
// Try to load the library in org.xerial.snappy.lib.path */
|
||||||
String snappyNativeLibraryPath = System.getProperty(KEY_SNAPPY_LIB_PATH);
|
String snappyNativeLibraryPath = System.getProperty(KEY_SNAPPY_LIB_PATH);
|
||||||
@ -433,11 +424,26 @@ public class SnappyLoader
|
|||||||
return nativeLib;
|
return nativeLib;
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
|
||||||
// Load an OS-dependent native library inside a jar file
|
// Load an OS-dependent native library inside a jar file
|
||||||
snappyNativeLibraryPath = "/org/xerial/snappy/native/" + OSInfo.getNativeLibFolderPathForCurrentOS();
|
snappyNativeLibraryPath = "/org/xerial/snappy/native/" + OSInfo.getNativeLibFolderPathForCurrentOS();
|
||||||
|
boolean hasNativeLib = hasResource(snappyNativeLibraryPath + "/" + snappyNativeLibraryName);
|
||||||
|
if(!hasNativeLib) {
|
||||||
|
if(OSInfo.getOSName().equals("Mac")) {
|
||||||
|
// Fix for openjdk7 for Mac
|
||||||
|
String altName = "libsnappyjava.jnilib";
|
||||||
|
if(hasResource(snappyNativeLibraryPath + "/" + altName)) {
|
||||||
|
snappyNativeLibraryName = altName;
|
||||||
|
hasNativeLib = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!hasNativeLib) {
|
||||||
|
String errorMessage = String.format("no native library is found for os.name=%s and os.arch=%s", OSInfo.getOSName(), OSInfo.getArchName());
|
||||||
|
throw new SnappyError(SnappyErrorCode.FAILED_TO_LOAD_NATIVE_LIBRARY, errorMessage);
|
||||||
|
}
|
||||||
|
|
||||||
if (SnappyLoader.class.getResource(snappyNativeLibraryPath + "/" + snappyNativeLibraryName) != null) {
|
|
||||||
// Temporary library folder. Use the value of org.xerial.snappy.tempdir or java.io.tmpdir
|
// Temporary library folder. Use the value of org.xerial.snappy.tempdir or java.io.tmpdir
|
||||||
String tempFolder = new File(System.getProperty(KEY_SNAPPY_TEMPDIR,
|
String tempFolder = new File(System.getProperty(KEY_SNAPPY_TEMPDIR,
|
||||||
System.getProperty("java.io.tmpdir"))).getAbsolutePath();
|
System.getProperty("java.io.tmpdir"))).getAbsolutePath();
|
||||||
@ -445,10 +451,15 @@ public class SnappyLoader
|
|||||||
// Extract and load a native library inside the jar file
|
// Extract and load a native library inside the jar file
|
||||||
return extractLibraryFile(snappyNativeLibraryPath, snappyNativeLibraryName, tempFolder);
|
return extractLibraryFile(snappyNativeLibraryPath, snappyNativeLibraryName, tempFolder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static boolean hasResource(String path) {
|
||||||
|
return SnappyLoader.class.getResource(path) != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return null; // Use a pre-installed libsnappyjava
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the snappy-java version by reading pom.properties embedded in jar.
|
* Get the snappy-java version by reading pom.properties embedded in jar.
|
||||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user