Skip to content

Commit 6a582ce

Browse files
committed
Merge pull request #5 from xerial/develop
Merge changes from upstream
2 parents f6ef8b3 + ed7b51c commit 6a582ce

39 files changed

+690
-423
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,6 @@ project/plugins/project/
2020

2121
# Scala-IDE specific
2222
.scala_dependencies
23+
atlassian-ide-plugin.xml
24+
2325

.travis.yml

+13-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
1-
language: java
2-
3-
install: mvn install -DskipTests=true -Dgpg.skip=true
4-
1+
language: scala
2+
scala:
3+
- 2.11.1
54
jdk:
6-
- oraclejdk7
5+
- openjdk6
76
- openjdk7
7+
- oraclejdk7
8+
9+
branches:
10+
only:
11+
- master
12+
- develop
13+
14+
script: ./sbt test
15+

Makefile

+15-17
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
include Makefile.common
33

44
MVN:=mvn
5+
SBT:=./sbt
56

67
all: snappy
78

@@ -50,19 +51,12 @@ $(SNAPPY_GIT_UNPACKED):
5051

5152
jni-header: $(SRC)/org/xerial/snappy/SnappyNative.h
5253

53-
$(TARGET)/classes/org/xerial/snappy/SnappyNative.class : $(SRC)/org/xerial/snappy/SnappyNative.java
54-
@mkdir -p $(TARGET)/classes
55-
$(JAVAC) -source 1.6 -target 1.6 -d $(TARGET)/classes -sourcepath $(SRC) $<
54+
$(TARGET)/jni-classes/org/xerial/snappy/SnappyNative.class : $(SRC)/org/xerial/snappy/SnappyNative.java
55+
@mkdir -p $(TARGET)/jni-classes
56+
$(JAVAC) -source 1.6 -target 1.6 -d $(TARGET)/jni-classes -sourcepath $(SRC) $<
5657

57-
$(SRC)/org/xerial/snappy/SnappyNative.h: $(TARGET)/classes/org/xerial/snappy/SnappyNative.class
58-
$(JAVAH) -classpath $(TARGET)/classes -o $@ org.xerial.snappy.SnappyNative
59-
60-
bytecode: src/main/resources/org/xerial/snappy/SnappyNativeLoader.bytecode
61-
62-
src/main/resources/org/xerial/snappy/SnappyNativeLoader.bytecode: src/main/resources/org/xerial/snappy/SnappyNativeLoader.java
63-
@mkdir -p $(TARGET)/temp
64-
$(JAVAC) -source 1.5 -target 1.5 -d $(TARGET)/temp $<
65-
cp $(TARGET)/temp/org/xerial/snappy/SnappyNativeLoader.class $@
58+
$(SRC)/org/xerial/snappy/SnappyNative.h: $(TARGET)/jni-classes/org/xerial/snappy/SnappyNative.class
59+
$(JAVAH) -force -classpath $(TARGET)/classes -o $@ org.xerial.snappy.SnappyNative
6660

6761
ifndef USE_GIT
6862
$(SNAPPY_SRC): $(SNAPPY_UNPACKED)
@@ -93,7 +87,7 @@ NATIVE_DIR:=src/main/resources/org/xerial/snappy/native/$(OS_NAME)/$(OS_ARCH)
9387
NATIVE_TARGET_DIR:=$(TARGET)/classes/org/xerial/snappy/native/$(OS_NAME)/$(OS_ARCH)
9488
NATIVE_DLL:=$(NATIVE_DIR)/$(LIBNAME)
9589

96-
snappy-jar-version:=snappy-java-$(shell $(JAVA) -jar lib/silk-weaver.jar find 'project(artifactId, version)' pom.xml | grep snappy-java | awk '{ print $$2; }')
90+
snappy-jar-version:=snappy-java-$(shell perl -npe "s/version in ThisBuild\s+:=\s+\"(.*)\"/\1/" version.sbt | sed -e "/^$$/d")
9791

