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 # IntelliJ
.idea .idea
.idea_modules .idea_modules
*.iml
# sbt specific # sbt specific
bin/.lib bin/.lib

260
Makefile
View File

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

View File

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

View File

@ -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

View File

@ -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:

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

View File

@ -78,9 +78,9 @@ 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);
} }

View File

@ -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,23 +424,43 @@ public class SnappyLoader
return nativeLib; 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) { // Load an OS-dependent native library inside a jar file
// Temporary library folder. Use the value of org.xerial.snappy.tempdir or java.io.tmpdir snappyNativeLibraryPath = "/org/xerial/snappy/native/" + OSInfo.getNativeLibFolderPathForCurrentOS();
String tempFolder = new File(System.getProperty(KEY_SNAPPY_TEMPDIR, boolean hasNativeLib = hasResource(snappyNativeLibraryPath + "/" + snappyNativeLibraryName);
System.getProperty("java.io.tmpdir"))).getAbsolutePath(); if(!hasNativeLib) {
if(OSInfo.getOSName().equals("Mac")) {
// Extract and load a native library inside the jar file // Fix for openjdk7 for Mac
return extractLibraryFile(snappyNativeLibraryPath, snappyNativeLibraryName, tempFolder); 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. * 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 * This version data is used as a suffix of a dll file extracted from the