Merge branch 'release/1.0.5-M3'

This commit is contained in:
Taro L. Saito 2012-09-28 12:05:01 +09:00
commit 1cc4d0a0c6
9 changed files with 520 additions and 506 deletions

1
.gitignore vendored
View File

@ -5,6 +5,7 @@
# IntelliJ
.idea
.idea_modules
*.iml
# sbt specific
bin/.lib

260
Makefile
View File

@ -1,130 +1,130 @@
include Makefile.common
MVN:=mvn
all: snappy
SNAPPY_OUT:=$(TARGET)/$(snappy)-$(os_arch)
SNAPPY_ARCHIVE:=$(TARGET)/snappy-$(VERSION).tar.gz
SNAPPY_CC:=snappy-sinksource.cc snappy-stubs-internal.cc snappy.cc
SNAPPY_SRC_DIR:=$(TARGET)/snappy-$(VERSION)
SNAPPY_SRC:=$(addprefix $(SNAPPY_SRC_DIR)/,$(SNAPPY_CC))
SNAPPY_OBJ:=$(addprefix $(SNAPPY_OUT)/,$(patsubst %.cc,%.o,$(SNAPPY_CC)) SnappyNative.o)
SNAPPY_UNPACKED:=$(TARGET)/snappy-extracted.log
CXXFLAGS:=$(CXXFLAGS) -I$(SNAPPY_SRC_DIR)
$(SNAPPY_ARCHIVE):
@mkdir -p $(@D)
curl -o$@ http://snappy.googlecode.com/files/snappy-$(VERSION).tar.gz
$(SNAPPY_UNPACKED): $(SNAPPY_ARCHIVE)
tar xvfz $< -C $(TARGET)
touch $@
jni-header: $(SRC)/org/xerial/snappy/SnappyNative.h
$(SRC)/org/xerial/snappy/SnappyNative.h: $(SRC)/org/xerial/snappy/SnappyNative.java
@mkdir -p $(TARGET)/classes
$(JAVAH) -classpath $(TARGET)/classes -o $@ org.xerial.snappy.SnappyNative
bytecode: src/main/resources/org/xerial/snappy/SnappyNativeLoader.bytecode
src/main/resources/org/xerial/snappy/SnappyNativeLoader.bytecode: src/main/resources/org/xerial/snappy/SnappyNativeLoader.java
@mkdir -p $(TARGET)/temp
$(JAVAC) -source 1.5 -target 1.5 -d $(TARGET)/temp $<
cp $(TARGET)/temp/org/xerial/snappy/SnappyNativeLoader.class $@
$(SNAPPY_SRC): $(SNAPPY_UNPACKED)
$(SNAPPY_OUT)/%.o : $(SNAPPY_SRC_DIR)/%.cc
@mkdir -p $(@D)
$(CXX) $(CXXFLAGS) -c $< -o $@
$(SNAPPY_OUT)/SnappyNative.o : $(SRC)/org/xerial/snappy/SnappyNative.cpp $(SRC)/org/xerial/snappy/SnappyNative.h
@mkdir -p $(@D)
$(CXX) $(CXXFLAGS) -c $< -o $@
$(SNAPPY_OUT)/$(LIBNAME): $(SNAPPY_OBJ)
$(CXX) $(CXXFLAGS) -o $@ $+ $(LINKFLAGS)
$(STRIP) $@
clean-native:
rm -rf $(SNAPPY_OUT)
clean:
rm -rf $(TARGET)
NATIVE_DIR:=src/main/resources/org/xerial/snappy/native/$(OS_NAME)/$(OS_ARCH)
NATIVE_TARGET_DIR:=$(TARGET)/classes/org/xerial/snappy/native/$(OS_NAME)/$(OS_ARCH)
NATIVE_DLL:=$(NATIVE_DIR)/$(LIBNAME)
snappy-jar-version:=snappy-java-$(shell $(JAVA) -jar lib/silk-weaver.jar find 'project(artifactId, version)' pom.xml | grep snappy-java | awk '{ print $$2; }')
native: $(SNAPPY_UNPACKED) $(NATIVE_DLL)
snappy: native $(TARGET)/$(snappy-jar-version).jar
$(NATIVE_DLL): $(SNAPPY_OUT)/$(LIBNAME)
@mkdir -p $(@D)
cp $< $@
@mkdir -p $(NATIVE_TARGET_DIR)
cp $< $(NATIVE_TARGET_DIR)/$(LIBNAME)
$(TARGET)/$(snappy-jar-version).jar: native $(NATIVE_DLL)
$(MVN) package -Dmaven.test.skip=true
test: $(NATIVE_DLL)
$(MVN) test
win32:
$(MAKE) native CROSS_PREFIX=i686-w64-mingw32- OS_NAME=Windows OS_ARCH=x86
# for cross-compilation on Ubuntu, install the g++-mingw-w64-x86-64 package
win64:
$(MAKE) native CROSS_PREFIX=x86_64-w64-mingw32- OS_NAME=Windows OS_ARCH=amd64
mac32:
$(MAKE) native OS_NAME=Mac OS_ARCH=i386
linux32:
$(MAKE) native OS_NAME=Linux OS_ARCH=i386
# for cross-compilation on Ubuntu, install the g++-arm-linux-gnueabi package
linux-arm:
$(MAKE) native CROSS_PREFIX=arm-linux-gnueabi- OS_NAME=Linux OS_ARCH=arm
# for cross-compilation on Ubuntu, install the g++-arm-linux-gnueabihf package
linux-armhf:
$(MAKE) native CROSS_PREFIX=arm-linux-gnueabihf- OS_NAME=Linux OS_ARCH=armhf
clean-native-linux32:
$(MAKE) clean-native OS_NAME=Linux OS_ARCH=i386
clean-native-win32:
$(MAKE) clean-native OS_NAME=Windows OS_ARCH=x86
javadoc:
$(MVN) javadoc:javadoc -DreportOutputDirectory=wiki/apidocs
googlecode-upload: googlecode-lib-upload googlecode-src-upload
googlecode-lib-upload: $(TARGET)/snappy-java-$(VERSION)-lib.upload
googlecode-src-upload: $(TARGET)/snappy-java-$(VERSION)-src.upload
GOOGLECODE_USER:=leo@xerial.org
$(TARGET)/snappy-java-$(VERSION)-lib.upload:
./googlecode_upload.py -s "library for all platforms" -p snappy-java -l "Type-Executable,Featured,OpSys-All" -u "$(GOOGLECODE_USER)" target/snappy-java-$(VERSION).jar
touch $@
$(TARGET)/snappy-java-$(VERSION)-src.upload:
./googlecode_upload.py -s "source code archive" -p snappy-java -l "Type-Source,OpSys-All" -u "$(GOOGLECODE_USER)" target/snappy-java-$(VERSION).tar.gz
touch $@
include Makefile.common
MVN:=mvn
all: snappy
SNAPPY_OUT:=$(TARGET)/$(snappy)-$(os_arch)
SNAPPY_ARCHIVE:=$(TARGET)/snappy-$(VERSION).tar.gz
SNAPPY_CC:=snappy-sinksource.cc snappy-stubs-internal.cc snappy.cc
SNAPPY_SRC_DIR:=$(TARGET)/snappy-$(VERSION)
SNAPPY_SRC:=$(addprefix $(SNAPPY_SRC_DIR)/,$(SNAPPY_CC))
SNAPPY_OBJ:=$(addprefix $(SNAPPY_OUT)/,$(patsubst %.cc,%.o,$(SNAPPY_CC)) SnappyNative.o)
SNAPPY_UNPACKED:=$(TARGET)/snappy-extracted.log
CXXFLAGS:=$(CXXFLAGS) -I$(SNAPPY_SRC_DIR)
$(SNAPPY_ARCHIVE):
@mkdir -p $(@D)
curl -o$@ http://snappy.googlecode.com/files/snappy-$(VERSION).tar.gz
$(SNAPPY_UNPACKED): $(SNAPPY_ARCHIVE)
tar xvfz $< -C $(TARGET)
touch $@
jni-header: $(SRC)/org/xerial/snappy/SnappyNative.h
$(SRC)/org/xerial/snappy/SnappyNative.h: $(SRC)/org/xerial/snappy/SnappyNative.java
@mkdir -p $(TARGET)/classes
$(JAVAH) -classpath $(TARGET)/classes -o $@ org.xerial.snappy.SnappyNative
bytecode: src/main/resources/org/xerial/snappy/SnappyNativeLoader.bytecode
src/main/resources/org/xerial/snappy/SnappyNativeLoader.bytecode: src/main/resources/org/xerial/snappy/SnappyNativeLoader.java
@mkdir -p $(TARGET)/temp
$(JAVAC) -source 1.5 -target 1.5 -d $(TARGET)/temp $<
cp $(TARGET)/temp/org/xerial/snappy/SnappyNativeLoader.class $@
$(SNAPPY_SRC): $(SNAPPY_UNPACKED)
$(SNAPPY_OUT)/%.o : $(SNAPPY_SRC_DIR)/%.cc
@mkdir -p $(@D)
$(CXX) $(CXXFLAGS) -c $< -o $@
$(SNAPPY_OUT)/SnappyNative.o : $(SRC)/org/xerial/snappy/SnappyNative.cpp $(SRC)/org/xerial/snappy/SnappyNative.h
@mkdir -p $(@D)
$(CXX) $(CXXFLAGS) -c $< -o $@
$(SNAPPY_OUT)/$(LIBNAME): $(SNAPPY_OBJ)
$(CXX) $(CXXFLAGS) -o $@ $+ $(LINKFLAGS)
$(STRIP) $@
clean-native:
rm -rf $(SNAPPY_OUT)
clean:
rm -rf $(TARGET)
NATIVE_DIR:=src/main/resources/org/xerial/snappy/native/$(OS_NAME)/$(OS_ARCH)
NATIVE_TARGET_DIR:=$(TARGET)/classes/org/xerial/snappy/native/$(OS_NAME)/$(OS_ARCH)
NATIVE_DLL:=$(NATIVE_DIR)/$(LIBNAME)
snappy-jar-version:=snappy-java-$(shell $(JAVA) -jar lib/silk-weaver.jar find 'project(artifactId, version)' pom.xml | grep snappy-java | awk '{ print $$2; }')
native: $(SNAPPY_UNPACKED) $(NATIVE_DLL)
snappy: native $(TARGET)/$(snappy-jar-version).jar
$(NATIVE_DLL): $(SNAPPY_OUT)/$(LIBNAME)
@mkdir -p $(@D)
cp $< $@
@mkdir -p $(NATIVE_TARGET_DIR)
cp $< $(NATIVE_TARGET_DIR)/$(LIBNAME)
$(TARGET)/$(snappy-jar-version).jar: native $(NATIVE_DLL)
$(MVN) package -Dmaven.test.skip=true
test: $(NATIVE_DLL)
$(MVN) test
win32:
$(MAKE) native CROSS_PREFIX=i686-w64-mingw32- OS_NAME=Windows OS_ARCH=x86
# for cross-compilation on Ubuntu, install the g++-mingw-w64-x86-64 package
win64:
$(MAKE) native CROSS_PREFIX=x86_64-w64-mingw32- OS_NAME=Windows OS_ARCH=amd64
mac32:
$(MAKE) native OS_NAME=Mac OS_ARCH=i386
linux32:
$(MAKE) native OS_NAME=Linux OS_ARCH=i386
# for cross-compilation on Ubuntu, install the g++-arm-linux-gnueabi package
linux-arm:
$(MAKE) native CROSS_PREFIX=arm-linux-gnueabi- OS_NAME=Linux OS_ARCH=arm
# for cross-compilation on Ubuntu, install the g++-arm-linux-gnueabihf package
linux-armhf:
$(MAKE) native CROSS_PREFIX=arm-linux-gnueabihf- OS_NAME=Linux OS_ARCH=armhf
clean-native-linux32:
$(MAKE) clean-native OS_NAME=Linux OS_ARCH=i386
clean-native-win32:
$(MAKE) clean-native OS_NAME=Windows OS_ARCH=x86
javadoc:
$(MVN) javadoc:javadoc -DreportOutputDirectory=wiki/apidocs
googlecode-upload: googlecode-lib-upload googlecode-src-upload
googlecode-lib-upload: $(TARGET)/snappy-java-$(VERSION)-lib.upload
googlecode-src-upload: $(TARGET)/snappy-java-$(VERSION)-src.upload
GOOGLECODE_USER:=leo@xerial.org
$(TARGET)/snappy-java-$(VERSION)-lib.upload:
./googlecode_upload.py -s "library for all platforms" -p snappy-java -l "Type-Executable,Featured,OpSys-All" -u "$(GOOGLECODE_USER)" target/snappy-java-$(VERSION).jar
touch $@
$(TARGET)/snappy-java-$(VERSION)-src.upload:
./googlecode_upload.py -s "source code archive" -p snappy-java -l "Type-Source,OpSys-All" -u "$(GOOGLECODE_USER)" target/snappy-java-$(VERSION).tar.gz
touch $@