9892
ifndef USE_GIT
9993
native: $(SNAPPY_UNPACKED) $(NATIVE_DLL)
@@ -109,11 +103,13 @@ $(NATIVE_DLL): $(SNAPPY_OUT)/$(LIBNAME)
109103
cp $< $(NATIVE_TARGET_DIR)/$(LIBNAME)
110104

111105

112-
$(TARGET)/$(snappy-jar-version).jar: native $(NATIVE_DLL)
113-
$(MVN) package -Dmaven.test.skip=true
106+
package: $(TARGET)/$(snappy-jar-version).jar
107+
108+
$(TARGET)/$(snappy-jar-version).jar:
109+
$(SBT) package
114110

115111
test: $(NATIVE_DLL)
116-
$(MVN) test
112+
$(SBT) test
117113

118114
win32:
119115
$(MAKE) native CROSS_PREFIX=i686-w64-mingw32- OS_NAME=Windows OS_ARCH=x86
@@ -146,8 +142,10 @@ clean-native-win32:
146142
$(MAKE) clean-native OS_NAME=Windows OS_ARCH=x86
147143

148144
javadoc:
149-
$(MVN) javadoc:javadoc -DreportOutputDirectory=wiki/apidocs
145+
$(SBT) doc
150146

147+
install-m2:
148+
$(SBT) publishM2
151149

152150
googlecode-upload: googlecode-lib-upload googlecode-src-upload
153151

Makefile.common

+1-1
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ Mac-x86_SNAPPY_FLAGS :=
153153
Mac-x86_64_CXX := g++ -arch $(OS_ARCH)
154154
Mac-x86_64_STRIP := strip -x
155155
Mac-x86_64_CXXFLAGS := -Ilib/inc_mac -I$(JAVA_HOME)/include -O2 -fPIC -mmacosx-version-min=10.5 -fvisibility=hidden
156-
Mac-x86_64_LINKFLAGS := -dynamiclib -static-libgcc
156+
Mac-x86_64_LINKFLAGS := -dynamiclib
157157
Mac-x86_64_LIBNAME := libsnappyjava.jnilib
158158
Mac-x86_64_SNAPPY_FLAGS :=
159159

Milestone.md

+12-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,18 @@
44

55
Since vesion 1.1.0.x, Java 6 (1.6) or higher is required.
66

