diff --git a/.travis.yml b/.travis.yml
index c14f1061..9f829acc 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,6 +1,9 @@
language: scala
+
+sudo: false
+
scala:
- - 2.11.1
+ - 2.11.7
jdk:
- openjdk6
- openjdk7
diff --git a/Makefile b/Makefile
index 2d639450..d2b06c81 100644
--- a/Makefile
+++ b/Makefile
@@ -35,7 +35,7 @@ endif
$(SNAPPY_ARCHIVE):
@mkdir -p $(@D)
- curl -o$@ http://snappy.googlecode.com/files/snappy-$(VERSION).tar.gz
+ curl -L -o$@ https://github.com/google/snappy/releases/download/$(VERSION)/snappy-$(VERSION).tar.gz
$(SNAPPY_UNPACKED): $(SNAPPY_ARCHIVE)
$(TAR) xvfz $< -C $(TARGET)
@@ -47,7 +47,7 @@ $(SNAPPY_GIT_UNPACKED):
git clone $(GIT_REPO_URL) $(SNAPPY_SRC_DIR)
git --git-dir=$(SNAPPY_SRC_DIR)/.git --work-tree=$(SNAPPY_SRC_DIR) checkout -b local/snappy-$(GIT_SNAPPY_BRANCH) $(GIT_SNAPPY_BRANCH)
touch $@
- cd $(SNAPPY_SRC_DIR) && ./configure
+ cd $(SNAPPY_SRC_DIR) && ./autogen.sh && ./configure
jni-header: $(SRC)/org/xerial/snappy/SnappyNative.h
diff --git a/Makefile.common b/Makefile.common
index cdc339e0..e152b68f 100755
--- a/Makefile.common
+++ b/Makefile.common
@@ -42,7 +42,7 @@ endif
# os=Default is meant to be generic unix/linux
-known_os_archs := Linux-x86 Linux-x86_64 Linux-arm Linux-armhf Linux-ppc Linux-ppc64 Mac-x86 Mac-x86_64 FreeBSD-x86_64 Windows-x86 Windows-x86_64 SunOS-x86 SunOS-sparc SunOS-x86_64 AIX-ppc64
+known_os_archs := Linux-x86 Linux-x86_64 Linux-arm Linux-armhf Linux-ppc Linux-ppc64 Linux-s390 Linux-s390x Mac-x86 Mac-x86_64 FreeBSD-x86_64 Windows-x86 Windows-x86_64 SunOS-x86 SunOS-sparc SunOS-x86_64 AIX-ppc AIX-ppc64
os_arch := $(OS_NAME)-$(OS_ARCH)
IBM_JDK_7 := $(findstring IBM, $(shell $(JAVA) -version 2>&1 | grep IBM | grep "JRE 1.7"))
@@ -116,6 +116,17 @@ Linux-ppc64_LINKFLAGS := -shared -static-libgcc -static-libstdc++
Linux-ppc64_LIBNAME := libsnappyjava.so
Linux-ppc64_SNAPPY_FLAGS :=
+AIX-ppc_CXX := g++
+AIX-ppc_STRIP := strip
+AIX-ppc_LIBNAME := libsnappyjava.a
+ifeq ($(IBM_JDK_7),)
+ AIX-ppc_CXXFLAGS := -DHAVE_CONFIG_H -Ilib/inc_linux -I$(JAVA_HOME)/include -Ilib/inc_mac -O2 -fPIC -fvisibility=hidden
+else
+ AIX-ppc_CXXFLAGS := -DHAVE_CONFIG_H -I$(JAVA_HOME)/include/aix -Ilib/inc_ibm -I$(JAVA_HOME)/include -Ilib/inc_mac -O2 -fPIC -maix32
+endif
+AIX-ppc_LINKFLAGS := -shared -static-libgcc -static-libstdc++ -lcrypt
+AIX-ppc_SNAPPY_FLAGS :=
+
AIX-ppc64_CXX := g++
AIX-ppc64_STRIP := strip -X64
AIX-ppc64_LIBNAME := libsnappyjava.a
@@ -127,6 +138,28 @@ endif
AIX-ppc64_LINKFLAGS := -shared -static-libgcc -static-libstdc++ -lcrypt
AIX-ppc64_SNAPPY_FLAGS :=
+Linux-s390_CXX := g++
+Linux-s390_STRIP := strip
+ifeq ($(IBM_JDK_7),)
+ Linux-s390_CXXFLAGS := -DHAVE_CONFIG_H -Ilib/inc_linux -I$(JAVA_HOME)/include -Ilib/inc_mac -O2 -fPIC -fvisibility=hidden -m31
+else
+ Linux-s390_CXXFLAGS := -DHAVE_CONFIG_H -I$(JAVA_HOME)/include/linux -Ilib/inc_ibm -I$(JAVA_HOME)/include -Ilib/inc_mac -O2 -fPIC -m31
+endif
+Linux-s390_LINKFLAGS := -shared -static-libgcc -static-libstdc++
+Linux-s390_LIBNAME := libsnappyjava.so
+Linux-s390_SNAPPY_FLAGS :=
+
+Linux-s390x_CXX := g++
+Linux-s390x_STRIP := strip
+ifeq ($(IBM_JDK_7),)
+ Linux-s390x_CXXFLAGS := -DHAVE_CONFIG_H -Ilib/inc_linux -I$(JAVA_HOME)/include -Ilib/inc_mac -O2 -fPIC -fvisibility=hidden -m64
+else
+ Linux-s390x_CXXFLAGS := -DHAVE_CONFIG_H -I$(JAVA_HOME)/include/linux -Ilib/inc_ibm -I$(JAVA_HOME)/include -Ilib/inc_mac -O2 -fPIC -m64
+endif
+Linux-s390x_LINKFLAGS := -shared -static-libgcc -static-libstdc++
+Linux-s390x_LIBNAME := libsnappyjava.so
+Linux-s390x_SNAPPY_FLAGS :=
+
SunOS-x86_CXX := g++
SunOS-x86_STRIP := strip
SunOS-x86_CXXFLAGS := -include lib/inc_linux/jni_md.h -I$(JAVA_HOME)/include -O2 -fPIC -fvisibility=hidden
diff --git a/Milestone.md b/Milestone.md
index 20b267ab..2a90d211 100644
--- a/Milestone.md
+++ b/Milestone.md
@@ -1,5 +1,14 @@
Since vesion 1.1.0.x, Java 6 (1.6) or higher is required.
+## snappy-java-1.1.2.1 (2016-01-22)
+ * Fixed #131
+
+## snappy-java-1.1.2 (22 September 2015)
+ * This is a backward compatible release for 1.1.x.
+ * Add AIX (32-bit) support.
+ * There is no upgrade for the native libraries of the other platforms.
+ * A major change since 1.1.1 is a support for reading concatenated results of SnappyOutputStream(s)
+
## snappy-java-1.1.2-RC2 (18 May 2015)
* Fix #107: SnappyOutputStream.close() is not idempotent
diff --git a/README.md b/README.md
index c5fb69de..89b40eca 100755
--- a/README.md
+++ b/README.md
@@ -1,31 +1,31 @@
The snappy-java is a Java port of the snappy
, a fast C++ compresser/decompresser developed by Google.
-## Features
+## Features
* Fast compression/decompression around 200~400MB/sec.
- * Less memory usage. SnappyOutputStream uses only 32KB+ in default.
+ * Less memory usage. SnappyOutputStream uses only 32KB+ in default.
* JNI-based implementation to achieve comparable performance to the native C++ version.
* Although snappy-java uses JNI, it can be used safely with multiple class loaders (e.g. Tomcat, etc.).
* Compression/decompression of Java primitive arrays (`float[]`, `double[]`, `int[]`, `short[]`, `long[]`, etc.)
- * Portable across various operating systems; Snappy-java contains native libraries built for Window/Mac/Linux (64-bit). snappy-java loads one of these libraries according to your machine environment (It looks system properties, `os.name` and `os.arch`).
- * Simple usage. Add the snappy-java-(version).jar file to your classpath. Then call compression/decompression methods in `org.xerial.snappy.Snappy`.
- * [Framing-format support](http://snappy.googlecode.com/svn/trunk/framing_format.txt) (Since 1.1.0 version)
+ * Portable across various operating systems; Snappy-java contains native libraries built for Window/Mac/Linux (64-bit). snappy-java loads one of these libraries according to your machine environment (It looks system properties, `os.name` and `os.arch`).
+ * Simple usage. Add the snappy-java-(version).jar file to your classpath. Then call compression/decompression methods in `org.xerial.snappy.Snappy`.
+ * [Framing-format support](https://github.com/google/snappy/blob/master/framing_format.txt) (Since 1.1.0 version)
* OSGi support
* [Apache License Version 2.0](http://www.apache.org/licenses/LICENSE-2.0). Free for both commercial and non-commercial use.
-## Performance
+## Performance
* Snappy's main target is very high-speed compression/decompression with reasonable compression size. So the compression ratio of snappy-java is modest and about the same as `LZF` (ranging 20%-100% according to the dataset).
* Here are some [benchmark results](https://github.com/ning/jvm-compressor-benchmark/wiki), comparing
snappy-java and the other compressors
- `LZO-java`/`LZF`/`QuickLZ`/`Gzip`/`Bzip2`. Thanks [Tatu Saloranta @cotowncoder](http://twitter.com/#!/cowtowncoder) for providing the benchmark suite.
+ `LZO-java`/`LZF`/`QuickLZ`/`Gzip`/`Bzip2`. Thanks [Tatu Saloranta @cotowncoder](http://twitter.com/#!/cowtowncoder) for providing the benchmark suite.
* The benchmark result indicates snappy-java is the fastest compreesor/decompressor in Java: http://ning.github.com/jvm-compressor-benchmark/results/canterbury-roundtrip-2011-07-28/index.html
* The decompression speed is twice as fast as the others: http://ning.github.com/jvm-compressor-benchmark/results/canterbury-uncompress-2011-07-28/index.html
-## Download
+## Download
- * [Release Notes](Milestone.md)
+ * [Release Notes](Milestone.md)
The current stable version is available from here:
* Release version: http://central.maven.org/maven2/org/xerial/snappy/snappy-java/
@@ -39,7 +39,7 @@ Add the following dependency to your pom.xml:
org.xerial.snappy
snappy-java
- 1.1.2-RC1
+ 1.1.2.1
jar
compile
@@ -47,11 +47,11 @@ Add the following dependency to your pom.xml:
### Using with sbt
```
-libraryDependencies += "org.xerial.snappy" % "snappy-java" % "1.1.2-RC1"
+libraryDependencies += "org.xerial.snappy" % "snappy-java" % "1.1.2.1"
```
-## Usage
+## Usage
First, import `org.xerial.snapy.Snappy` in your Java code:
```java
@@ -65,24 +65,24 @@ String input = "Hello snappy-java! Snappy-java is a JNI-based wrapper of "
+ "Snappy, a fast compresser/decompresser.";
byte[] compressed = Snappy.compress(input.getBytes("UTF-8"));
byte[] uncompressed = Snappy.uncompress(compressed);
-
+
String result = new String(uncompressed, "UTF-8");
System.out.println(result);
```
-In addition, high-level methods (`Snappy.compress(String)`, `Snappy.compress(float[] ..)` etc. ) and low-level ones (e.g. `Snappy.rawCompress(.. )`, `Snappy.rawUncompress(..)`, etc.), which minimize memory copies, can be used.
+In addition, high-level methods (`Snappy.compress(String)`, `Snappy.compress(float[] ..)` etc. ) and low-level ones (e.g. `Snappy.rawCompress(.. )`, `Snappy.rawUncompress(..)`, etc.), which minimize memory copies, can be used.
### Stream-based API
-Stream-based compressor/decompressor `SnappyOutputStream`/`SnappyInputStream` are also available for reading/writing large data sets. `SnappyFramedOutputStream`/`SnappyFramedInputStream` can be used for the [framing format](https://code.google.com/p/snappy/source/browse/trunk/framing_format.txt).
+Stream-based compressor/decompressor `SnappyOutputStream`/`SnappyInputStream` are also available for reading/writing large data sets. `SnappyFramedOutputStream`/`SnappyFramedInputStream` can be used for the [framing format](https://github.com/google/snappy/blob/master/framing_format.txt).
- * See also [Javadoc API](https://oss.sonatype.org/service/local/repositories/releases/archive/org/xerial/snappy/snappy-java/1.1.2-RC1/snappy-java-1.1.2-RC1-javadoc.jar/!/index.html)
+ * See also [Javadoc API](https://oss.sonatype.org/service/local/repositories/releases/archive/org/xerial/snappy/snappy-java/1.1.2.1/snappy-java-1.1.2.1-javadoc.jar/!/index.html)
#### Compatibility Notes
* `SnappyOutputStream` and `SnappyInputStream` use `[magic header:16 bytes]([block size:int32][compressed data:byte array])*` format. You can read the result of `Snappy.compress` with `SnappyInputStream`, but you cannot read the compressed data generated by `SnappyOutputStream` with `Snappy.uncompress`. Here is the compatibility matrix of data foramt:
| Write\Read | `Snappy.uncompress` | `SnappyInputStream` | `SnappyFramedInputStream` |
| --------------- |:-------------------:|:------------------:|:-----------------------:|
-| `Snappy.compress` | ok | ok | x |
+| `Snappy.compress` | ok | ok | x |
| `SnappyOutputStream` | x | ok | x |
| `SnappyFramedOutputStream` | x | x | ok |
@@ -90,7 +90,7 @@ Stream-based compressor/decompressor `SnappyOutputStream`/`SnappyInputStream` ar
If you have snappy-java-(VERSION).jar in the current directory, use `-classpath` option as follows:
$ javac -classpath ".;snappy-java-(VERSION).jar" Sample.java # in Windows
- or
+ or
$ javac -classpath ".:snappy-java-(VERSION).jar" Sample.java # in Mac or Linux
@@ -99,23 +99,23 @@ If you have snappy-java-(VERSION).jar in the current directory, use `-classpath`
## Public discussion group
Post bug reports or feature request to the Issue Tracker:
-Public discussion forum is here: [Xerial Public Discussion Group)[http://groups.google.com/group/xerial?hl=en]
+Public discussion forum is here: [Xerial Public Discussion Group](http://groups.google.com/group/xerial?hl=en)
-## Building from the source code
+## Building from the source code
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.
$ git clone https://github.com/xerial/snappy-java.git
$ cd snappy-java
$ make
-
+
When building on Solaris use
-
+
$ gmake
A file `target/snappy-java-$(version).jar` is the product additionally containing the native library built for your platform.
-## Building linux x86_64 binary
+## Building Linux x86\_64 binary
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:
@@ -135,6 +135,14 @@ $ make install
This g++ build enables static linking of libstdc++. For more infomation on building GCC, see GCC's home page.
+## Building Linux s390/s390x binaries
+
+Older snapshots of snappy contain a buggy config.h.in that does not work properly on some big-endian platforms like Linux on IBM z (s390/s390x). Building snappy-java on s390/s390x requires fetching the snappy source from GitHub, and processing the source with autoconf to obtain a usable config.h. On a RHEL s390x system, these steps produced a working 64-bit snappy-java build (the process should be similar for other distributions):
+
+ $ sudo yum install java-1.7.1-ibm-devel libstdc++-static-devel
+ $ export JAVA_HOME=/usr/lib/jvm/java-1.7.1-ibm-1.7.1.2.10-1jpp.3.el7_0.s390x
+ $ make USE_GIT=1 GIT_REPO_URL=https://github.com/google/snappy.git GIT_SNAPPY_BRANCH=master IBM_JDK_7=1
+
## Cross-compiling for other platforms
The Makefile contains rules for cross-compiling the native library for other platforms so that the snappy-java JAR can support multiple platforms. For example, to build the native libraries for x86 Linux, x86 and x86-64 Windows, and soft- and hard-float ARM:
@@ -179,7 +187,7 @@ For the details of sbt usage, see my blog post: [Building Java Projects with sbt
## Miscellaneous Notes
### Using snappy-java with Tomcat 6 (or higher) Web Server
-Simply put the snappy-java's jar to WEB-INF/lib folder of your web application. Usual JNI-library specific problem no longer exists since snappy-java version 1.0.3 or higher can be loaded by multiple class loaders.
+Simply put the snappy-java's jar to WEB-INF/lib folder of your web application. Usual JNI-library specific problem no longer exists since snappy-java version 1.0.3 or higher can be loaded by multiple class loaders.
----
Snappy-java is developed by [Taro L. Saito](http://www.xerial.org/leo). Twitter [@taroleo](http://twitter.com/#!/taroleo)
diff --git a/build.sbt b/build.sbt
index 3fc24f55..f00176fe 100644
--- a/build.sbt
+++ b/build.sbt
@@ -11,7 +11,7 @@ description := "snappy-java: A fast compression/decompression library"
sonatypeProfileName := "org.xerial"
pomExtra := {
- https://github.comm/xerial/snappy-java
+ https://github.com/xerial/snappy-java
The Apache Software License, Version 2.0
@@ -101,15 +101,21 @@ OsgiKeys.importPackage := Seq("""org.osgi.framework;version="[1.5,2)"""")
OsgiKeys.additionalHeaders := Map(
"Bundle-NativeCode" -> Seq(
"org/xerial/snappy/native/Windows/x86_64/snappyjava.dll;osname=win32;processor=x86-64",
+"org/xerial/snappy/native/Windows/x86_64/snappyjava.dll;osname=win32;processor=x64",
+"org/xerial/snappy/native/Windows/x86_64/snappyjava.dll;osname=win32;processor=amd64",
"org/xerial/snappy/native/Windows/x86/snappyjava.dll;osname=win32;processor=x86",
"org/xerial/snappy/native/Mac/x86/libsnappyjava.jnilib;osname=macosx;processor=x86",
"org/xerial/snappy/native/Mac/x86_64/libsnappyjava.jnilib;osname=macosx;processor=x86-64",
"org/xerial/snappy/native/Linux/x86_64/libsnappyjava.so;osname=linux;processor=x86-64",
+"org/xerial/snappy/native/Linux/x86_64/libsnappyjava.so;osname=linux;processor=x64",
+"org/xerial/snappy/native/Linux/x86_64/libsnappyjava.so;osname=linux;processor=amd64",
"org/xerial/snappy/native/Linux/x86/libsnappyjava.so;osname=linux;processor=x86",
"org/xerial/snappy/native/Linux/aarch64/libsnappyjava.so;osname=linux;processor=aarch64",
"org/xerial/snappy/native/Linux/arm/libsnappyjava.so;osname=linux;processor=arm",
"org/xerial/snappy/native/Linux/ppc64/libsnappyjava.so;osname=linux;processor=ppc64",
"org/xerial/snappy/native/Linux/ppc64le/libsnappyjava.so;osname=linux;processor=ppc64le",
+"org/xerial/snappy/native/Linux/s390x/libsnappyjava.so;osname=linux;processor=s390x",
+"org/xerial/snappy/native/AIX/ppc/libsnappyjava.a;osname=aix;processor=ppc",
"org/xerial/snappy/native/AIX/ppc64/libsnappyjava.a;osname=aix;processor=ppc64",
"org/xerial/snappy/native/SunOS/x86/libsnappyjava.so;osname=sunos;processor=x86",
"org/xerial/snappy/native/SunOS/x86_64/libsnappyjava.so;osname=sunos;processor=x86-64",
diff --git a/lib/inc_linux/jni.h b/lib/inc_linux/jni.h
index dc2c8f64..4b9b0d29 100644
--- a/lib/inc_linux/jni.h
+++ b/lib/inc_linux/jni.h
@@ -1,26 +1,26 @@
/*
- * Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
*
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
*
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
*
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
*/
/*
@@ -1951,9 +1951,10 @@ JNI_OnUnload(JavaVM *vm, void *reserved);
#define JNI_VERSION_1_2 0x00010002
#define JNI_VERSION_1_4 0x00010004
#define JNI_VERSION_1_6 0x00010006
+#define JNI_VERSION_1_8 0x00010008
#ifdef __cplusplus
} /* extern "C" */
#endif /* __cplusplus */
-#endif /* !_JAVASOFT_JNI_H_ */
+#endif /* !_JAVASOFT_JNI_H_ */
\ No newline at end of file
diff --git a/project/build.properties b/project/build.properties
index 07b0ebbc..02cb92b3 100755
--- a/project/build.properties
+++ b/project/build.properties
@@ -1,2 +1,2 @@
-sbt.version=0.13.8
+sbt.version=0.13.9
diff --git a/project/plugins.sbt b/project/plugins.sbt
index 6bc747d8..01d0a14f 100755
--- a/project/plugins.sbt
+++ b/project/plugins.sbt
@@ -1,7 +1,7 @@
addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.0")
-addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "0.5.0")
+addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "1.1")
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.0.0")
diff --git a/sbt b/sbt
index b84e29d0..b8531229 100755
--- a/sbt
+++ b/sbt
@@ -1,36 +1,25 @@
#!/usr/bin/env bash
#
# A more capable sbt runner, coincidentally also called sbt.
-# Author: Paul Phillips
+# Author: Paul Phillips
# todo - make this dynamic
declare -r sbt_release_version="0.13.8"
-declare -r sbt_unreleased_version="0.13.8-SNAPSHOT" # -sbt-dev doesn't work at present
+declare -r sbt_unreleased_version="0.13.9-M1"
declare -r buildProps="project/build.properties"
-declare sbt_jar sbt_dir sbt_create sbt_launch_dir
-declare scala_version java_home sbt_explicit_version
-declare verbose debug quiet noshare batch trace_level log_level
-declare sbt_saved_stty
-
-echoerr () { [[ -z "$quiet" ]] && echo "$@" >&2; }
-vlog () { [[ -n "$verbose$debug" ]] && echoerr "$@"; }
-dlog () { [[ -n "$debug" ]] && echoerr "$@"; }
-
-# we'd like these set before we get around to properly processing arguments
-for arg in "$@"; do
- case "$arg" in
- -q|-quiet) quiet=true ;;
- -d|-debug) debug=true ;;
- -v|-verbose) verbose=true ;;
- *) ;;
- esac
-done
+declare sbt_jar sbt_dir sbt_create sbt_version
+declare scala_version sbt_explicit_version
+declare verbose noshare batch trace_level log_level
+declare sbt_saved_stty debugUs
+
+echoerr () { echo >&2 "$@"; }
+vlog () { [[ -n "$verbose" ]] && echoerr "$@"; }
# spaces are possible, e.g. sbt.version = 0.13.0
build_props_sbt () {
[[ -r "$buildProps" ]] && \
- grep '^sbt\.version' "$buildProps" | tr '=' ' ' | awk '{ print $2; }'
+ grep '^sbt\.version' "$buildProps" | tr '=\r' ' ' | awk '{ print $2; }'
}
update_build_props_sbt () {
@@ -41,31 +30,24 @@ update_build_props_sbt () {
perl -pi -e "s/^sbt\.version\b.*\$/sbt.version=${ver}/" "$buildProps"
grep -q '^sbt.version[ =]' "$buildProps" || printf "\nsbt.version=%s\n" "$ver" >> "$buildProps"
- echoerr "!!!"
- echoerr "!!! Updated file $buildProps setting sbt.version to: $ver"
- echoerr "!!! Previous value was: $old"
- echoerr "!!!"
+ vlog "!!!"
+ vlog "!!! Updated file $buildProps setting sbt.version to: $ver"
+ vlog "!!! Previous value was: $old"
+ vlog "!!!"
}
}
-sbt_version () {
- if [[ -n "$sbt_explicit_version" ]]; then
- echo "$sbt_explicit_version"
- else
- local v="$(build_props_sbt)"
- if [[ -n "$v" ]]; then
- echo "$v"
- else
- echo "$sbt_release_version"
- fi
- fi
+set_sbt_version () {
+ sbt_version="${sbt_explicit_version:-$(build_props_sbt)}"
+ [[ -n "$sbt_version" ]] || sbt_version=$sbt_release_version
+ export sbt_version
}
# restore stty settings (echo in particular)
onSbtRunnerExit() {
[[ -n "$sbt_saved_stty" ]] || return
- dlog ""
- dlog "restoring stty: $sbt_saved_stty"
+ vlog ""
+ vlog "restoring stty: $sbt_saved_stty"
stty "$sbt_saved_stty"
unset sbt_saved_stty
}
@@ -73,7 +55,7 @@ onSbtRunnerExit() {
# save stty and trap exit, to ensure echo is reenabled if we are interrupted.
trap onSbtRunnerExit EXIT
sbt_saved_stty="$(stty -g 2>/dev/null)"
-dlog "Saved stty: $sbt_saved_stty"
+vlog "Saved stty: $sbt_saved_stty"
# this seems to cover the bases on OSX, and someone will
# have to tell me about the others.
@@ -119,12 +101,12 @@ init_default_option_file () {
declare -r cms_opts="-XX:+CMSClassUnloadingEnabled -XX:+UseConcMarkSweepGC"
declare -r jit_opts="-XX:ReservedCodeCacheSize=256m -XX:+TieredCompilation"
-declare -r default_jvm_opts="-ea -Dfile.encoding=UTF8 -Xms512m -Xmx1536m -Xss2m $jit_opts $cms_opts"
+declare -r default_jvm_opts_common="-Xms512m -Xmx1536m -Xss2m $jit_opts $cms_opts"
declare -r noshare_opts="-Dsbt.global.base=project/.sbtboot -Dsbt.boot.directory=project/.boot -Dsbt.ivy.home=project/.ivy"
declare -r latest_28="2.8.2"
declare -r latest_29="2.9.3"
declare -r latest_210="2.10.5"
-declare -r latest_211="2.11.6"
+declare -r latest_211="2.11.7"
declare -r script_path="$(get_script_path "$BASH_SOURCE")"
declare -r script_name="${script_path##*/}"
@@ -133,7 +115,7 @@ declare -r script_name="${script_path##*/}"
declare java_cmd="java"
declare sbt_opts_file="$(init_default_option_file SBT_OPTS .sbtopts)"
declare jvm_opts_file="$(init_default_option_file JVM_OPTS .jvmopts)"
-declare sbt_launch_repo="http://typesafe.artifactoryonline.com/typesafe/ivy-releases"
+declare sbt_launch_repo="http://repo.typesafe.com/typesafe/ivy-releases"
# pull -J and -D options to give to java.
declare -a residual_args
@@ -144,14 +126,79 @@ declare -a sbt_commands
# args to jvm/sbt via files or environment variables
declare -a extra_jvm_opts extra_sbt_opts
-# if set, use JAVA_HOME over java found in path
-[[ -e "$JAVA_HOME/bin/java" ]] && java_cmd="$JAVA_HOME/bin/java"
+addJava () {
+ vlog "[addJava] arg = '$1'"
+ java_args+=("$1")
+}
+addSbt () {
+ vlog "[addSbt] arg = '$1'"
+ sbt_commands+=("$1")
+}
+setThisBuild () {
+ vlog "[addBuild] args = '$@'"
+ local key="$1" && shift
+ addSbt "set $key in ThisBuild := $@"
+}
+addScalac () {
+ vlog "[addScalac] arg = '$1'"
+ scalac_args+=("$1")
+}
+addResidual () {
+ vlog "[residual] arg = '$1'"
+ residual_args+=("$1")
+}
+addResolver () {
+ addSbt "set resolvers += $1"
+}
+addDebugger () {
+ addJava "-Xdebug"
+ addJava "-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=$1"
+}
+setScalaVersion () {
+ [[ "$1" == *"-SNAPSHOT" ]] && addResolver 'Resolver.sonatypeRepo("snapshots")'
+ addSbt "++ $1"
+}
+setJavaHome () {
+ java_cmd="$1/bin/java"
+ setThisBuild javaHome "Some(file(\"$1\"))"
+ export JAVA_HOME="$1"
+ export JDK_HOME="$1"
+ export PATH="$JAVA_HOME/bin:$PATH"
+}
+setJavaHomeQuietly () {
+ addSbt warn
+ setJavaHome "$1"
+ addSbt info
+}
+
+# if set, use JDK_HOME/JAVA_HOME over java found in path
+if [[ -e "$JDK_HOME/lib/tools.jar" ]]; then
+ setJavaHomeQuietly "$JDK_HOME"
+elif [[ -e "$JAVA_HOME/bin/java" ]]; then
+ setJavaHomeQuietly "$JAVA_HOME"
+fi
# directory to store sbt launchers
declare sbt_launch_dir="$HOME/.sbt/launchers"
[[ -d "$sbt_launch_dir" ]] || mkdir -p "$sbt_launch_dir"
[[ -w "$sbt_launch_dir" ]] || sbt_launch_dir="$(mktemp -d -t sbt_extras_launchers.XXXXXX)"
+java_version () {
+ local version=$("$java_cmd" -version 2>&1 | grep -E -e '(java|openjdk) version' | awk '{ print $3 }' | tr -d \")
+ vlog "Detected Java version: $version"
+ echo "${version:2:1}"
+}
+
+# MaxPermSize critical on pre-8 jvms but incurs noisy warning on 8+
+default_jvm_opts () {
+ local v="$(java_version)"
+ if [[ $v -ge 8 ]]; then
+ echo "$default_jvm_opts_common"
+ else
+ echo "-XX:MaxPermSize=384m $default_jvm_opts_common"
+ fi
+}
+
build_props_scala () {
if [[ -r "$buildProps" ]]; then
versionLine="$(grep '^build.scala.versions' "$buildProps")"
@@ -162,22 +209,20 @@ build_props_scala () {
execRunner () {
# print the arguments one to a line, quoting any containing spaces
- [[ "$verbose" || "$debug" ]] && echo "# Executing command line:" && {
+ vlog "# Executing command line:" && {
for arg; do
if [[ -n "$arg" ]]; then
if printf "%s\n" "$arg" | grep -q ' '; then
- printf "\"%s\"\n" "$arg"
+ printf >&2 "\"%s\"\n" "$arg"
else
- printf "%s\n" "$arg"
+ printf >&2 "%s\n" "$arg"
fi
fi
done
- echo ""
+ vlog ""
}
- if [[ -n "$batch" ]]; then
- exec /dev/null; then
- curl --fail --silent "$url" --output "$jar"
+ curl --fail --silent --location "$url" --output "$jar"
elif which wget >/dev/null; then
wget --quiet -O "$jar" "$url"
fi
@@ -207,9 +252,8 @@ download_url () {
}
acquire_sbt_jar () {
- for_sbt_version="$(sbt_version)"
- sbt_url="$(jar_url "$for_sbt_version")"
- sbt_jar="$(jar_file "$for_sbt_version")"
+ sbt_url="$(jar_url "$sbt_version")"
+ sbt_jar="$(jar_file "$sbt_version")"
[[ -r "$sbt_jar" ]] || download_url "$sbt_url" "$sbt_jar"
}
@@ -218,11 +262,23 @@ usage () {
cat < display stack traces with a max of frames (default: -1, traces suppressed)
+ -debug-inc enable debugging log for the incremental compiler
-no-colors disable ANSI color codes
-sbt-create start sbt even if current directory contains no sbt project
-sbt-dir path to global settings/plugins directory (default: ~/.sbt/)
@@ -234,12 +290,12 @@ Usage: $script_name [options]
-batch Disable interactive mode
-prompt Set the sbt prompt; in expr, 's' is the State and 'e' is Extracted
- # sbt version (default: from $buildProps if present, else latest release)
- !!! The only way to accomplish this pre-0.12.0 if there is a build.properties file which
- !!! contains an sbt.version property is to update the file on disk. That's what this does.
+ # sbt version (default: sbt.version from $buildProps if present, otherwise $sbt_release_version)
+ -sbt-force-latest force the use of the latest release of sbt: $sbt_release_version
-sbt-version use the specified version of sbt (default: $sbt_release_version)
+ -sbt-dev use the latest pre-release version of sbt: $sbt_unreleased_version
-sbt-jar use the specified jar as the sbt launcher
- -sbt-launch-dir directory to hold sbt launchers (default: $sbt_launch_dir)
+ -sbt-launch-dir directory to hold sbt launchers (default: ~/.sbt/launchers)
-sbt-launch-repo repo url for downloading sbt launcher jar (default: $sbt_launch_repo)
# scala version (default: as chosen by sbt)
@@ -256,7 +312,7 @@ Usage: $script_name [options]
# passing options to the jvm - note it does NOT use JAVA_OPTS due to pollution
# The default set is used if JVM_OPTS is unset and no -jvm-opts file is found
- $default_jvm_opts
+ $(default_jvm_opts)
JVM_OPTS environment variable holding either the jvm args directly, or
the reference to a file containing jvm args if given path is prepended by '@' (e.g. '@/etc/jvmopts')
Note: "@"-file is overridden by local '.jvmopts' or '-jvm-opts' argument.
@@ -273,34 +329,6 @@ Usage: $script_name [options]
EOM
}
-addJava () {
- dlog "[addJava] arg = '$1'"
- java_args=( "${java_args[@]}" "$1" )
-}
-addSbt () {
- dlog "[addSbt] arg = '$1'"
- sbt_commands=( "${sbt_commands[@]}" "$1" )
-}
-addScalac () {
- dlog "[addScalac] arg = '$1'"
- scalac_args=( "${scalac_args[@]}" "$1" )
-}
-addResidual () {
- dlog "[residual] arg = '$1'"
- residual_args=( "${residual_args[@]}" "$1" )
-}
-addResolver () {
- addSbt "set resolvers += $1"
-}
-addDebugger () {
- addJava "-Xdebug"
- addJava "-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=$1"
-}
-setScalaVersion () {
- [[ "$1" == *"-SNAPSHOT" ]] && addResolver 'Resolver.sonatypeRepo("snapshots")'
- addSbt "++ $1"
-}
-
process_args ()
{
require_arg () {
@@ -314,45 +342,50 @@ process_args ()
}
while [[ $# -gt 0 ]]; do
case "$1" in
- -h|-help) usage; exit 1 ;;
- -v|-verbose) verbose=true && log_level=Info && shift ;;
- -d|-debug) debug=true && log_level=Debug && shift ;;
- -q|-quiet) quiet=true && log_level=Error && shift ;;
-
- -trace) require_arg integer "$1" "$2" && trace_level="$2" && shift 2 ;;
- -ivy) require_arg path "$1" "$2" && addJava "-Dsbt.ivy.home=$2" && shift 2 ;;
- -no-colors) addJava "-Dsbt.log.noformat=true" && shift ;;
- -no-share) noshare=true && shift ;;
- -sbt-boot) require_arg path "$1" "$2" && addJava "-Dsbt.boot.directory=$2" && shift 2 ;;
- -sbt-dir) require_arg path "$1" "$2" && sbt_dir="$2" && shift 2 ;;
- -debug-inc) addJava "-Dxsbt.inc.debug=true" && shift ;;
- -offline) addSbt "set offline := true" && shift ;;
- -jvm-debug) require_arg port "$1" "$2" && addDebugger "$2" && shift 2 ;;
- -batch) batch=true && shift ;;
- -prompt) require_arg "expr" "$1" "$2" && addSbt "set shellPrompt in ThisBuild := (s => { val e = Project.extract(s) ; $2 })" && shift 2 ;;
-
- -sbt-create) sbt_create=true && shift ;;
- -sbt-jar) require_arg path "$1" "$2" && sbt_jar="$2" && shift 2 ;;
- -sbt-version) require_arg version "$1" "$2" && sbt_explicit_version="$2" && shift 2 ;;
- -sbt-dev) sbt_explicit_version="$sbt_unreleased_version" && shift ;;
--sbt-launch-dir) require_arg path "$1" "$2" && sbt_launch_dir="$2" && shift 2 ;;
--sbt-launch-repo) require_arg path "$1" "$2" && sbt_launch_repo="$2" && shift 2 ;;
- -scala-version) require_arg version "$1" "$2" && setScalaVersion "$2" && shift 2 ;;
--binary-version) require_arg version "$1" "$2" && addSbt "set scalaBinaryVersion in ThisBuild := \"$2\"" && shift 2 ;;
- -scala-home) require_arg path "$1" "$2" && addSbt "set every scalaHome := Some(file(\"$2\"))" && shift 2 ;;
- -java-home) require_arg path "$1" "$2" && java_cmd="$2/bin/java" && shift 2 ;;
- -sbt-opts) require_arg path "$1" "$2" && sbt_opts_file="$2" && shift 2 ;;
- -jvm-opts) require_arg path "$1" "$2" && jvm_opts_file="$2" && shift 2 ;;
-
- -D*) addJava "$1" && shift ;;
- -J*) addJava "${1:2}" && shift ;;
- -S*) addScalac "${1:2}" && shift ;;
- -28) setScalaVersion "$latest_28" && shift ;;
- -29) setScalaVersion "$latest_29" && shift ;;
- -210) setScalaVersion "$latest_210" && shift ;;
- -211) setScalaVersion "$latest_211" && shift ;;
-
- *) addResidual "$1" && shift ;;
+ -h|-help) usage; exit 1 ;;
+ -v) verbose=true && shift ;;
+ -d) addSbt "--debug" && addSbt debug && shift ;;
+ -w) addSbt "--warn" && addSbt warn && shift ;;
+ -q) addSbt "--error" && addSbt error && shift ;;
+ -x) debugUs=true && shift ;;
+ -trace) require_arg integer "$1" "$2" && trace_level="$2" && shift 2 ;;
+ -ivy) require_arg path "$1" "$2" && addJava "-Dsbt.ivy.home=$2" && shift 2 ;;
+ -no-colors) addJava "-Dsbt.log.noformat=true" && shift ;;
+ -no-share) noshare=true && shift ;;
+ -sbt-boot) require_arg path "$1" "$2" && addJava "-Dsbt.boot.directory=$2" && shift 2 ;;
+ -sbt-dir) require_arg path "$1" "$2" && sbt_dir="$2" && shift 2 ;;
+ -debug-inc) addJava "-Dxsbt.inc.debug=true" && shift ;;
+ -offline) addSbt "set offline := true" && shift ;;
+ -jvm-debug) require_arg port "$1" "$2" && addDebugger "$2" && shift 2 ;;
+ -batch) batch=true && shift ;;
+ -prompt) require_arg "expr" "$1" "$2" && setThisBuild shellPrompt "(s => { val e = Project.extract(s) ; $2 })" && shift 2 ;;
+
+ -sbt-create) sbt_create=true && shift ;;
+ -sbt-jar) require_arg path "$1" "$2" && sbt_jar="$2" && shift 2 ;;
+ -sbt-version) require_arg version "$1" "$2" && sbt_explicit_version="$2" && shift 2 ;;
+ -sbt-force-latest) sbt_explicit_version="$sbt_release_version" && shift ;;
+ -sbt-dev) sbt_explicit_version="$sbt_unreleased_version" && shift ;;
+ -sbt-launch-dir) require_arg path "$1" "$2" && sbt_launch_dir="$2" && shift 2 ;;
+ -sbt-launch-repo) require_arg path "$1" "$2" && sbt_launch_repo="$2" && shift 2 ;;
+ -scala-version) require_arg version "$1" "$2" && setScalaVersion "$2" && shift 2 ;;
+ -binary-version) require_arg version "$1" "$2" && setThisBuild scalaBinaryVersion "\"$2\"" && shift 2 ;;
+ -scala-home) require_arg path "$1" "$2" && setThisBuild scalaHome "Some(file(\"$2\"))" && shift 2 ;;
+ -java-home) require_arg path "$1" "$2" && setJavaHome "$2" && shift 2 ;;
+ -sbt-opts) require_arg path "$1" "$2" && sbt_opts_file="$2" && shift 2 ;;
+ -jvm-opts) require_arg path "$1" "$2" && jvm_opts_file="$2" && shift 2 ;;
+
+ -D*) addJava "$1" && shift ;;
+ -J*) addJava "${1:2}" && shift ;;
+ -S*) addScalac "${1:2}" && shift ;;
+ -28) setScalaVersion "$latest_28" && shift ;;
+ -29) setScalaVersion "$latest_29" && shift ;;
+ -210) setScalaVersion "$latest_210" && shift ;;
+ -211) setScalaVersion "$latest_211" && shift ;;
+
+ --debug) addSbt debug && addResidual "$1" && shift ;;
+ --warn) addSbt warn && addResidual "$1" && shift ;;
+ --error) addSbt error && addResidual "$1" && shift ;;
+ *) addResidual "$1" && shift ;;
esac
done
}
@@ -379,21 +412,20 @@ else
vlog "No extra sbt options have been defined"
fi
-[[ -n "$extra_sbt_opts" ]] && process_args "${extra_sbt_opts[@]}"
+[[ -n "${extra_sbt_opts[*]}" ]] && process_args "${extra_sbt_opts[@]}"
# reset "$@" to the residual args
set -- "${residual_args[@]}"
argumentCount=$#
+# set sbt version
+set_sbt_version
+
# only exists in 0.12+
setTraceLevel() {
- case "$(sbt_version)" in
- "0.7."* | "0.10."* | "0.11."* )
- echoerr "Cannot set trace level in sbt version $(sbt_version)"
- ;;
- *)
- addSbt "set every traceLevel := $trace_level"
- ;;
+ case "$sbt_version" in
+ "0.7."* | "0.10."* | "0.11."* ) echoerr "Cannot set trace level in sbt version $sbt_version" ;;
+ *) setThisBuild traceLevel $trace_level ;;
esac
}
@@ -402,9 +434,9 @@ setTraceLevel() {
# Update build.properties on disk to set explicit version - sbt gives us no choice
[[ -n "$sbt_explicit_version" ]] && update_build_props_sbt "$sbt_explicit_version"
-vlog "Detected sbt version $(sbt_version)"
+vlog "Detected sbt version $sbt_version"
-[[ -n "$scala_version" ]] && echoerr "Overriding scala version to $scala_version"
+[[ -n "$scala_version" ]] && vlog "Overriding scala version to $scala_version"
# no args - alert them there's stuff in here
(( argumentCount > 0 )) || {
@@ -438,10 +470,10 @@ if [[ -n "$noshare" ]]; then
addJava "$opt"
done
else
- case "$(sbt_version)" in
+ case "$sbt_version" in
"0.7."* | "0.10."* | "0.11."* | "0.12."* )
[[ -n "$sbt_dir" ]] || {
- sbt_dir="$HOME/.sbt/$(sbt_version)"
+ sbt_dir="$HOME/.sbt/$sbt_version"
vlog "Using $sbt_dir as sbt dir, -sbt-dir to override."
}
;;
@@ -460,22 +492,52 @@ elif [[ -n "$JVM_OPTS" && ! ("$JVM_OPTS" =~ ^@.*) ]]; then
extra_jvm_opts=( $JVM_OPTS )
else
vlog "Using default jvm options"
- extra_jvm_opts=( $default_jvm_opts )
+ extra_jvm_opts=( $(default_jvm_opts) )
fi
# traceLevel is 0.12+
[[ -n "$trace_level" ]] && setTraceLevel
+main () {
+ execRunner "$java_cmd" \
+ "${extra_jvm_opts[@]}" \
+ "${java_args[@]}" \
+ -jar "$sbt_jar" \
+ "${sbt_commands[@]}" \
+ "${residual_args[@]}"
+}
-if [[ -n "$log_level" ]] && [[ "$log_level" != Info ]]; then
- sbt_commands=("set logLevel in Global := Level.$log_level" "${sbt_commands[@]}")
-fi
+# sbt inserts this string on certain lines when formatting is enabled:
+# val OverwriteLine = "\r\u001BM\u001B[2K"
+# ...in order not to spam the console with a million "Resolving" lines.
+# Unfortunately that makes it that much harder to work with when
+# we're not going to print those lines anyway. We strip that bit of
+# line noise, but leave the other codes to preserve color.
+mainFiltered () {
+ local ansiOverwrite='\r\x1BM\x1B[2K'
+ local excludeRegex=$(egrep -v '^#|^$' ~/.sbtignore | paste -sd'|' -)
+
+ echoLine () {
+ local line="$1"
+ local line1="$(echo "$line" | sed -r 's/\r\x1BM\x1B\[2K//g')" # This strips the OverwriteLine code.
+ local line2="$(echo "$line1" | sed -r 's/\x1B\[[0-9;]*[JKmsu]//g')" # This strips all codes - we test regexes against this.
+
+ if [[ $line2 =~ $excludeRegex ]]; then
+ [[ -n $debugUs ]] && echo "[X] $line1"
+ else
+ [[ -n $debugUs ]] && echo " $line1" || echo "$line1"
+ fi
+ }
+
+ echoLine "Starting sbt with output filtering enabled."
+ main | while read -r line; do echoLine "$line"; done
+}
+# Only filter if there's a filter file and we don't see a known interactive command.
+# Obviously this is super ad hoc but I don't know how to improve on it. Testing whether
+# stdin is a terminal is useless because most of my use cases for this filtering are
+# exactly when I'm at a terminal, running sbt non-interactively.
+shouldFilter () { [[ -f ~/.sbtignore ]] && ! egrep -q '\b(shell|console|consoleProject)\b' <<<"${residual_args[@]}"; }
# run sbt
-execRunner "$java_cmd" \
- "${extra_jvm_opts[@]}" \
- "${java_args[@]}" \
- -jar "$sbt_jar" \
- "${sbt_commands[@]}" \
- "${residual_args[@]}"
+if shouldFilter; then mainFiltered; else main; fi
diff --git a/src/main/java/org/xerial/snappy/OSInfo.java b/src/main/java/org/xerial/snappy/OSInfo.java
index cafb07c3..ff366fae 100755
--- a/src/main/java/org/xerial/snappy/OSInfo.java
+++ b/src/main/java/org/xerial/snappy/OSInfo.java
@@ -43,6 +43,8 @@ public class OSInfo
public static final String IA64 = "ia64";
public static final String PPC = "ppc";
public static final String PPC64 = "ppc64";
+ public static final String IBMZ = "s390";
+ public static final String IBMZ_64 = "s390x";
static {
// x86 mappings
@@ -80,6 +82,12 @@ public class OSInfo
archMapping.put("powerpc64", PPC64);
archMapping.put("power_pc64", PPC64);
archMapping.put("power_rs64", PPC64);
+
+ // IBM z mappings
+ archMapping.put(IBMZ, IBMZ);
+
+ // IBM z 64-bit mappings
+ archMapping.put(IBMZ_64, IBMZ_64);
}
public static void main(String[] args)
@@ -154,7 +162,6 @@ else if (osName.contains("Linux")) {
else if (osName.contains("AIX")) {
return "AIX";
}
-
else {
return osName.replaceAll("\\W", "");
}
diff --git a/src/main/java/org/xerial/snappy/Snappy.java b/src/main/java/org/xerial/snappy/Snappy.java
index f96a06e2..dc81f7c5 100755
--- a/src/main/java/org/xerial/snappy/Snappy.java
+++ b/src/main/java/org/xerial/snappy/Snappy.java
@@ -25,6 +25,7 @@
package org.xerial.snappy;
import java.io.IOException;
+import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.net.URL;
import java.nio.ByteBuffer;
@@ -282,19 +283,27 @@ public static byte[] compress(String s, Charset encoding)
*/
public static String getNativeLibraryVersion()
{
-
URL versionFile = SnappyLoader.class.getResource("/org/xerial/snappy/VERSION");
String version = "unknown";
try {
if (versionFile != null) {
- Properties versionData = new Properties();
- versionData.load(versionFile.openStream());
- version = versionData.getProperty("version", version);
- if (version.equals("unknown")) {
- version = versionData.getProperty("VERSION", version);
+ InputStream in = null;
+ try {
+ Properties versionData = new Properties();
+ in = versionFile.openStream();
+ versionData.load(in);
+ version = versionData.getProperty("version", version);
+ if (version.equals("unknown")) {
+ version = versionData.getProperty("VERSION", version);
+ }
+ version = version.trim().replaceAll("[^0-9\\.]", "");
+ }
+ finally {
+ if(in != null) {
+ in.close();
+ }
}
- version = version.trim().replaceAll("[^0-9\\.]", "");
}
}
catch (IOException e) {
diff --git a/src/main/resources/org/xerial/snappy/VERSION b/src/main/resources/org/xerial/snappy/VERSION
index 4efb1af9..5582f560 100755
--- a/src/main/resources/org/xerial/snappy/VERSION
+++ b/src/main/resources/org/xerial/snappy/VERSION
@@ -1 +1 @@
-VERSION=1.1.2
\ No newline at end of file
+VERSION=1.1.3
diff --git a/src/main/resources/org/xerial/snappy/native/AIX/ppc/libsnappyjava.a b/src/main/resources/org/xerial/snappy/native/AIX/ppc/libsnappyjava.a
new file mode 100755
index 00000000..a069b784
Binary files /dev/null and b/src/main/resources/org/xerial/snappy/native/AIX/ppc/libsnappyjava.a differ
diff --git a/src/main/resources/org/xerial/snappy/native/AIX/ppc64/libsnappyjava.a b/src/main/resources/org/xerial/snappy/native/AIX/ppc64/libsnappyjava.a
index 46f73b42..e861d602 100755
Binary files a/src/main/resources/org/xerial/snappy/native/AIX/ppc64/libsnappyjava.a and b/src/main/resources/org/xerial/snappy/native/AIX/ppc64/libsnappyjava.a differ
diff --git a/src/main/resources/org/xerial/snappy/native/Linux/s390x/libsnappyjava.so b/src/main/resources/org/xerial/snappy/native/Linux/s390x/libsnappyjava.so
new file mode 100755
index 00000000..10f1ccc9
Binary files /dev/null and b/src/main/resources/org/xerial/snappy/native/Linux/s390x/libsnappyjava.so differ
diff --git a/src/test/java/org/xerial/snappy/SnappyOutputStreamTest.java b/src/test/java/org/xerial/snappy/SnappyOutputStreamTest.java
index 2b8af348..df97fd32 100755
--- a/src/test/java/org/xerial/snappy/SnappyOutputStreamTest.java
+++ b/src/test/java/org/xerial/snappy/SnappyOutputStreamTest.java
@@ -31,6 +31,7 @@
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.lang.ref.WeakReference;
+import java.nio.ByteOrder;
import org.junit.Test;
import org.xerial.snappy.buffer.BufferAllocatorFactory;
@@ -164,7 +165,10 @@ public void batchingOfWritesShouldNotAffectCompressedDataSize()
byte[] expectedCompressedData = compressAsChunks(orig, Integer.MAX_VALUE);
// Hardcoding an expected compressed size here will catch regressions that lower the
// compression quality:
- assertEquals(91013, expectedCompressedData.length);
+ if (ByteOrder.nativeOrder() == ByteOrder.BIG_ENDIAN)
+ assertEquals(90943, expectedCompressedData.length);
+ else
+ assertEquals(91013, expectedCompressedData.length);
// The chunk size should not affect the size of the compressed output:
int[] chunkSizes = new int[] {1, 100, 1023, 1024, 10000};
for (int chunkSize : chunkSizes) {
diff --git a/version.sbt b/version.sbt
index 9e85fb56..76dcbae2 100644
--- a/version.sbt
+++ b/version.sbt
@@ -1 +1 @@
-version in ThisBuild := "1.1.2-RC3-SNAPSHOT"
\ No newline at end of file
+version in ThisBuild := "1.1.3-SNAPSHOT"