mirror of
https://github.com/xerial/snappy-java.git
synced 2025-04-08 19:35:08 +02:00
Merge pull request #185 from xerial/snappy-1.1.7
Upgrade to snappy 1.1.7
This commit is contained in:
commit
a5de996866
3
.scalafmt.conf
Normal file
3
.scalafmt.conf
Normal file
@ -0,0 +1,3 @@
|
||||
maxColumn = 180
|
||||
style = defaultWithAlign
|
||||
optIn.breaksInsideChains = true
|
@ -6,11 +6,9 @@ services:
|
||||
language: scala
|
||||
|
||||
scala:
|
||||
- 2.11.8
|
||||
- 2.12.4
|
||||
|
||||
jdk:
|
||||
- openjdk7
|
||||
- oraclejdk7
|
||||
- oraclejdk8
|
||||
|
||||
script:
|
||||
|
30
Makefile
30
Makefile
@ -12,10 +12,10 @@ SNAPPY_CC:=snappy-sinksource.cc snappy-stubs-internal.cc snappy.cc
|
||||
SNAPPY_SRC_DIR:=$(TARGET)/snappy-$(SNAPPY_VERSION)
|
||||
SNAPPY_SRC:=$(addprefix $(SNAPPY_SRC_DIR)/,$(SNAPPY_CC))
|
||||
SNAPPY_GIT_REPO_URL:=https://github.com/google/snappy
|
||||
SNAPPY_GIT_REV:=2d99bd14d471664758e4dfdf81b44f413a7353fd # 1.1.4
|
||||
SNAPPY_GIT_REV:=b02bfa754ebf27921d8da3bd2517eab445b84ff9 # 1.1.7
|
||||
SNAPPY_UNPACKED:=$(TARGET)/snappy-extracted.log
|
||||
SNAPPY_GIT_UNPACKED:=$(TARGET)/snappy-git-extracted.log
|
||||
SNAPPY_SOURCE_CONFIGURED:=$(TARGET)/snappy-configure.log
|
||||
SNAPPY_CMAKE_CACHE=$(SNAPPY_OUT)/CMakeCache.txt
|
||||
|
||||
BITSHUFFLE_ARCHIVE:=$(TARGET)/bitshuffle-$(BITSHUFFLE_VERSION).tar.gz
|
||||
BITSHUFFLE_C:=bitshuffle_core.c iochain.c
|
||||
@ -70,20 +70,23 @@ $(SNAPPY_ARCHIVE):
|
||||
$(SNAPPY_UNPACKED): $(SNAPPY_ARCHIVE)
|
||||
$(TAR) xvfz $< -C $(TARGET)
|
||||
touch $@
|
||||
cd $(SNAPPY_SRC_DIR) && ./configure
|
||||
|
||||
$(SNAPPY_GIT_UNPACKED):
|
||||
@mkdir -p $(SNAPPY_OUT)
|
||||
rm -rf $(SNAPPY_SRC_DIR)
|
||||
@mkdir -p $(SNAPPY_SRC_DIR)
|
||||
git clone $(SNAPPY_GIT_REPO_URL) $(SNAPPY_SRC_DIR)
|
||||
git --git-dir=$(SNAPPY_SRC_DIR)/.git --work-tree=$(SNAPPY_SRC_DIR) checkout -b local/snappy-$(SNAPPY_VERSION) $(SNAPPY_GIT_REV)
|
||||
touch $@
|
||||
|
||||
$(SNAPPY_SOURCE_CONFIGURED): $(SNAPPY_GIT_UNPACKED)
|
||||
cd $(SNAPPY_SRC_DIR) && ./autogen.sh && ./configure
|
||||
$(SNAPPY_CMAKE_CACHE): $(SNAPPY_GIT_UNPACKED)
|
||||
@mkdir -p $(SNAPPY_OUT)
|
||||
cd $(SNAPPY_OUT) && cmake $(SNAPPY_CMAKE_OPTS) -DCMAKE_CXX_COMPILER=$(CXX) ../../$(SNAPPY_SRC_DIR)
|
||||
touch $@
|
||||
|
||||
jni-header: $(SNAPPY_SOURCE_CONFIGURED) $(BITSHUFFLE_UNPACKED) $(SRC)/org/xerial/snappy/SnappyNative.h $(SRC)/org/xerial/snappy/BitShuffleNative.h
|
||||
jni-header: $(SNAPPY_GIT_UNPACKED) $(BITSHUFFLE_UNPACKED) $(SRC)/org/xerial/snappy/SnappyNative.h $(SRC)/org/xerial/snappy/BitShuffleNative.h
|
||||
|
||||
snappy-header: $(SNAPPY_CMAKE_CACHE)
|
||||
|
||||
$(TARGET)/jni-classes/org/xerial/snappy/SnappyNative.class: $(SRC)/org/xerial/snappy/SnappyNative.java
|
||||
@mkdir -p $(TARGET)/jni-classes
|
||||
@ -101,13 +104,18 @@ $(SRC)/org/xerial/snappy/BitShuffleNative.h: $(TARGET)/jni-classes/org/xerial/sn
|
||||
|
||||
$(SNAPPY_SRC): $(SNAPPY_GIT_UNPACKED)
|
||||
|
||||
# Need to use cmake generated header stub for Windows
|
||||
ifeq ($(OS_NAME),Windows)
|
||||
SNAPPY_CXX_OPTS:=-include$(SNAPPY_OUT)/snappy-stubs-public.h
|
||||
endif
|
||||
|
||||
$(SNAPPY_OUT)/%.o: $(SNAPPY_SRC_DIR)/%.cc
|
||||
@mkdir -p $(@D)
|
||||
$(CXX) $(CXXFLAGS) -c $< -o $@
|
||||
$(CXX) $(SNAPPY_CXX_OPTS) $(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 $@
|
||||
$(CXX) $(SNAPPY_CXX_OPTS) $(CXXFLAGS) -c $< -o $@
|
||||
|
||||
$(SNAPPY_OUT)/BitShuffleNative.o: $(SRC)/org/xerial/snappy/BitShuffleNative.cpp $(SRC)/org/xerial/snappy/BitShuffleNative.h
|
||||
@mkdir -p $(@D)
|
||||
@ -137,7 +145,7 @@ snappy: native $(TARGET)/$(snappy-jar-version).jar
|
||||
|
||||
native-all: win32 win64 mac64 native-arm linux32 linux64 linux-ppc64le linux-aarch64
|
||||
|
||||
$(NATIVE_DLL): $(SNAPPY_SOURCE_CONFIGURED) $(SNAPPY_OUT)/$(LIBNAME)
|
||||
$(NATIVE_DLL): $(SNAPPY_OUT)/$(LIBNAME)
|
||||
@mkdir -p $(@D)
|
||||
cp $(SNAPPY_OUT)/$(LIBNAME) $@
|
||||
@mkdir -p $(NATIVE_TARGET_DIR)
|
||||
@ -154,10 +162,10 @@ test: $(NATIVE_DLL)
|
||||
DOCKER_RUN_OPTS:=--rm
|
||||
|
||||
win32: jni-header
|
||||
./docker/dockcross-windows-x86 -a $(DOCKER_RUN_OPTS) bash -c 'make clean-native native CROSS_PREFIX=i686-w64-mingw32.static- OS_NAME=Windows OS_ARCH=x86'
|
||||
./docker/dockcross-windows-x86 -a $(DOCKER_RUN_OPTS) bash -c 'make clean-native snappy-header native CROSS_PREFIX=i686-w64-mingw32.static- OS_NAME=Windows OS_ARCH=x86 SNAPPY_CMAKE_OPTS="-DHAVE_SYS_UIO_H=0"'
|
||||
|
||||
win64: jni-header
|
||||
./docker/dockcross-windows-x64 -a $(DOCKER_RUN_OPTS) bash -c 'make clean-native native CROSS_PREFIX=x86_64-w64-mingw32.static- OS_NAME=Windows OS_ARCH=x86_64'
|
||||
./docker/dockcross-windows-x64 -a $(DOCKER_RUN_OPTS) bash -c 'make clean-native snappy-header native CROSS_PREFIX=x86_64-w64-mingw32.static- OS_NAME=Windows OS_ARCH=x86_64 SNAPPY_CMAKE_OPTS="-DHAVE_SYS_UIO_H=0"'
|
||||
|
||||
# deprecated
|
||||
mac32: jni-header
|
||||
|
130
build.sbt
130
build.sbt
@ -1,26 +1,27 @@
|
||||
import de.johoop.findbugs4sbt.ReportType
|
||||
|
||||
name := "snappy-java"
|
||||
|
||||
organization := "org.xerial.snappy"
|
||||
|
||||
organization := "org.xerial.snappy"
|
||||
organizationName := "xerial.org"
|
||||
|
||||
description := "snappy-java: A fast compression/decompression library"
|
||||
|
||||
description := "snappy-java: A fast compression/decompression library"
|
||||
sonatypeProfileName := "org.xerial"
|
||||
|
||||
credentials ++= {
|
||||
if(sys.env.contains("SONATYPE_USERNAME") && sys.env.contains("SONATYPE_PASSWORD")) {
|
||||
if (sys.env.contains("SONATYPE_USERNAME") && sys.env.contains("SONATYPE_PASSWORD")) {
|
||||
Seq(Credentials("Sonatype Nexus Repository Manager", "oss.sonatype.org", sys.env("SONATYPE_USERNAME"), sys.env("SONATYPE_PASSWORD")))
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
Seq.empty
|
||||
}
|
||||
}
|
||||
|
||||
publishTo := Some(
|
||||
if (isSnapshot.value) {
|
||||
Opts.resolver.sonatypeSnapshots
|
||||
} else {
|
||||
Opts.resolver.sonatypeStaging
|
||||
}
|
||||
)
|
||||
|
||||
pomExtra := {
|
||||
<url>https://github.com/xerial/snappy-java</url>
|
||||
<url>https://github.com/xerial/snappy-java</url>
|
||||
<licenses>
|
||||
<license>
|
||||
<name>The Apache Software License, Version 2.0</name>
|
||||
@ -54,92 +55,78 @@ pomExtra := {
|
||||
</scm>
|
||||
}
|
||||
|
||||
scalaVersion in ThisBuild := "2.11.8"
|
||||
scalaVersion in ThisBuild := "2.12.4"
|
||||
|
||||
javacOptions in (Compile, compile) ++= Seq("-encoding", "UTF-8", "-Xlint:unchecked", "-Xlint:deprecation", "-source", "1.7", "-target", "1.7")
|
||||
|
||||
javacOptions in doc := {
|
||||
val opts = Seq("-source", "1.6")
|
||||
if (scala.util.Properties.isJavaAtLeast("1.8"))
|
||||
opts ++ Seq("-Xdoclint:none")
|
||||
else
|
||||
opts
|
||||
val opts = Seq("-source", "1.6")
|
||||
if (scala.util.Properties.isJavaAtLeast("1.8"))
|
||||
opts ++ Seq("-Xdoclint:none")
|
||||
else
|
||||
opts
|
||||
}
|
||||
|
||||
testOptions += Tests.Argument(TestFrameworks.JUnit, "-q", "-v")
|
||||
|
||||
concurrentRestrictions in Global := Seq(Tags.limit(Tags.Test, 1))
|
||||
|
||||
autoScalaLibrary := false
|
||||
|
||||
crossPaths := false
|
||||
|
||||
logBuffered in Test := false
|
||||
|
||||
incOptions := incOptions.value.withNameHashing(true)
|
||||
|
||||
findbugsSettings
|
||||
|
||||
findbugsReportType := Some(ReportType.FancyHtml)
|
||||
|
||||
findbugsReportType := Some(FindbugsReport.FancyHtml)
|
||||
findbugsReportPath := Some(crossTarget.value / "findbugs" / "report.html")
|
||||
|
||||
jacoco.settings
|
||||
|
||||
libraryDependencies ++= Seq(
|
||||
"junit" % "junit" % "4.8.2" % "test",
|
||||
"org.codehaus.plexus" % "plexus-classworlds" % "2.4" % "test",
|
||||
"org.xerial.java" % "xerial-core" % "2.1" % "test",
|
||||
"org.xerial" % "xerial-core" % "3.2.3" % "test",
|
||||
"org.scalatest" % "scalatest_2.11" % "2.2.0" % "test",
|
||||
"org.osgi" % "org.osgi.core" % "4.3.0" % "provided",
|
||||
"com.novocode" % "junit-interface" % "0.10" % "test"
|
||||
"junit" % "junit" % "4.8.2" % "test",
|
||||
"org.codehaus.plexus" % "plexus-classworlds" % "2.4" % "test",
|
||||
"org.xerial.java" % "xerial-core" % "2.1" % "test",
|
||||
"org.wvlet.airframe" %% "airframe-log" % "0.25" % "test",
|
||||
"org.scalatest" %% "scalatest" % "3.0.4" % "test",
|
||||
"org.osgi" % "org.osgi.core" % "4.3.0" % "provided",
|
||||
"com.novocode" % "junit-interface" % "0.11" % "test"
|
||||
)
|
||||
|
||||
osgiSettings
|
||||
|
||||
enablePlugins(SbtOsgi)
|
||||
|
||||
OsgiKeys.exportPackage := Seq("org.xerial.snappy", "org.xerial.snappy.buffer")
|
||||
|
||||
OsgiKeys.bundleSymbolicName := "org.xerial.snappy.snappy-java"
|
||||
|
||||
OsgiKeys.bundleActivator := Option("org.xerial.snappy.SnappyBundleActivator")
|
||||
|
||||
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/arm7/libsnappyjava.so;osname=linux;processor=arm_le",
|
||||
"org/xerial/snappy/native/Linux/ppc64/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",
|
||||
"org/xerial/snappy/native/SunOS/sparc/libsnappyjava.so;osname=sunos;processor=sparc"
|
||||
).mkString(","),
|
||||
"Bundle-DocURL" -> "http://www.xerial.org/",
|
||||
"Bundle-License" -> "http://www.apache.org/licenses/LICENSE-2.0.txt",
|
||||
"Bundle-ActivationPolicy" -> "lazy",
|
||||
"Bundle-Name" -> "snappy-java: A fast compression/decompression library"
|
||||
"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/arm7/libsnappyjava.so;osname=linux;processor=arm_le",
|
||||
"org/xerial/snappy/native/Linux/ppc64/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",
|
||||
"org/xerial/snappy/native/SunOS/sparc/libsnappyjava.so;osname=sunos;processor=sparc"
|
||||
).mkString(","),
|
||||
"Bundle-DocURL" -> "http://www.xerial.org/",
|
||||
"Bundle-License" -> "http://www.apache.org/licenses/LICENSE-2.0.txt",
|
||||
"Bundle-ActivationPolicy" -> "lazy",
|
||||
"Bundle-Name" -> "snappy-java: A fast compression/decompression library"
|
||||
)
|
||||
|
||||
import ReleaseTransformations._
|
||||
import sbtrelease._
|
||||
|
||||
releaseTagName := { (version in ThisBuild).value }
|
||||
releasePublishArtifactsAction := PgpKeys.publishSigned.value
|
||||
|
||||
releaseProcess := Seq[ReleaseStep](
|
||||
checkSnapshotDependencies,
|
||||
@ -149,14 +136,9 @@ releaseProcess := Seq[ReleaseStep](
|
||||
setReleaseVersion,
|
||||
commitReleaseVersion,
|
||||
tagRelease,
|
||||
ReleaseStep(action = Command.process("publishSigned", _)),
|
||||
publishArtifacts,
|
||||
setNextVersion,
|
||||
commitNextVersion,
|
||||
ReleaseStep(action = Command.process("sonatypeReleaseAll", _)),
|
||||
releaseStepCommand("sonatypeReleaseAll"),
|
||||
pushChanges
|
||||
)
|
||||
|
||||
|
||||
com.etsy.sbt.Checkstyle.checkstyleSettings
|
||||
|
||||
com.etsy.sbt.Checkstyle.CheckstyleTasks.checkstyleConfig := file("src/checkstyle/checks.xml")
|
||||
|
@ -1,2 +1,2 @@
|
||||
sbt.version=0.13.13
|
||||
sbt.version=1.0.3
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.3")
|
||||
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "1.1")
|
||||
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.0.0")
|
||||
addSbtPlugin("de.johoop" % "findbugs4sbt" % "1.4.0")
|
||||
addSbtPlugin("de.johoop" % "jacoco4sbt" % "2.1.5")
|
||||
addSbtPlugin("com.typesafe.sbt" % "sbt-osgi" % "0.7.0")
|
||||
addSbtPlugin("com.etsy" % "sbt-checkstyle-plugin" % "0.4.3")
|
||||
addSbtPlugin("io.get-coursier" % "sbt-coursier" % "1.0.0-M15")
|
||||
addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.6")
|
||||
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "2.0")
|
||||
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.1.0")
|
||||
addSbtPlugin("com.github.sbt" % "sbt-findbugs" % "2.0.0")
|
||||
addSbtPlugin("com.github.sbt" % "sbt-jacoco" % "3.0.3")
|
||||
addSbtPlugin("com.typesafe.sbt" % "sbt-osgi" % "0.9.2")
|
||||
addSbtPlugin("io.get-coursier" % "sbt-coursier" % "1.0.0-RC13")
|
||||
addSbtPlugin("com.geirsson" % "sbt-scalafmt" % "1.3.0")
|
||||
|
363
sbt
363
sbt
@ -3,20 +3,95 @@
|
||||
# A more capable sbt runner, coincidentally also called sbt.
|
||||
# Author: Paul Phillips <paulp@improving.org>
|
||||
|
||||
# todo - make this dynamic
|
||||
declare -r sbt_release_version="0.13.8"
|
||||
declare -r sbt_unreleased_version="0.13.9-M1"
|
||||
set -o pipefail
|
||||
|
||||
declare -r sbt_release_version="0.13.16"
|
||||
declare -r sbt_unreleased_version="0.13.16"
|
||||
|
||||
declare -r latest_213="2.13.0-M2"
|
||||
declare -r latest_212="2.12.4"
|
||||
declare -r latest_211="2.11.11"
|
||||
declare -r latest_210="2.10.6"
|
||||
declare -r latest_29="2.9.3"
|
||||
declare -r latest_28="2.8.2"
|
||||
|
||||
declare -r buildProps="project/build.properties"
|
||||
|
||||
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
|
||||
declare -r sbt_launch_ivy_release_repo="http://repo.typesafe.com/typesafe/ivy-releases"
|
||||
declare -r sbt_launch_ivy_snapshot_repo="https://repo.scala-sbt.org/scalasbt/ivy-snapshots"
|
||||
declare -r sbt_launch_mvn_release_repo="http://repo.scala-sbt.org/scalasbt/maven-releases"
|
||||
declare -r sbt_launch_mvn_snapshot_repo="http://repo.scala-sbt.org/scalasbt/maven-snapshots"
|
||||
|
||||
declare -r default_jvm_opts_common="-Xms512m -Xmx1536m -Xss2m"
|
||||
declare -r noshare_opts="-Dsbt.global.base=project/.sbtboot -Dsbt.boot.directory=project/.boot -Dsbt.ivy.home=project/.ivy"
|
||||
|
||||
declare sbt_jar sbt_dir sbt_create sbt_version sbt_script sbt_new
|
||||
declare sbt_explicit_version
|
||||
declare verbose noshare batch trace_level
|
||||
declare debugUs
|
||||
|
||||
declare java_cmd="java"
|
||||
declare sbt_launch_dir="$HOME/.sbt/launchers"
|
||||
declare sbt_launch_repo
|
||||
|
||||
# pull -J and -D options to give to java.
|
||||
declare -a java_args scalac_args sbt_commands residual_args
|
||||
|
||||
# args to jvm/sbt via files or environment variables
|
||||
declare -a extra_jvm_opts extra_sbt_opts
|
||||
|
||||
echoerr () { echo >&2 "$@"; }
|
||||
vlog () { [[ -n "$verbose" ]] && echoerr "$@"; }
|
||||
die () { echo "Aborting: $@" ; exit 1; }
|
||||
|
||||
setTrapExit () {
|
||||
# save stty and trap exit, to ensure echo is re-enabled if we are interrupted.
|
||||
export SBT_STTY="$(stty -g 2>/dev/null)"
|
||||
|
||||
# restore stty settings (echo in particular)
|
||||
onSbtRunnerExit() {
|
||||
[ -t 0 ] || return
|
||||
vlog ""
|
||||
vlog "restoring stty: $SBT_STTY"
|
||||
stty "$SBT_STTY"
|
||||
}
|
||||
|
||||
vlog "saving stty: $SBT_STTY"
|
||||
trap onSbtRunnerExit EXIT
|
||||
}
|
||||
|
||||
# this seems to cover the bases on OSX, and someone will
|
||||
# have to tell me about the others.
|
||||
get_script_path () {
|
||||
local path="$1"
|
||||
[[ -L "$path" ]] || { echo "$path" ; return; }
|
||||
|
||||
local target="$(readlink "$path")"
|
||||
if [[ "${target:0:1}" == "/" ]]; then
|
||||
echo "$target"
|
||||
else
|
||||
echo "${path%/*}/$target"
|
||||
fi
|
||||
}
|
||||
|
||||
declare -r script_path="$(get_script_path "$BASH_SOURCE")"
|
||||
declare -r script_name="${script_path##*/}"
|
||||
|
||||
init_default_option_file () {
|
||||
local overriding_var="${!1}"
|
||||
local default_file="$2"
|
||||
if [[ ! -r "$default_file" && "$overriding_var" =~ ^@(.*)$ ]]; then
|
||||
local envvar_file="${BASH_REMATCH[1]}"
|
||||
if [[ -r "$envvar_file" ]]; then
|
||||
default_file="$envvar_file"
|
||||
fi
|
||||
fi
|
||||
echo "$default_file"
|
||||
}
|
||||
|
||||
declare sbt_opts_file="$(init_default_option_file SBT_OPTS .sbtopts)"
|
||||
declare jvm_opts_file="$(init_default_option_file JVM_OPTS .jvmopts)"
|
||||
|
||||
# spaces are possible, e.g. sbt.version = 0.13.0
|
||||
build_props_sbt () {
|
||||
[[ -r "$buildProps" ]] && \
|
||||
grep '^sbt\.version' "$buildProps" | tr '=\r' ' ' | awk '{ print $2; }'
|
||||
@ -43,153 +118,87 @@ set_sbt_version () {
|
||||
export sbt_version
|
||||
}
|
||||
|
||||
# restore stty settings (echo in particular)
|
||||
onSbtRunnerExit() {
|
||||
[[ -n "$sbt_saved_stty" ]] || return
|
||||
vlog ""
|
||||
vlog "restoring stty: $sbt_saved_stty"
|
||||
stty "$sbt_saved_stty"
|
||||
unset sbt_saved_stty
|
||||
}
|
||||
|
||||
# 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)"
|
||||
vlog "Saved stty: $sbt_saved_stty"
|
||||
|
||||
# this seems to cover the bases on OSX, and someone will
|
||||
# have to tell me about the others.
|
||||
get_script_path () {
|
||||
local path="$1"
|
||||
[[ -L "$path" ]] || { echo "$path" ; return; }
|
||||
|
||||
local target="$(readlink "$path")"
|
||||
if [[ "${target:0:1}" == "/" ]]; then
|
||||
echo "$target"
|
||||
else
|
||||
echo "${path%/*}/$target"
|
||||
fi
|
||||
}
|
||||
|
||||
die() {
|
||||
echo "Aborting: $@"
|
||||
exit 1
|
||||
}
|
||||
|
||||
make_url () {
|
||||
version="$1"
|
||||
url_base () {
|
||||
local version="$1"
|
||||
|
||||
case "$version" in
|
||||
0.7.*) echo "http://simple-build-tool.googlecode.com/files/sbt-launch-0.7.7.jar" ;;
|
||||
0.10.* ) echo "$sbt_launch_repo/org.scala-tools.sbt/sbt-launch/$version/sbt-launch.jar" ;;
|
||||
0.11.[12]) echo "$sbt_launch_repo/org.scala-tools.sbt/sbt-launch/$version/sbt-launch.jar" ;;
|
||||
*) echo "$sbt_launch_repo/org.scala-sbt/sbt-launch/$version/sbt-launch.jar" ;;
|
||||
0.7.*) echo "http://simple-build-tool.googlecode.com" ;;
|
||||
0.10.* ) echo "$sbt_launch_ivy_release_repo" ;;
|
||||
0.11.[12]) echo "$sbt_launch_ivy_release_repo" ;;
|
||||
0.*-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]-[0-9][0-9][0-9][0-9][0-9][0-9]) # ie "*-yyyymmdd-hhMMss"
|
||||
echo "$sbt_launch_ivy_snapshot_repo" ;;
|
||||
0.*) echo "$sbt_launch_ivy_release_repo" ;;
|
||||
*-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]-[0-9][0-9][0-9][0-9][0-9][0-9]) # ie "*-yyyymmdd-hhMMss"
|
||||
echo "$sbt_launch_mvn_snapshot_repo" ;;
|
||||
*) echo "$sbt_launch_mvn_release_repo" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
init_default_option_file () {
|
||||
local overriding_var="${!1}"
|
||||
local default_file="$2"
|
||||
if [[ ! -r "$default_file" && "$overriding_var" =~ ^@(.*)$ ]]; then
|
||||
local envvar_file="${BASH_REMATCH[1]}"
|
||||
if [[ -r "$envvar_file" ]]; then
|
||||
default_file="$envvar_file"
|
||||
fi
|
||||
fi
|
||||
echo "$default_file"
|
||||
make_url () {
|
||||
local version="$1"
|
||||
|
||||
local base="${sbt_launch_repo:-$(url_base "$version")}"
|
||||
|
||||
case "$version" in
|
||||
0.7.*) echo "$base/files/sbt-launch-0.7.7.jar" ;;
|
||||
0.10.* ) echo "$base/org.scala-tools.sbt/sbt-launch/$version/sbt-launch.jar" ;;
|
||||
0.11.[12]) echo "$base/org.scala-tools.sbt/sbt-launch/$version/sbt-launch.jar" ;;
|
||||
0.*) echo "$base/org.scala-sbt/sbt-launch/$version/sbt-launch.jar" ;;
|
||||
*) echo "$base/org/scala-sbt/sbt-launch/$version/sbt-launch.jar" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
declare -r cms_opts="-XX:+CMSClassUnloadingEnabled -XX:+UseConcMarkSweepGC"
|
||||
declare -r jit_opts="-XX:ReservedCodeCacheSize=256m -XX:+TieredCompilation"
|
||||
declare -r default_jvm_opts_common="-Xms512m -Xmx2048m -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.7"
|
||||
addJava () { vlog "[addJava] arg = '$1'" ; java_args+=("$1"); }
|
||||
addSbt () { vlog "[addSbt] arg = '$1'" ; sbt_commands+=("$1"); }
|
||||
addScalac () { vlog "[addScalac] arg = '$1'" ; scalac_args+=("$1"); }
|
||||
addResidual () { vlog "[residual] arg = '$1'" ; residual_args+=("$1"); }
|
||||
|
||||
declare -r script_path="$(get_script_path "$BASH_SOURCE")"
|
||||
declare -r script_name="${script_path##*/}"
|
||||
|
||||
# some non-read-onlies set with defaults
|
||||
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://repo.typesafe.com/typesafe/ivy-releases"
|
||||
|
||||
# pull -J and -D options to give to java.
|
||||
declare -a residual_args
|
||||
declare -a java_args
|
||||
declare -a scalac_args
|
||||
declare -a sbt_commands
|
||||
|
||||
# args to jvm/sbt via files or environment variables
|
||||
declare -a extra_jvm_opts extra_sbt_opts
|
||||
|
||||
addJava () {
|
||||
vlog "[addJava] arg = '$1'"
|
||||
java_args+=("$1")
|
||||
}
|
||||
addSbt () {
|
||||
vlog "[addSbt] arg = '$1'"
|
||||
sbt_commands+=("$1")
|
||||
}
|
||||
addResolver () { addSbt "set resolvers += $1"; }
|
||||
addDebugger () { addJava "-Xdebug" ; addJava "-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=$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\"))"
|
||||
setThisBuild javaHome "_root_.scala.Some(file(\"$1\"))"
|
||||
export JAVA_HOME="$1"
|
||||
export JDK_HOME="$1"
|
||||
export PATH="$JAVA_HOME/bin:$PATH"
|
||||
}
|
||||
setJavaHomeQuietly () {
|
||||
addSbt warn
|
||||
setJavaHome "$1"
|
||||
addSbt info
|
||||
|
||||
getJavaVersion() { "$1" -version 2>&1 | grep -E -e '(java|openjdk) version' | awk '{ print $3 }' | tr -d \"; }
|
||||
|
||||
checkJava() {
|
||||
# Warn if there is a Java version mismatch between PATH and JAVA_HOME/JDK_HOME
|
||||
|
||||
[[ -n "$JAVA_HOME" && -e "$JAVA_HOME/bin/java" ]] && java="$JAVA_HOME/bin/java"
|
||||
[[ -n "$JDK_HOME" && -e "$JDK_HOME/lib/tools.jar" ]] && java="$JDK_HOME/bin/java"
|
||||
|
||||
if [[ -n "$java" ]]; then
|
||||
pathJavaVersion=$(getJavaVersion java)
|
||||
homeJavaVersion=$(getJavaVersion "$java")
|
||||
if [[ "$pathJavaVersion" != "$homeJavaVersion" ]]; then
|
||||
echoerr "Warning: Java version mismatch between PATH and JAVA_HOME/JDK_HOME, sbt will use the one in PATH"
|
||||
echoerr " Either: fix your PATH, remove JAVA_HOME/JDK_HOME or use -java-home"
|
||||
echoerr " java version from PATH: $pathJavaVersion"
|
||||
echoerr " java version from JAVA_HOME/JDK_HOME: $homeJavaVersion"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# 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 \")
|
||||
local version=$(getJavaVersion "$java_cmd")
|
||||
vlog "Detected Java version: $version"
|
||||
echo "${version:2:1}"
|
||||
}
|
||||
|
||||
# MaxPermSize critical on pre-8 jvms but incurs noisy warning on 8+
|
||||
# MaxPermSize critical on pre-8 JVMs but incurs noisy warning on 8+
|
||||
default_jvm_opts () {
|
||||
local v="$(java_version)"
|
||||
if [[ $v -ge 8 ]]; then
|
||||
@ -222,16 +231,23 @@ execRunner () {
|
||||
vlog ""
|
||||
}
|
||||
|
||||
[[ -n "$batch" ]] && exec </dev/null
|
||||
exec "$@"
|
||||
setTrapExit
|
||||
|
||||
if [[ -n "$batch" ]]; then
|
||||
"$@" < /dev/null
|
||||
else
|
||||
"$@"
|
||||
fi
|
||||
}
|
||||
|
||||
jar_url () {
|
||||
make_url "$1"
|
||||
}
|
||||
jar_url () { make_url "$1"; }
|
||||
|
||||
is_cygwin () [[ "$(uname -a)" == "CYGWIN"* ]]
|
||||
|
||||
jar_file () {
|
||||
echo "$sbt_launch_dir/$1/sbt-launch.jar"
|
||||
is_cygwin \
|
||||
&& echo "$(cygpath -w $sbt_launch_dir/"$1"/sbt-launch.jar)" \
|
||||
|| echo "$sbt_launch_dir/$1/sbt-launch.jar"
|
||||
}
|
||||
|
||||
download_url () {
|
||||
@ -246,19 +262,26 @@ download_url () {
|
||||
if which curl >/dev/null; then
|
||||
curl --fail --silent --location "$url" --output "$jar"
|
||||
elif which wget >/dev/null; then
|
||||
wget --quiet -O "$jar" "$url"
|
||||
wget -q -O "$jar" "$url"
|
||||
fi
|
||||
} && [[ -r "$jar" ]]
|
||||
}
|
||||
|
||||
acquire_sbt_jar () {
|
||||
sbt_url="$(jar_url "$sbt_version")"
|
||||
sbt_jar="$(jar_file "$sbt_version")"
|
||||
|
||||
[[ -r "$sbt_jar" ]] || download_url "$sbt_url" "$sbt_jar"
|
||||
{
|
||||
sbt_jar="$(jar_file "$sbt_version")"
|
||||
[[ -r "$sbt_jar" ]]
|
||||
} || {
|
||||
sbt_jar="$HOME/.ivy2/local/org.scala-sbt/sbt-launch/$sbt_version/jars/sbt-launch.jar"
|
||||
[[ -r "$sbt_jar" ]]
|
||||
} || {
|
||||
sbt_jar="$(jar_file "$sbt_version")"
|
||||
download_url "$(make_url "$sbt_version")" "$sbt_jar"
|
||||
}
|
||||
}
|
||||
|
||||
usage () {
|
||||
set_sbt_version
|
||||
cat <<EOM
|
||||
Usage: $script_name [options]
|
||||
|
||||
@ -289,20 +312,23 @@ runner with the -x option.
|
||||
-jvm-debug <port> Turn on JVM debugging, open at the given port.
|
||||
-batch Disable interactive mode
|
||||
-prompt <expr> Set the sbt prompt; in expr, 's' is the State and 'e' is Extracted
|
||||
-script <file> Run the specified file as a scala script
|
||||
|
||||
# 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 <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 <path> use the specified jar as the sbt launcher
|
||||
-sbt-launch-dir <path> directory to hold sbt launchers (default: ~/.sbt/launchers)
|
||||
-sbt-launch-repo <url> repo url for downloading sbt launcher jar (default: $sbt_launch_repo)
|
||||
-sbt-launch-dir <path> directory to hold sbt launchers (default: $sbt_launch_dir)
|
||||
-sbt-launch-repo <url> repo url for downloading sbt launcher jar (default: $(url_base "$sbt_version"))
|
||||
|
||||
# scala version (default: as chosen by sbt)
|
||||
-28 use $latest_28
|
||||
-29 use $latest_29
|
||||
-210 use $latest_210
|
||||
-211 use $latest_211
|
||||
-212 use $latest_212
|
||||
-213 use $latest_213
|
||||
-scala-home <path> use the scala build at the specified directory
|
||||
-scala-version <version> use the specified version of scala
|
||||
-binary-version <version> use the specified scala version when searching for dependencies
|
||||
@ -329,8 +355,7 @@ runner with the -x option.
|
||||
EOM
|
||||
}
|
||||
|
||||
process_args ()
|
||||
{
|
||||
process_args () {
|
||||
require_arg () {
|
||||
local type="$1"
|
||||
local opt="$2"
|
||||
@ -342,11 +367,11 @@ process_args ()
|
||||
}
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
-h|-help) usage; exit 1 ;;
|
||||
-h|-help) usage; exit 0 ;;
|
||||
-v) verbose=true && shift ;;
|
||||
-d) addSbt "--debug" && addSbt debug && shift ;;
|
||||
-w) addSbt "--warn" && addSbt warn && shift ;;
|
||||
-q) addSbt "--error" && addSbt error && shift ;;
|
||||
-d) addSbt "--debug" && shift ;;
|
||||
-w) addSbt "--warn" && shift ;;
|
||||
-q) 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 ;;
|
||||
@ -355,10 +380,11 @@ process_args ()
|
||||
-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 ;;
|
||||
-offline) addSbt "set offline in Global := 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 ;;
|
||||
-script) require_arg file "$1" "$2" && sbt_script="$2" && addJava "-Dsbt.main.class=sbt.ScriptMain" && shift 2 ;;
|
||||
|
||||
-sbt-create) sbt_create=true && shift ;;
|
||||
-sbt-jar) require_arg path "$1" "$2" && sbt_jar="$2" && shift 2 ;;
|
||||
@ -369,7 +395,7 @@ process_args ()
|
||||
-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 ;;
|
||||
-scala-home) require_arg path "$1" "$2" && setThisBuild scalaHome "_root_.scala.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 ;;
|
||||
@ -381,10 +407,9 @@ process_args ()
|
||||
-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 ;;
|
||||
-212) setScalaVersion "$latest_212" && shift ;;
|
||||
-213) setScalaVersion "$latest_213" && shift ;;
|
||||
new) sbt_new=true && : ${sbt_explicit_version:=$sbt_release_version} && addResidual "$1" && shift ;;
|
||||
*) addResidual "$1" && shift ;;
|
||||
esac
|
||||
done
|
||||
@ -395,8 +420,10 @@ process_args "$@"
|
||||
|
||||
# skip #-styled comments and blank lines
|
||||
readConfigFile() {
|
||||
while read line; do
|
||||
[[ $line =~ ^# ]] || [[ -z $line ]] || echo "$line"
|
||||
local end=false
|
||||
until $end; do
|
||||
read || end=true
|
||||
[[ $REPLY =~ ^# ]] || [[ -z $REPLY ]] || echo "$REPLY"
|
||||
done < "$1"
|
||||
}
|
||||
|
||||
@ -421,6 +448,8 @@ argumentCount=$#
|
||||
# set sbt version
|
||||
set_sbt_version
|
||||
|
||||
checkJava
|
||||
|
||||
# only exists in 0.12+
|
||||
setTraceLevel() {
|
||||
case "$sbt_version" in
|
||||
@ -433,19 +462,21 @@ setTraceLevel() {
|
||||
[[ ${#scalac_args[@]} -eq 0 ]] || addSbt "set scalacOptions in ThisBuild += \"${scalac_args[@]}\""
|
||||
|
||||
# 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"
|
||||
[[ -n "$sbt_explicit_version" && -z "$sbt_new" ]] && update_build_props_sbt "$sbt_explicit_version"
|
||||
vlog "Detected sbt version $sbt_version"
|
||||
|
||||
[[ -n "$scala_version" ]] && vlog "Overriding scala version to $scala_version"
|
||||
if [[ -n "$sbt_script" ]]; then
|
||||
residual_args=( $sbt_script ${residual_args[@]} )
|
||||
else
|
||||
# no args - alert them there's stuff in here
|
||||
(( argumentCount > 0 )) || {
|
||||
vlog "Starting $script_name: invoke with -help for other options"
|
||||
residual_args=( shell )
|
||||
}
|
||||
fi
|
||||
|
||||
# no args - alert them there's stuff in here
|
||||
(( argumentCount > 0 )) || {
|
||||
vlog "Starting $script_name: invoke with -help for other options"
|
||||
residual_args=( shell )
|
||||
}
|
||||
|
||||
# verify this is an sbt dir or -create was given
|
||||
[[ -r ./build.sbt || -d ./project || -n "$sbt_create" ]] || {
|
||||
# verify this is an sbt dir, -create was given or user attempts to run a scala script
|
||||
[[ -r ./build.sbt || -d ./project || -n "$sbt_create" || -n "$sbt_script" || -n "$sbt_new" ]] || {
|
||||
cat <<EOM
|
||||
$(pwd) doesn't appear to be an sbt project.
|
||||
If you want to start sbt anyway, run:
|
||||
@ -458,6 +489,10 @@ EOM
|
||||
# pick up completion if present; todo
|
||||
[[ -r .sbt_completion.sh ]] && source .sbt_completion.sh
|
||||
|
||||
# directory to store 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)"
|
||||
|
||||
# no jar? download it.
|
||||
[[ -r "$sbt_jar" ]] || acquire_sbt_jar || {
|
||||
# still no jar? uh-oh.
|
||||
@ -519,8 +554,8 @@ mainFiltered () {
|
||||
|
||||
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.
|
||||
local line1="$(echo "$line" | sed 's/\r\x1BM\x1B\[2K//g')" # This strips the OverwriteLine code.
|
||||
local line2="$(echo "$line1" | sed 's/\x1B\[[0-9;]*[JKmsu]//g')" # This strips all codes - we test regexes against this.
|
||||
|
||||
if [[ $line2 =~ $excludeRegex ]]; then
|
||||
[[ -n $debugUs ]] && echo "[X] $line1"
|
||||
|
@ -1,2 +1,2 @@
|
||||
SNAPPY_VERSION=1.1.4
|
||||
SNAPPY_VERSION=1.1.7
|
||||
BITSHUFFLE_VERSION=0.3.2
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -2,14 +2,11 @@ package org.xerial.snappy
|
||||
|
||||
import java.io.{ByteArrayOutputStream, ByteArrayInputStream}
|
||||
|
||||
import xerial.core.log.LogLevel
|
||||
|
||||
import scala.util.Random
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
*
|
||||
*/
|
||||
class SnappyPerformanceTest extends SnappySpec {
|
||||
|
||||
lazy val data = {
|
||||
@ -21,17 +18,16 @@ class SnappyPerformanceTest extends SnappySpec {
|
||||
a
|
||||
}
|
||||
|
||||
|
||||
"SnappyOutputStream" should {
|
||||
|
||||
"improve output performance" taggedAs("out") in {
|
||||
"improve output performance" taggedAs ("out") in {
|
||||
|
||||
val input = data
|
||||
|
||||
time("compression", repeat=100, logLevel = LogLevel.INFO) {
|
||||
time("compression", repeat = 100) {
|
||||
// 0.037 sec. => 0.026
|
||||
block("default") {
|
||||
val out = new ByteArrayOutputStream()
|
||||
val out = new ByteArrayOutputStream()
|
||||
val sout = new SnappyOutputStream(out)
|
||||
sout.write(input)
|
||||
sout.close()
|
||||
@ -43,8 +39,6 @@ class SnappyPerformanceTest extends SnappySpec {
|
||||
//info(f"compressed size: ${compressed.length}%,d, input: ${data.length}%,d")
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,22 +1,15 @@
|
||||
package org.xerial.snappy
|
||||
|
||||
import org.scalatest._
|
||||
import xerial.core.log.Logger
|
||||
import xerial.core.util.Timer
|
||||
import wvlet.log.LogFormatter.SourceCodeLogFormatter
|
||||
import wvlet.log.{LogSupport, Logger}
|
||||
import wvlet.log.io.Timer
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
trait SnappySpec
|
||||
extends WordSpec
|
||||
with Matchers
|
||||
with GivenWhenThen
|
||||
with OptionValues
|
||||
with BeforeAndAfter
|
||||
with Timer
|
||||
with Logger
|
||||
{
|
||||
|
||||
implicit def toTag(s:String) : Tag = Tag(s)
|
||||
*
|
||||
*/
|
||||
trait SnappySpec extends WordSpec with Matchers with GivenWhenThen with OptionValues with BeforeAndAfter with Timer with LogSupport {
|
||||
Logger.setDefaultFormatter(SourceCodeLogFormatter)
|
||||
|
||||
implicit def toTag(s: String): Tag = Tag(s)
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
version in ThisBuild := "1.1.5-SNAPSHOT"
|
||||
version in ThisBuild := "1.1.7-SNAPSHOT"
|
||||
|
Loading…
x
Reference in New Issue
Block a user