7-
## snappy-java-1.1.1 (not yet)
8-
* Upgrade native snappy version
7+
## snappy-java-1.1.1 (4 July 2014)
8+
* Added Snappy framing format support: SnappyFramedInput/OutputStream
9+
* Added native libraries for PowerPC, IBM-AIX 6.4, SunOS.
10+
11+
# snappy-java-1.1.1-M4 (4 July 2014)
12+
* Add linux-x86_64 native library, embedding libstdc++
13+
* IBM AIX 6.1 support
14+
* A fix for loading in OSGi in Mac OS X (#76)
15+
16+
# snappy-java-1.1.1-M3 (26 June 2014)
17+
* Add PowerPC support (ppc64, ppc64le)
18+
* Building with sbt
919

1020
# snappy-java-1.0.5.2 (25 June 2014)
1121
* Maintanance release

README.md

+34-4
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,12 @@ Add the following dependency to your pom.xml:
8181
<scope>compile</scope>
8282
</dependency>
8383

84+
### Using with sbt
85+
86+
```
87+
libraryDependencies += "org.xerial.snappy" % "snappy-java" % "(version)"
88+
```
89+
8490

8591
## Public discussion group
8692
Post bug reports or feature request to the Issue Tracker: <https://github.com/xerial/snappy-java/issues>
@@ -89,7 +95,7 @@ Public discussion forum is here: <http://groups.google.com/group/xerial?hl=en Xe
8995

9096

9197
## Building from the source code
92-
See the [installation instruction](https://github.com/xerial/snappy-java/blob/develop/INSTALL). Building from the source code is an option when your OS platform and CPU architecture is not supported. To build snappy-java, you need Git, JDK (1.6 or higher), Maven (3.x or higher is required), g++ compiler (mingw in Windows) etc.
98+
See the [installation instruction](https://github.com/xerial/snappy-java/blob/develop/INSTALL). Building from the source code is an option when your OS platform and CPU architecture is not supported. To build snappy-java, you need Git, JDK (1.6 or higher), g++ compiler (mingw in Windows) etc.
9399

94100
$ git clone https://github.com/xerial/snappy-java.git
95101
$ cd snappy-java
@@ -101,11 +107,23 @@ When building on Solaris use
101107

102108
A file `target/snappy-java-$(version).jar` is the product additionally containing the native library built for your platform.
103109

104-
## Building linux amd64 binary
110+
## Building linux x86_64 binary
105111

106-
snappy-java tries to static link libstdc++ to increase the availability for various Linux versions. However, standard distributions of 64-bit Linux OS rarely provide libstdc++ compiled with `-fPIC` option. I currently uses custom g++ compiled with the following options:
112+
snappy-java tries to static link libstdc++ to increase the availability for various Linux versions. However, standard distributions of 64-bit Linux OS rarely provide libstdc++ compiled with `-fPIC` option. I currently uses custom g++, compiled as follows:
107113

108-
$ ./configure --prefix=$HOME/local --with-gmp=$HOME/local --with-mpfr=$HOME/local --with-mpc=$HOME/local --with-ppl=$HOME/local --with-cloog=$HOME/local CXXFLAGS=-fPIC CFLAGS=-fPIC
114+
```
115+
$ cd work
116+
$ wget (gcc-4.8.3 source)
117+
$ tar xvfz (gcc-4.8.3.tar.gz)
118+
$ cd gcc-4.8.3
119+
$ ./contrib/download_prerequisites
120+
$ cd ..
121+
$ mkdir objdir
122+
$ cd objdir
123+
$ ../gcc-4.8.3/configure --prefix=$HOME/local/gcc-4.8.3 CXXFLAGS=-fPIC CFLAGS=-fPIC --enable-languages=c,c++
124+
$ make
125+
$ make install
126+
```
109127

110128
This g++ build enables static linking of libstdc++. For more infomation on building GCC, see GCC's home page.
111129

@@ -130,6 +148,18 @@ If you are using Mac and openjdk7 (or higher), use the following option:
130148

131149
$ make native LIBNAME=libsnappyjava.dylib
132150

151+
## For developers
152+
153+
snappy-java uses sbt (simple build tool for Scala) as a build tool. Here is a simple usage
154+
155+
$ ./sbt # enter sbt console
156+
> ~test # run tests upon source code change
157+
> ~test-only * # run tests that matches a given name pattern
158+
> publishM2 # publish jar to $HOME/.m2/repository
159+
> package # create jar file
160+
161+
For the details of sbt usage, see my blog post: [Building Java Projects with sbt](http://xerial.org/blog/2014/03/24/sbt/)
162+
133163
## Miscellaneous Notes
134164
### Using snappy-java with Tomcat 6 (or higher) Web Server
135165

build.sbt

+102
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
import SonatypeKeys._
2+
3+
sonatypeSettings
4+
5+
name := "snappy-java"
6+
7+
organization := "org.xerial.snappy"
8+
9+
organizationName := "xerial.org"
10+
11+
description := "snappy-java: A fast compression/decompression library"
12+
13+
profileName := "org.xerial"
14+
15+
pomExtra := {
16+
<url>https://github.comm/xerial/snappy-java</url>
17+
<licenses>
18+
<license>
19+
<name>The Apache Software License, Version 2.0</name>
20+
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
21+
<distribution>repo</distribution>
22+
</license>
23+
</licenses>
24+
<developers>
25+
<developer>
26+
<id>leo</id>
27+
<name>Taro L. Saito</name>
28+
<email>leo@xerial.org</email>
29+
<organization>Xerial Project</organization>
30+
<roles>
31+
<role>Architect</role>
32+
<role>Project Manager</role>
33+
<role>Chief Developer</role>
34+
</roles>
35+
<timezone>+9</timezone>
36+
</developer>
37+
</developers>
38+
<issueManagement>
39+
<system>GitHub</system>
40+
<url>http://github.com/xerial/snappy-java/issues/list</url>
41+
</issueManagement>
42+
<inceptionYear>2011</inceptionYear>
43+
<scm>
44+
<connection>scm:git@github.com:xerial/snappy-java.git</connection>
45+
<developerConnection>scm:git:git@github.com:xerial/snappy-java.git</developerConnection>
46+
<url>git@github.com:xerial/snappy-java.git</url>
47+
</scm>
48+
}
49+
50+
javacOptions in (Compile, compile) ++= Seq("-encoding", "UTF-8", "-Xlint:unchecked", "-Xlint:deprecation", "-source", "1.6", "-target", "1.6")
51+
52+
testOptions += Tests.Argument(TestFrameworks.JUnit, "-q", "-v")
53+
54+
//concurrentRestrictions in Global := Seq(Tags.limit(Tags.Test, 1))
55+
56+
autoScalaLibrary := false
57+
58+
crossPaths := false
59+
60+
logBuffered in Test := false
61+
62+
incOptions := incOptions.value.withNameHashing(true)
63+
64+
libraryDependencies ++= Seq(
65+
"junit" % "junit" % "4.8.2" % "test",
66+
"org.codehaus.plexus" % "plexus-classworlds" % "2.4" % "test",
67+
"org.xerial" % "xerial-core" % "1.0.21" % "test",
68+
"org.osgi" % "org.osgi.core" % "4.3.0" % "provided",
69+
"com.novocode" % "junit-interface" % "0.10" % "test"
70+
)
71+
72+
osgiSettings
73+
74+
75+
OsgiKeys.exportPackage := Seq("org.xerial.snappy")
76+
77+
OsgiKeys.bundleSymbolicName := "org.xerial.snappy.snappy-java"
78+
79+
OsgiKeys.bundleActivator := Option("org.xerial.snappy.SnappyBundleActivator")
80+
81+
OsgiKeys.importPackage := Seq("""org.osgi.framework;version="[1.5,2)"""")
82+
83+
OsgiKeys.additionalHeaders := Map(
84+
"Bundle-NativeCode" -> Seq(
85+
"org/xerial/snappy/native/Windows/x86_64/snappyjava.dll;osname=win32;processor=x86-64",
86+
"org/xerial/snappy/native/Windows/x86/snappyjava.dll;osname=win32;processor=x86",
87+
"org/xerial/snappy/native/Mac/x86/libsnappyjava.jnilib;osname=macosx;processor=x86",
88+
"org/xerial/snappy/native/Mac/x86_64/libsnappyjava.jnilib;osname=macosx;processor=x86-64",
89+
"org/xerial/snappy/native/Linux/x86_64/libsnappyjava.so;osname=linux;processor=x86-64",
90+
"org/xerial/snappy/native/Linux/x86/libsnappyjava.so;osname=linux;processor=x86",
91+
"org/xerial/snappy/native/Linux/arm/libsnappyjava.so;osname=linux;processor=arm",
92+
"org/xerial/snappy/native/Linux/ppc64/libsnappyjava.so;osname=linux;processor=ppc64",
93+
"org/xerial/snappy/native/Linux/ppc64le/libsnappyjava.so;osname=linux;processor=ppc64le",
94+
"org/xerial/snappy/native/SunOS/x86/libsnappyjava.so;osname=sunos;processor=x86",
95+
"org/xerial/snappy/native/SunOS/x86_64/libsnappyjava.so;osname=sunos;processor=x86-64",
96+
"org/xerial/snappy/native/SunOS/sparc/libsnappyjava.so;osname=sunos;processor=sparc"
97+
).mkString(","),
98+
"Bundle-DocURL" -> "http://www.xerial.org/",
99+
"Bundle-License" -> "http://www.apache.org/licenses/LICENSE-2.0.txt",
100+
"Bundle-ActivationPolicy" -> "lazy",
101+
"Bundle-Name" -> "snappy-java: A fast compression/decompression library"
102+
)

lib/silk-weaver.jar

-3.48 MB
Binary file not shown.

0 commit comments

Comments
 (0)