View File

@ -1,89 +1,82 @@
# Makefile for building and collecting native libraries in Win/Mac/Linux (32/64bit).
include Makefile.common
RESOURCE_DIR=src/main/resources
NATIVE_DIR=$(RESOURCE_DIR)/native
RSYNC=rsync -av -e ssh --exclude=".hg"
WORK:=work/hg/snappy-java
WIN64_SERVER=localhost
MAC_SERVER=172.16.133.41
MAC_TIGER_SERVER=172.16.133.171
AMD_SERVER=hx02
BUILD_CMD_PREFIX = hg pull -u && make clean-native && make
BUILD_CMD = $(BUILD_CMD_PREFIX) native
TEST_CMD = hg pull -u && mvn test
all: compile test
.PHONY: compile test native clean
DLL_DIR=src/main/resources/org/xerial/snappy/native
DLL_WIN=$(DLL_DIR)/Windows/x86/snappyjava.dll
DLL_WIN64=$(DLL_DIR)/Windows/amd64/snappyjava.dll
DLL_MAC=$(DLL_DIR)/Mac/x86_64/libsnappyjava.jnilib
DLL_TIGER_MAC=$(DLL_DIR)/Mac/i386/libsnappyjava.jnilib
DLL_LINUX=$(DLL_DIR)/Linux/i386/libsnappyjava.so
DLL_AMD64=$(DLL_DIR)/Linux/amd64/libsnappyjava.so
version_file:=src/main/java/org/xerial/snappy/VERSION
$(DLL_WIN): $(version_file)
ssh $(WIN64_SERVER) "source .zprofile && cd $(WORK) && $(BUILD_CMD_PREFIX) win32"
mkdir -p $(dir $(DLL_WIN))
$(RSYNC) $(WIN_SERVER):./$(WORK)/$(DLL_WIN) $(DLL_WIN)
$(DLL_WIN64): $(version_file)
ssh $(WIN64_SERVER) "source .zprofile && cd $(WORK) && $(BUILD_CMD)"
mkdir -p $(dir $(DLL_WIN64))
$(RSYNC) $(WIN64_SERVER):./$(WORK)/$(DLL_WIN64) $(DLL_WIN64)
$(DLL_MAC): $(version_file)
ssh $(MAC_SERVER) "source .zprofile && cd $(WORK) && $(BUILD_CMD)"
mkdir -p $(dir $(DLL_MAC))
$(RSYNC) $(MAC_SERVER):./$(WORK)/$(DLL_MAC) $(DLL_MAC)
$(DLL_TIGER_MAC): $(version_file)
ssh $(MAC_TIGER_SERVER) "source .zprofile && cd $(WORK) && $(BUILD_CMD)"
mkdir -p $(dir $(DLL_TIGER_MAC))
$(RSYNC) $(MAC_TIGER_SERVER):./$(WORK)/$(DLL_TIGER_MAC) $(DLL_TIGER_MAC)
$(DLL_LINUX):$(version_file)
ssh $(AMD_SERVER) "source .zprofile && cd $(WORK) && $(BUILD_CMD_PREFIX) linux32"
mkdir -p $(dir $(DLL_LINUX))
$(RSYNC) $(AMD_SERVER):./$(WORK)/$(DLL_LINUX) $(DLL_LINUX)
$(DLL_AMD64):$(version_file)
ssh $(AMD_SERVER) "source .zprofile && cd $(WORK) && $(BUILD_CMD)"
mkdir -p $(dir $(DLL_AMD64))
$(RSYNC) $(AMD_SERVER):./$(WORK)/$(DLL_AMD64) $(DLL_AMD64)
native: $(DLL_WIN) $(DLL_WIN64) $(DLL_LINUX) $(DLL_AMD64) $(DLL_MAC) $(DLL_TIGER_MAC)
compile: native
test:
ssh $(WIN64_SERVER) "source .zprofile && cd $(WORK) && $(TEST_CMD)"
ssh $(MAC_SERVER) "source .zprofile && cd $(WORK) && $(TEST_CMD)"
ssh $(MAC_TIGER_SERVER) "source .zprofile && cd $(WORK) && $(TEST_CMD)"
ssh $(AMD_SERVER) "source .zprofile && cd $(WORK) && $(TEST_CMD)"
release:
mvn release:prepare
mvn release:perform
release-xerial:
mvn release:perform -Dtag=snappy-java-$(VERSION)
release-sourceforge:
mvn release:perform -Darguments="-P sourceforge" -Dtag=snappy-java-$(VERSION)
# Makefile for building and collecting native libraries in Win/Mac/Linux (32/64bit).
include Makefile.common
RESOURCE_DIR=src/main/resources
NATIVE_DIR=$(RESOURCE_DIR)/native
RSYNC=rsync -av -e ssh --exclude=".hg"
WORK:=work/hg/snappy-java
WIN64_SERVER=localhost
MAC_SERVER=172.16.133.41
MAC_TIGER_SERVER=172.16.133.171
AMD_SERVER=hx02
BUILD_CMD_PREFIX = hg pull -u && make clean-native && make
BUILD_CMD = $(BUILD_CMD_PREFIX) native
TEST_CMD = hg pull -u && mvn test
all: compile test
.PHONY: compile test native clean
DLL_DIR=src/main/resources/org/xerial/snappy/native
DLL_WIN=$(DLL_DIR)/Windows/x86/snappyjava.dll
DLL_WIN64=$(DLL_DIR)/Windows/amd64/snappyjava.dll
DLL_MAC=$(DLL_DIR)/Mac/x86_64/libsnappyjava.jnilib
DLL_TIGER_MAC=$(DLL_DIR)/Mac/i386/libsnappyjava.jnilib
DLL_LINUX=$(DLL_DIR)/Linux/i386/libsnappyjava.so
DLL_AMD64=$(DLL_DIR)/Linux/amd64/libsnappyjava.so
version_file:=src/main/java/org/xerial/snappy/VERSION
$(DLL_WIN): $(version_file)
ssh $(WIN64_SERVER) "source .zprofile && cd $(WORK) && $(BUILD_CMD_PREFIX) win32"
mkdir -p $(dir $(DLL_WIN))
$(RSYNC) $(WIN_SERVER):./$(WORK)/$(DLL_WIN) $(DLL_WIN)
$(DLL_WIN64): $(version_file)
ssh $(WIN64_SERVER) "source .zprofile && cd $(WORK) && $(BUILD_CMD)"
mkdir -p $(dir $(DLL_WIN64))
$(RSYNC) $(WIN64_SERVER):./$(WORK)/$(DLL_WIN64) $(DLL_WIN64)
$(DLL_MAC): $(version_file)
ssh $(MAC_SERVER) "source .zprofile && cd $(WORK) && $(BUILD_CMD)"
mkdir -p $(dir $(DLL_MAC))
$(RSYNC) $(MAC_SERVER):./$(WORK)/$(DLL_MAC) $(DLL_MAC)
$(DLL_TIGER_MAC): $(version_file)
ssh $(MAC_TIGER_SERVER) "source .zprofile && cd $(WORK) && $(BUILD_CMD)"
mkdir -p $(dir $(DLL_TIGER_MAC))
$(RSYNC) $(MAC_TIGER_SERVER):./$(WORK)/$(DLL_TIGER_MAC) $(DLL_TIGER_MAC)
$(DLL_LINUX):$(version_file)
ssh $(AMD_SERVER) "source .zprofile && cd $(WORK) && $(BUILD_CMD_PREFIX) linux32"
mkdir -p $(dir $(DLL_LINUX))
$(RSYNC) $(AMD_SERVER):./$(WORK)/$(DLL_LINUX) $(DLL_LINUX)
$(DLL_AMD64):$(version_file)
ssh $(AMD_SERVER) "source .zprofile && cd $(WORK) && $(BUILD_CMD)"
mkdir -p $(dir $(DLL_AMD64))
$(RSYNC) $(AMD_SERVER):./$(WORK)/$(DLL_AMD64) $(DLL_AMD64)
native: $(DLL_WIN) $(DLL_WIN64) $(DLL_LINUX) $(DLL_AMD64) $(DLL_MAC) $(DLL_TIGER_MAC)
compile: native
test:
ssh $(WIN64_SERVER) "source .zprofile && cd $(WORK) && $(TEST_CMD)"
ssh $(MAC_SERVER) "source .zprofile && cd $(WORK) && $(TEST_CMD)"
ssh $(MAC_TIGER_SERVER) "source .zprofile && cd $(WORK) && $(TEST_CMD)"
ssh $(AMD_SERVER) "source .zprofile && cd $(WORK) && $(TEST_CMD)"
release:
mvn deploy -DperformRelease=true

