mirror of
https://github.com/xerial/snappy-java.git
synced 2025-07-24 06:24:40 +02:00
Upgrade sbt to 1.5.6
This commit is contained in:
parent
19cfc8d9a8
commit
4d0dfc029e
31
build.sbt
31
build.sbt
@ -1,10 +1,12 @@
|
|||||||
|
Global / onChangedBuildSource := ReloadOnSourceChanges
|
||||||
|
|
||||||
name := "snappy-java"
|
name := "snappy-java"
|
||||||
organization := "org.xerial.snappy"
|
organization := "org.xerial.snappy"
|
||||||
organizationName := "xerial.org"
|
organizationName := "xerial.org"
|
||||||
description := "snappy-java: A fast compression/decompression library"
|
description := "snappy-java: A fast compression/decompression library"
|
||||||
|
|
||||||
sonatypeProfileName := "org.xerial"
|
sonatypeProfileName := "org.xerial"
|
||||||
publishTo in ThisBuild := sonatypePublishToBundle.value
|
ThisBuild / publishTo := sonatypePublishToBundle.value
|
||||||
licenses := Seq("Apache-2.0" -> url("https://www.apache.org/licenses/LICENSE-2.0.html"))
|
licenses := Seq("Apache-2.0" -> url("https://www.apache.org/licenses/LICENSE-2.0.html"))
|
||||||
homepage := Some(url("https://github.com/xerial/snappy-java"))
|
homepage := Some(url("https://github.com/xerial/snappy-java"))
|
||||||
scmInfo := Some(
|
scmInfo := Some(
|
||||||
@ -17,13 +19,13 @@ developers := List(
|
|||||||
Developer(id = "leo", name = "Taro L. Saito", email = "leo@xerial.org", url = url("http://xerial.org/leo"))
|
Developer(id = "leo", name = "Taro L. Saito", email = "leo@xerial.org", url = url("http://xerial.org/leo"))
|
||||||
)
|
)
|
||||||
|
|
||||||
scalaVersion in ThisBuild := "2.12.11"
|
ThisBuild / scalaVersion := "2.12.11"
|
||||||
|
|
||||||
// For building jars for JDK8
|
// For building jars for JDK8
|
||||||
javacOptions in ThisBuild ++= Seq("-source", "1.8", "-target", "1.8")
|
ThisBuild / javacOptions ++= Seq("-source", "1.8", "-target", "1.8")
|
||||||
javacOptions in (Compile, compile) ++= Seq("-encoding", "UTF-8", "-Xlint:unchecked", "-Xlint:deprecation")
|
Compile / compile / javacOptions ++= Seq("-encoding", "UTF-8", "-Xlint:unchecked", "-Xlint:deprecation")
|
||||||
|
|
||||||
javacOptions in doc := {
|
doc / javacOptions := {
|
||||||
val opts = Seq("-source", "1.8")
|
val opts = Seq("-source", "1.8")
|
||||||
if (scala.util.Properties.isJavaAtLeast("1.8"))
|
if (scala.util.Properties.isJavaAtLeast("1.8"))
|
||||||
opts ++ Seq("-Xdoclint:none")
|
opts ++ Seq("-Xdoclint:none")
|
||||||
@ -32,7 +34,9 @@ javacOptions in doc := {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Configuration for SnappyHadoopCompatibleOutputStream testing
|
// Configuration for SnappyHadoopCompatibleOutputStream testing
|
||||||
fork in Test := true
|
Test / fork := true
|
||||||
|
|
||||||
|
|
||||||
val libTemp = {
|
val libTemp = {
|
||||||
val path = s"${System.getProperty("java.io.tmpdir")}/snappy_test_${System.currentTimeMillis()}"
|
val path = s"${System.getProperty("java.io.tmpdir")}/snappy_test_${System.currentTimeMillis()}"
|
||||||
// certain older Linux systems (debian/trusty in Travis CI) requires the libsnappy.so, loaded by
|
// certain older Linux systems (debian/trusty in Travis CI) requires the libsnappy.so, loaded by
|
||||||
@ -48,22 +52,21 @@ val linuxLibPath = s"$libTemp:${System.getenv("LD_LIBRARY_PATH")}"
|
|||||||
|
|
||||||
// have to add to system dynamic library path since hadoop native library indirectly load libsnappy.1
|
// have to add to system dynamic library path since hadoop native library indirectly load libsnappy.1
|
||||||
// can't use javaOptions in Test because it causes the expression to eval twice yielding different temp path values
|
// can't use javaOptions in Test because it causes the expression to eval twice yielding different temp path values
|
||||||
envVars in Test := Map("XERIAL_SNAPPY_LIB" -> libTemp, "DYLD_LIBRARY_PATH" -> macOSXLibPath, "LD_LIBRARY_PATH" -> linuxLibPath)
|
Test / envVars := Map("XERIAL_SNAPPY_LIB" -> libTemp, "DYLD_LIBRARY_PATH" -> macOSXLibPath, "LD_LIBRARY_PATH" -> linuxLibPath)
|
||||||
|
|
||||||
testOptions += Tests.Argument(TestFrameworks.JUnit, "-q", "-v")
|
testOptions += Tests.Argument(TestFrameworks.JUnit, "-q", "-v")
|
||||||
concurrentRestrictions in Global := Seq(Tags.limit(Tags.Test, 1))
|
Test / parallelExecution := false
|
||||||
|
|
||||||
autoScalaLibrary := false
|
autoScalaLibrary := false
|
||||||
crossPaths := false
|
crossPaths := false
|
||||||
logBuffered in Test := false
|
|
||||||
|
|
||||||
libraryDependencies ++= Seq(
|
libraryDependencies ++= Seq(
|
||||||
"junit" % "junit" % "4.8.2" % "test",
|
"junit" % "junit" % "4.13.2" % "test",
|
||||||
"org.codehaus.plexus" % "plexus-classworlds" % "2.4" % "test",
|
"org.codehaus.plexus" % "plexus-classworlds" % "2.4" % "test",
|
||||||
"org.xerial.java" % "xerial-core" % "2.1" % "test",
|
"org.xerial.java" % "xerial-core" % "2.1" % "test",
|
||||||
"org.wvlet.airframe" %% "airframe-log" % "20.6.1" % "test",
|
"org.wvlet.airframe" %% "airframe-log" % "21.12.0" % "test",
|
||||||
"org.scalatest" %% "scalatest" % "3.0.4" % "test",
|
|
||||||
"org.osgi" % "org.osgi.core" % "4.3.0" % "provided",
|
"org.osgi" % "org.osgi.core" % "4.3.0" % "provided",
|
||||||
"com.novocode" % "junit-interface" % "0.11" % "test",
|
"com.github.sbt" % "junit-interface" % "0.13.2" % "test",
|
||||||
"org.apache.hadoop" % "hadoop-common" % "2.7.3" % "test" exclude ("org.xerial.snappy", "snappy-java")
|
"org.apache.hadoop" % "hadoop-common" % "2.7.3" % "test" exclude ("org.xerial.snappy", "snappy-java")
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -108,7 +111,7 @@ OsgiKeys.additionalHeaders := Map(
|
|||||||
|
|
||||||
import ReleaseTransformations._
|
import ReleaseTransformations._
|
||||||
|
|
||||||
releaseTagName := { (version in ThisBuild).value }
|
releaseTagName := { (ThisBuild / version).value }
|
||||||
|
|
||||||
releaseProcess := Seq[ReleaseStep](
|
releaseProcess := Seq[ReleaseStep](
|
||||||
checkSnapshotDependencies,
|
checkSnapshotDependencies,
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
sbt.version=1.3.12
|
sbt.version=1.5.6
|
||||||
|
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.13")
|
addSbtPlugin("com.github.sbt" % "sbt-release" % "1.1.0")
|
||||||
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.3")
|
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.10")
|
||||||
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "2.0.0-M2")
|
addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.1.2")
|
||||||
addSbtPlugin("com.github.sbt" % "sbt-jacoco" % "3.1.0")
|
|
||||||
addSbtPlugin("com.typesafe.sbt" % "sbt-osgi" % "0.9.5")
|
addSbtPlugin("com.typesafe.sbt" % "sbt-osgi" % "0.9.5")
|
||||||
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.0")
|
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.3")
|
||||||
|
48
sbt
48
sbt
@ -34,11 +34,11 @@
|
|||||||
|
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
||||||
declare -r sbt_release_version="1.3.12"
|
declare -r sbt_release_version="1.5.5"
|
||||||
declare -r sbt_unreleased_version="1.4.0-M1"
|
declare -r sbt_unreleased_version="1.6.0-M1"
|
||||||
|
|
||||||
declare -r latest_213="2.13.2"
|
declare -r latest_213="2.13.7"
|
||||||
declare -r latest_212="2.12.11"
|
declare -r latest_212="2.12.15"
|
||||||
declare -r latest_211="2.11.12"
|
declare -r latest_211="2.11.12"
|
||||||
declare -r latest_210="2.10.7"
|
declare -r latest_210="2.10.7"
|
||||||
declare -r latest_29="2.9.3"
|
declare -r latest_29="2.9.3"
|
||||||
@ -48,7 +48,7 @@ declare -r buildProps="project/build.properties"
|
|||||||
|
|
||||||
declare -r sbt_launch_ivy_release_repo="https://repo.typesafe.com/typesafe/ivy-releases"
|
declare -r sbt_launch_ivy_release_repo="https://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_ivy_snapshot_repo="https://repo.scala-sbt.org/scalasbt/ivy-snapshots"
|
||||||
declare -r sbt_launch_mvn_release_repo="https://repo.scala-sbt.org/scalasbt/maven-releases"
|
declare -r sbt_launch_mvn_release_repo="https://repo1.maven.org/maven2"
|
||||||
declare -r sbt_launch_mvn_snapshot_repo="https://repo.scala-sbt.org/scalasbt/maven-snapshots"
|
declare -r sbt_launch_mvn_snapshot_repo="https://repo.scala-sbt.org/scalasbt/maven-snapshots"
|
||||||
|
|
||||||
declare -r default_jvm_opts_common="-Xms512m -Xss2m -XX:MaxInlineLevel=18"
|
declare -r default_jvm_opts_common="-Xms512m -Xss2m -XX:MaxInlineLevel=18"
|
||||||
@ -127,6 +127,7 @@ init_default_option_file() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sbt_opts_file="$(init_default_option_file SBT_OPTS .sbtopts)"
|
sbt_opts_file="$(init_default_option_file SBT_OPTS .sbtopts)"
|
||||||
|
sbtx_opts_file="$(init_default_option_file SBTX_OPTS .sbtxopts)"
|
||||||
jvm_opts_file="$(init_default_option_file JVM_OPTS .jvmopts)"
|
jvm_opts_file="$(init_default_option_file JVM_OPTS .jvmopts)"
|
||||||
|
|
||||||
build_props_sbt() {
|
build_props_sbt() {
|
||||||
@ -215,7 +216,8 @@ getJavaVersion() {
|
|||||||
# but on 9 and 10 it's 9.x.y and 10.x.y.
|
# but on 9 and 10 it's 9.x.y and 10.x.y.
|
||||||
if [[ "$str" =~ ^1\.([0-9]+)(\..*)?$ ]]; then
|
if [[ "$str" =~ ^1\.([0-9]+)(\..*)?$ ]]; then
|
||||||
echo "${BASH_REMATCH[1]}"
|
echo "${BASH_REMATCH[1]}"
|
||||||
elif [[ "$str" =~ ^([0-9]+)(\..*)?$ ]]; then
|
# Fixes https://github.com/dwijnand/sbt-extras/issues/326
|
||||||
|
elif [[ "$str" =~ ^([0-9]+)(\..*)?(-ea)?$ ]]; then
|
||||||
echo "${BASH_REMATCH[1]}"
|
echo "${BASH_REMATCH[1]}"
|
||||||
elif [[ -n "$str" ]]; then
|
elif [[ -n "$str" ]]; then
|
||||||
echoerr "Can't parse java version from: $str"
|
echoerr "Can't parse java version from: $str"
|
||||||
@ -246,11 +248,20 @@ java_version() {
|
|||||||
echo "$version"
|
echo "$version"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
is_apple_silicon() { [[ "$(uname -s)" == "Darwin" && "$(uname -m)" == "arm64" ]]; }
|
||||||
|
|
||||||
# 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() {
|
default_jvm_opts() {
|
||||||
local -r v="$(java_version)"
|
local -r v="$(java_version)"
|
||||||
if [[ $v -ge 10 ]]; then
|
if [[ $v -ge 17 ]]; then
|
||||||
echo "$default_jvm_opts_common -XX:+UnlockExperimentalVMOptions"
|
echo "$default_jvm_opts_common"
|
||||||
|
elif [[ $v -ge 10 ]]; then
|
||||||
|
if is_apple_silicon; then
|
||||||
|
# As of Dec 2020, JVM for Apple Silicon (M1) doesn't support JVMCI
|
||||||
|
echo "$default_jvm_opts_common"
|
||||||
|
else
|
||||||
|
echo "$default_jvm_opts_common -XX:+UnlockExperimentalVMOptions -XX:+UseJVMCICompiler"
|
||||||
|
fi
|
||||||
elif [[ $v -ge 8 ]]; then
|
elif [[ $v -ge 8 ]]; then
|
||||||
echo "$default_jvm_opts_common"
|
echo "$default_jvm_opts_common"
|
||||||
else
|
else
|
||||||
@ -439,6 +450,12 @@ are not special.
|
|||||||
Note: "@"-file is overridden by local '.sbtopts' or '-sbt-opts' argument.
|
Note: "@"-file is overridden by local '.sbtopts' or '-sbt-opts' argument.
|
||||||
-sbt-opts <path> file containing sbt args (if not given, .sbtopts in project root is used if present)
|
-sbt-opts <path> file containing sbt args (if not given, .sbtopts in project root is used if present)
|
||||||
-S-X add -X to sbt's scalacOptions (-S is stripped)
|
-S-X add -X to sbt's scalacOptions (-S is stripped)
|
||||||
|
|
||||||
|
# passing options exclusively to this runner
|
||||||
|
SBTX_OPTS environment variable holding either the sbt-extras args directly, or
|
||||||
|
the reference to a file containing sbt-extras args if given path is prepended by '@' (e.g. '@/etc/sbtxopts')
|
||||||
|
Note: "@"-file is overridden by local '.sbtxopts' or '-sbtx-opts' argument.
|
||||||
|
-sbtx-opts <path> file containing sbt-extras args (if not given, .sbtxopts in project root is used if present)
|
||||||
EOM
|
EOM
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
@ -464,7 +481,7 @@ process_args() {
|
|||||||
-trace) require_arg integer "$1" "$2" && trace_level="$2" && shift 2 ;;
|
-trace) require_arg integer "$1" "$2" && trace_level="$2" && shift 2 ;;
|
||||||
-debug-inc) addJava "-Dxsbt.inc.debug=true" && shift ;;
|
-debug-inc) addJava "-Dxsbt.inc.debug=true" && shift ;;
|
||||||
|
|
||||||
-no-colors) addJava "-Dsbt.log.noformat=true" && shift ;;
|
-no-colors) addJava "-Dsbt.log.noformat=true" && addJava "-Dsbt.color=false" && shift ;;
|
||||||
-sbt-create) sbt_create=true && shift ;;
|
-sbt-create) sbt_create=true && shift ;;
|
||||||
-sbt-dir) require_arg path "$1" "$2" && sbt_dir="$2" && shift 2 ;;
|
-sbt-dir) require_arg path "$1" "$2" && sbt_dir="$2" && shift 2 ;;
|
||||||
-sbt-boot) require_arg path "$1" "$2" && addJava "-Dsbt.boot.directory=$2" && shift 2 ;;
|
-sbt-boot) require_arg path "$1" "$2" && addJava "-Dsbt.boot.directory=$2" && shift 2 ;;
|
||||||
@ -495,6 +512,7 @@ process_args() {
|
|||||||
-scala-home) require_arg path "$1" "$2" && setThisBuild scalaHome "_root_.scala.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 ;;
|
-java-home) require_arg path "$1" "$2" && setJavaHome "$2" && shift 2 ;;
|
||||||
-sbt-opts) require_arg path "$1" "$2" && sbt_opts_file="$2" && shift 2 ;;
|
-sbt-opts) require_arg path "$1" "$2" && sbt_opts_file="$2" && shift 2 ;;
|
||||||
|
-sbtx-opts) require_arg path "$1" "$2" && sbtx_opts_file="$2" && shift 2 ;;
|
||||||
-jvm-opts) require_arg path "$1" "$2" && jvm_opts_file="$2" && shift 2 ;;
|
-jvm-opts) require_arg path "$1" "$2" && jvm_opts_file="$2" && shift 2 ;;
|
||||||
|
|
||||||
-D*) addJava "$1" && shift ;;
|
-D*) addJava "$1" && shift ;;
|
||||||
@ -532,6 +550,18 @@ else
|
|||||||
vlog "No extra sbt options have been defined"
|
vlog "No extra sbt options have been defined"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# if there are file/environment sbtx_opts, process again so we
|
||||||
|
# can supply args to this runner
|
||||||
|
if [[ -r "$sbtx_opts_file" ]]; then
|
||||||
|
vlog "Using sbt options defined in file $sbtx_opts_file"
|
||||||
|
while read -r opt; do extra_sbt_opts+=("$opt"); done < <(readConfigFile "$sbtx_opts_file")
|
||||||
|
elif [[ -n "$SBTX_OPTS" && ! ("$SBTX_OPTS" =~ ^@.*) ]]; then
|
||||||
|
vlog "Using sbt options defined in variable \$SBTX_OPTS"
|
||||||
|
IFS=" " read -r -a extra_sbt_opts <<<"$SBTX_OPTS"
|
||||||
|
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
|
# reset "$@" to the residual args
|
||||||
|
@ -1,43 +0,0 @@
|
|||||||
package org.xerial.snappy
|
|
||||||
|
|
||||||
import java.io.{ByteArrayOutputStream, ByteArrayInputStream}
|
|
||||||
|
|
||||||
import scala.util.Random
|
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
class SnappyPerformanceTest extends SnappySpec {
|
|
||||||
|
|
||||||
lazy val data = {
|
|
||||||
val a = new Array[Byte](128 * 1024 * 1024)
|
|
||||||
|
|
||||||
for (i <- (0 until a.length).par) {
|
|
||||||
a(i) = Math.sin(i * 0.01).toByte
|
|
||||||
}
|
|
||||||
a
|
|
||||||
}
|
|
||||||
|
|
||||||
"SnappyOutputStream" should {
|
|
||||||
|
|
||||||
"improve output performance" taggedAs ("out") in {
|
|
||||||
|
|
||||||
val input = data
|
|
||||||
|
|
||||||
time("compression", repeat = 100) {
|
|
||||||
// 0.037 sec. => 0.026
|
|
||||||
block("default") {
|
|
||||||
val out = new ByteArrayOutputStream()
|
|
||||||
val sout = new SnappyOutputStream(out)
|
|
||||||
sout.write(input)
|
|
||||||
sout.close()
|
|
||||||
out.close()
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//info(f"compressed size: ${compressed.length}%,d, input: ${data.length}%,d")
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,14 +0,0 @@
|
|||||||
package org.xerial.snappy
|
|
||||||
|
|
||||||
import org.scalatest._
|
|
||||||
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 LogSupport {
|
|
||||||
Logger.setDefaultFormatter(SourceCodeLogFormatter)
|
|
||||||
|
|
||||||
implicit def toTag(s: String): Tag = Tag(s)
|
|
||||||
}
|
|
@ -1 +1 @@
|
|||||||
version in ThisBuild := "1.1.8.5-SNAPSHOT"
|
ThisBuild / version := "1.1.8.5-SNAPSHOT"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user