View File

@ -2,6 +2,9 @@
* `SnappyIndexer` for parallel compression/decompression
* 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)
* Fixes issue 33: Fixes a problem when reading incomplete input stream

View File

@ -23,10 +23,10 @@ The snappy-java is a Java port of the snappy
## Download
The current stable version is available from here:
* Release version: http://maven.xerial.org/repository/artifact/org/xerial/snappy/snappy-java
* [release plans](./snappy-java/Milestone.md)
* Release version: http://code.google.com/p/snappy-java/downloads/list
* [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/
If you are a Maven user, see [#Using_with_Maven]
If you are a Maven user, see [pom.xml example](#using-with-maven).
## Usage
First, import `org.xerial.snapy.Snappy` in your Java code:

522
pom.xml
View File

@ -1,283 +1,289 @@
<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>
<groupId>org.xerial.snappy</groupId>
<artifactId>snappy-java</artifactId>
<version>1.0.5-M2</version>
<name>Snappy for Java</name>
<description>snappy-java: A fast compression/decompression library</description>
<packaging>bundle</packaging>
<modelVersion>4.0.0</modelVersion>
<groupId>org.xerial.snappy</groupId>
<artifactId>snappy-java</artifactId>
<version>1.0.5-M3</version>
<name>Snappy for Java</name>
<description>snappy-java: A fast compression/decompression library</description>
<packaging>bundle</packaging>
<parent>
<groupId>org.sonatype.oss</groupId>
<artifactId>oss-parent</artifactId>
<version>7</version>
</parent>
<parent>
<groupId>org.sonatype.oss</groupId>
<artifactId>oss-parent</artifactId>
<version>7</version>
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses>
<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses>
<developers>
<developer>
<id>leo</id>
<name>Taro L. Saito</name>
<email>leo@xerial.org</email>
<organization>Xerial Project</organization>
<roles>
<role>Architect</role>
<role>Project Manager</role>
<role>Chief Developer</role>
</roles>
<timezone>+9</timezone>
</developer>
</developers>
<developers>
<developer>
<id>leo</id>
<name>Taro L. Saito</name>
<email>leo@xerial.org</email>
<organization>Xerial Project</organization>
<roles>
<role>Architect</role>
<role>Project Manager</role>
<role>Chief Developer</role>
</roles>
<timezone>+9</timezone>
</developer>
</developers>
<organization>
<name>xerial.org</name>
<url>http://www.xerial.org/</url>
</organization>
<organization>
<name>xerial.org</name>
<url>http://www.xerial.org/</url>
</organization>
<build>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>org/xerial/snappy/VERSION</include>
</includes>
</resource>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>org/xerial/snappy/*.bytecode</include>
<include>org/xerial/snappy/native/**</include>
</includes>
</resource>
<resource>
<directory>${basedir}</directory>
<targetPath>META-INF/maven/${project.groupId}/${project.artifactId}</targetPath>
<includes>
<include>LICENSE*</include>
</includes>
</resource>
</resources>
<testResources>
<testResource>
<directory>src/test/java</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</testResource>
<testResource>
<directory>src/test/resources</directory>
</testResource>
</testResources>
<build>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>org/xerial/snappy/VERSION</include>
</includes>
</resource>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>org/xerial/snappy/*.bytecode</include>
<include>org/xerial/snappy/native/**</include>
</includes>
</resource>
<resource>
<directory>${basedir}</directory>
<targetPath>META-INF/maven/${project.groupId}/${project.artifactId}</targetPath>
<includes>
<include>LICENSE*</include>
</includes>
</resource>
</resources>
<testResources>
<testResource>
<directory>src/test/java</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</testResource>
<testResource>
<directory>src/test/resources</directory>
</testResource>
</testResources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.5</version>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.5</version>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.7</version>
</plugin>
<plugin>
<artifactId>maven-release-plugin</artifactId>
<version>2.1</version>
<configuration>
<!-- do not run site-deploy goal, included in the default settings -->
<goals>deploy</goals>
<pushChanges>false</pushChanges>
<localCheckout>true</localCheckout>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.4</version>
<configuration>
<useAgent>true</useAgent>
</configuration>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-release-plugin</artifactId>
<version>2.1</version>
<configuration>
<!-- do not run site-deploy goal, included in the default settings -->
<goals>deploy</goals>
<pushChanges>false</pushChanges>
<localCheckout>true</localCheckout>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.8</version>
<configuration>
<charset>UTF-8</charset>
<locale>en_US</locale>
<show>public</show>
<stylesheetfile>stylesheet.css</stylesheetfile>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.4</version>
<configuration>
<useAgent>true</useAgent>
</configuration>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.1.2</version>
<configuration>
<excludeResources>true</excludeResources>
</configuration>
<executions>
<execution>
<id>attach-sources</id>
<phase>verify</phase>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.8</version>
<configuration>
<charset>UTF-8</charset>
<locale>en_US</locale>
<show>public</show>
<stylesheetfile>stylesheet.css</stylesheetfile>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.3.4</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
<Bundle-Name>${pproject.name}</Bundle-Name>
<Bundle-Version>${project.version}</Bundle-Version>
<Bundle-Activator>org.xerial.snappy.SnappyBundleActivator</Bundle-Activator>
<Export-Package>org.xerial.snappy</Export-Package>
<Import-Package>org.osgi.framework;version="[1.5,2)"</Import-Package>
</instructions>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.1.2</version>
<configuration>
<excludeResources>true</excludeResources>
</configuration>
<executions>
<execution>
<id>attach-sources</id>
<phase>verify</phase>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2.1</version>
<configuration>
<descriptors>
<descriptor>src/assembly/project.xml</descriptor>
</descriptors>
<appendAssemblyId>false</appendAssemblyId>
<attach>false</attach>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.3.4</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
<Bundle-Name>${pproject.name}</Bundle-Name>
<Bundle-Version>${project.version}</Bundle-Version>
<Bundle-Activator>org.xerial.snappy.SnappyBundleActivator</Bundle-Activator>
<Export-Package>org.xerial.snappy</Export-Package>
<Import-Package>org.osgi.framework;version="[1.5,2)"</Import-Package>
</instructions>
</configuration>
</plugin>
<extensions>
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ssh-external</artifactId>
<version>1.0-beta-7</version>
</extension>
</extensions>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2.1</version>
<configuration>
<descriptors>
<descriptor>src/assembly/project.xml</descriptor>
</descriptors>
<appendAssemblyId>false</appendAssemblyId>
<attach>false</attach>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<extensions>
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ssh-external</artifactId>
<version>1.0-beta-7</version>
</extension>
</extensions>
</build>
<url>http://github.com/xerial/snappy-java/</url>
<issueManagement>
<system>GitHub</system>
<url>http://github.com/xerial/snappy-java/issues/list</url>
</issueManagement>
<inceptionYear>2011</inceptionYear>
<scm>
<connection>scm:git@github.com:xerial/snappy-java.git</connection>
<developerConnection>scm:git:git@github.com:xerial/snappy-java.git</developerConnection>
<url>git@github.com:xerial/snappy-java.git</url>
</scm>
<url>http://github.com/xerial/snappy-java/</url>
<issueManagement>
<system>GitHub</system>
<url>http://github.com/xerial/snappy-java/issues/list</url>
</issueManagement>
<inceptionYear>2011</inceptionYear>
<scm>
<connection>scm:git@github.com:xerial/snappy-java.git</connection>
<developerConnection>scm:git:git@github.com:xerial/snappy-java.git</developerConnection>
<url>git@github.com:xerial/snappy-java.git</url>
</scm>
<profiles>
<!-- for local updates -->
<profile>
<id>xerial.local</id>
<distributionManagement>
<repository>
<id>xerial.local</id>
<name>Xerial Maven Repository</name>
<url>file:///home/web/maven.xerial.org/repository/artifact</url>
</repository>
<snapshotRepository>
<id>xerial.local</id>
<name>Xerial Maven Snapshot Repository</name>
<url>file:///home/web/maven.xerial.org/repository/snapshot</url>
<uniqueVersion>false</uniqueVersion>
</snapshotRepository>
<site>
<id>xerial.local</id>
<url>file:///home/web/maven.xerial.org/repository/site</url>
</site>
</distributionManagement>
</profile>
</profiles>
<profiles>
<!-- for local updates -->
<profile>
<id>xerial.local</id>
<distributionManagement>
<repository>
<id>xerial.local</id>
<name>Xerial Maven Repository</name>
<url>file:///home/web/maven.xerial.org/repository/artifact</url>
</repository>
<snapshotRepository>
<id>xerial.local</id>
<name>Xerial Maven Snapshot Repository</name>
<url>file:///home/web/maven.xerial.org/repository/snapshot</url>
<uniqueVersion>false</uniqueVersion>
</snapshotRepository>
<site>
<id>xerial.local</id>
<url>file:///home/web/maven.xerial.org/repository/site</url>
</site>
</distributionManagement>
</profile>
</profiles>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<type>jar</type>
<scope>test</scope>
</dependency>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<type>jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-classworlds</artifactId>
<version>2.4</version>
<type>jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>core</artifactId>
<version>4.3.0</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.xerial</groupId>
<artifactId>xerial-core</artifactId>
<version>1.0.21</version>
<type>jar</type>
<scope>test</scope>
</dependency>
</dependencies>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-classworlds</artifactId>
<version>2.4</version>
<type>jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>core</artifactId>
<version>4.3.0</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.xerial</groupId>
<artifactId>xerial-core</artifactId>
<version>1.0.21</version>
<type>jar</type>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View File

@ -78,9 +78,9 @@ public class OSInfo
// ignored: fall back to "arm" arch (soft-float ABI)
}
}
else if(getOSName().equals("Mac") && osArch.equals("universal")) {
return "x86_64"; // Fix for openjdk7
}
else if(getOSName().equals("Mac") && (osArch.equals("universal") || osArch.equals("amd64"))) {
return "x86_64"; // Fix for openjdk7
}
return translateArchNameToFolderName(osArch);
}

View File

@ -24,13 +24,7 @@
//--------------------------------------
package org.xerial.snappy;
import java.io.BufferedInputStream;
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.io.*;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.URL;
@ -411,13 +405,10 @@ public class SnappyLoader
static File findNativeLibrary() {
boolean useSystemLib = Boolean.parseBoolean(System.getProperty(KEY_SNAPPY_USE_SYSTEMLIB, "false"));
if (useSystemLib)
return null;
boolean disabledBundledLibs = Boolean
.parseBoolean(System.getProperty(KEY_SNAPPY_DISABLE_BUNDLED_LIBS, "false"));
if (disabledBundledLibs)
return null;
if (useSystemLib || disabledBundledLibs)
return null; // Use a pre-installed libsnappyjava
// Try to load the library in org.xerial.snappy.lib.path */
String snappyNativeLibraryPath = System.getProperty(KEY_SNAPPY_LIB_PATH);
@ -433,23 +424,43 @@ public class SnappyLoader
return nativeLib;
}
{
// Load an OS-dependent native library inside a jar file
snappyNativeLibraryPath = "/org/xerial/snappy/native/" + OSInfo.getNativeLibFolderPathForCurrentOS();
if (SnappyLoader.class.getResource(snappyNativeLibraryPath + "/" + snappyNativeLibraryName) != null) {
// Temporary library folder. Use the value of org.xerial.snappy.tempdir or java.io.tmpdir
String tempFolder = new File(System.getProperty(KEY_SNAPPY_TEMPDIR,
System.getProperty("java.io.tmpdir"))).getAbsolutePath();
// Extract and load a native library inside the jar file
return extractLibraryFile(snappyNativeLibraryPath, snappyNativeLibraryName, tempFolder);
// Load an OS-dependent native library inside a jar file
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;
}
}
}
return null; // Use a pre-installed libsnappyjava
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);
}
// Temporary library folder. Use the value of org.xerial.snappy.tempdir or java.io.tmpdir
String tempFolder = new File(System.getProperty(KEY_SNAPPY_TEMPDIR,
System.getProperty("java.io.tmpdir"))).getAbsolutePath();
// Extract and load a native library inside the jar file
return extractLibraryFile(snappyNativeLibraryPath, snappyNativeLibraryName, tempFolder);
}
private static boolean hasResource(String path) {
return SnappyLoader.class.getResource(path) != null;
}
/**
* Get the snappy-java version by reading pom.properties embedded in jar.
* This version data is used as a suffix of a dll file extracted from the