Apply scalafmt
This commit is contained in:
parent
64d2274d30
commit
51711eee17
96
build.sbt
96
build.sbt
|
@ -1,28 +1,27 @@
|
||||||
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"
|
||||||
|
|
||||||
credentials ++= {
|
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")))
|
Seq(Credentials("Sonatype Nexus Repository Manager", "oss.sonatype.org", sys.env("SONATYPE_USERNAME"), sys.env("SONATYPE_PASSWORD")))
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
Seq.empty
|
Seq.empty
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
publishTo := Some(
|
publishTo := Some(
|
||||||
if (isSnapshot.value) {
|
if (isSnapshot.value) {
|
||||||
Opts.resolver.sonatypeSnapshots
|
Opts.resolver.sonatypeSnapshots
|
||||||
} else {
|
} else {
|
||||||
Opts.resolver.sonatypeStaging
|
Opts.resolver.sonatypeStaging
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
pomExtra := {
|
pomExtra := {
|
||||||
<url>https://github.com/xerial/snappy-java</url>
|
<url>https://github.com/xerial/snappy-java</url>
|
||||||
<licenses>
|
<licenses>
|
||||||
<license>
|
<license>
|
||||||
<name>The Apache Software License, Version 2.0</name>
|
<name>The Apache Software License, Version 2.0</name>
|
||||||
|
@ -61,11 +60,11 @@ 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 (Compile, compile) ++= Seq("-encoding", "UTF-8", "-Xlint:unchecked", "-Xlint:deprecation", "-source", "1.7", "-target", "1.7")
|
||||||
|
|
||||||
javacOptions in doc := {
|
javacOptions in doc := {
|
||||||
val opts = Seq("-source", "1.6")
|
val opts = Seq("-source", "1.6")
|
||||||
if (scala.util.Properties.isJavaAtLeast("1.8"))
|
if (scala.util.Properties.isJavaAtLeast("1.8"))
|
||||||
opts ++ Seq("-Xdoclint:none")
|
opts ++ Seq("-Xdoclint:none")
|
||||||
else
|
else
|
||||||
opts
|
opts
|
||||||
}
|
}
|
||||||
|
|
||||||
testOptions += Tests.Argument(TestFrameworks.JUnit, "-q", "-v")
|
testOptions += Tests.Argument(TestFrameworks.JUnit, "-q", "-v")
|
||||||
|
@ -78,13 +77,13 @@ findbugsReportType := Some(FindbugsReport.FancyHtml)
|
||||||
findbugsReportPath := Some(crossTarget.value / "findbugs" / "report.html")
|
findbugsReportPath := Some(crossTarget.value / "findbugs" / "report.html")
|
||||||
|
|
||||||
libraryDependencies ++= Seq(
|
libraryDependencies ++= Seq(
|
||||||
"junit" % "junit" % "4.8.2" % "test",
|
"junit" % "junit" % "4.8.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.xerial" % "xerial-core" % "3.2.3" % "test",
|
"org.xerial" % "xerial-core" % "3.2.3" % "test",
|
||||||
"org.scalatest" % "scalatest_2.11" % "2.2.0" % "test",
|
"org.scalatest" % "scalatest_2.11" % "2.2.0" % "test",
|
||||||
"org.osgi" % "org.osgi.core" % "4.3.0" % "provided",
|
"org.osgi" % "org.osgi.core" % "4.3.0" % "provided",
|
||||||
"com.novocode" % "junit-interface" % "0.10" % "test"
|
"com.novocode" % "junit-interface" % "0.10" % "test"
|
||||||
)
|
)
|
||||||
|
|
||||||
enablePlugins(SbtOsgi)
|
enablePlugins(SbtOsgi)
|
||||||
|
@ -96,31 +95,31 @@ OsgiKeys.importPackage := Seq("""org.osgi.framework;version="[1.5,2)"""")
|
||||||
|
|
||||||
OsgiKeys.additionalHeaders := Map(
|
OsgiKeys.additionalHeaders := Map(
|
||||||
"Bundle-NativeCode" -> Seq(
|
"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=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=x64",
|
||||||
"org/xerial/snappy/native/Windows/x86_64/snappyjava.dll;osname=win32;processor=amd64",
|
"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/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/libsnappyjava.jnilib;osname=macosx;processor=x86",
|
||||||
"org/xerial/snappy/native/Mac/x86_64/libsnappyjava.jnilib;osname=macosx;processor=x86-64",
|
"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=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=x64",
|
||||||
"org/xerial/snappy/native/Linux/x86_64/libsnappyjava.so;osname=linux;processor=amd64",
|
"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/x86/libsnappyjava.so;osname=linux;processor=x86",
|
||||||
"org/xerial/snappy/native/Linux/aarch64/libsnappyjava.so;osname=linux;processor=aarch64",
|
"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/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/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/ppc64/libsnappyjava.so;osname=linux;processor=ppc64le",
|
||||||
"org/xerial/snappy/native/Linux/s390x/libsnappyjava.so;osname=linux;processor=s390x",
|
"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/ppc/libsnappyjava.a;osname=aix;processor=ppc",
|
||||||
"org/xerial/snappy/native/AIX/ppc64/libsnappyjava.a;osname=aix;processor=ppc64",
|
"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/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/x86_64/libsnappyjava.so;osname=sunos;processor=x86-64",
|
||||||
"org/xerial/snappy/native/SunOS/sparc/libsnappyjava.so;osname=sunos;processor=sparc"
|
"org/xerial/snappy/native/SunOS/sparc/libsnappyjava.so;osname=sunos;processor=sparc"
|
||||||
).mkString(","),
|
).mkString(","),
|
||||||
"Bundle-DocURL" -> "http://www.xerial.org/",
|
"Bundle-DocURL" -> "http://www.xerial.org/",
|
||||||
"Bundle-License" -> "http://www.apache.org/licenses/LICENSE-2.0.txt",
|
"Bundle-License" -> "http://www.apache.org/licenses/LICENSE-2.0.txt",
|
||||||
"Bundle-ActivationPolicy" -> "lazy",
|
"Bundle-ActivationPolicy" -> "lazy",
|
||||||
"Bundle-Name" -> "snappy-java: A fast compression/decompression library"
|
"Bundle-Name" -> "snappy-java: A fast compression/decompression library"
|
||||||
)
|
)
|
||||||
|
|
||||||
import ReleaseTransformations._
|
import ReleaseTransformations._
|
||||||
|
@ -143,4 +142,3 @@ releaseProcess := Seq[ReleaseStep](
|
||||||
releaseStepCommand("sonatypeReleaseAll"),
|
releaseStepCommand("sonatypeReleaseAll"),
|
||||||
pushChanges
|
pushChanges
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.6")
|
addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.6")
|
||||||
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "2.0")
|
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "2.0")
|
||||||
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.1.0")
|
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.1.0")
|
||||||
addSbtPlugin("com.github.sbt" % "sbt-findbugs" % "2.0.0")
|
addSbtPlugin("com.github.sbt" % "sbt-findbugs" % "2.0.0")
|
||||||
addSbtPlugin("com.github.sbt" % "sbt-jacoco" % "3.0.3")
|
addSbtPlugin("com.github.sbt" % "sbt-jacoco" % "3.0.3")
|
||||||
addSbtPlugin("com.typesafe.sbt" % "sbt-osgi" % "0.9.2")
|
addSbtPlugin("com.typesafe.sbt" % "sbt-osgi" % "0.9.2")
|
||||||
addSbtPlugin("io.get-coursier" % "sbt-coursier" % "1.0.0-RC13")
|
addSbtPlugin("io.get-coursier" % "sbt-coursier" % "1.0.0-RC13")
|
||||||
addSbtPlugin("com.geirsson" % "sbt-scalafmt" % "1.3.0")
|
addSbtPlugin("com.geirsson" % "sbt-scalafmt" % "1.3.0")
|
||||||
|
|
|
@ -6,10 +6,9 @@ import xerial.core.log.LogLevel
|
||||||
|
|
||||||
import scala.util.Random
|
import scala.util.Random
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
class SnappyPerformanceTest extends SnappySpec {
|
class SnappyPerformanceTest extends SnappySpec {
|
||||||
|
|
||||||
lazy val data = {
|
lazy val data = {
|
||||||
|
@ -21,17 +20,16 @@ class SnappyPerformanceTest extends SnappySpec {
|
||||||
a
|
a
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
"SnappyOutputStream" should {
|
"SnappyOutputStream" should {
|
||||||
|
|
||||||
"improve output performance" taggedAs("out") in {
|
"improve output performance" taggedAs ("out") in {
|
||||||
|
|
||||||
val input = data
|
val input = data
|
||||||
|
|
||||||
time("compression", repeat=100, logLevel = LogLevel.INFO) {
|
time("compression", repeat = 100, logLevel = LogLevel.INFO) {
|
||||||
// 0.037 sec. => 0.026
|
// 0.037 sec. => 0.026
|
||||||
block("default") {
|
block("default") {
|
||||||
val out = new ByteArrayOutputStream()
|
val out = new ByteArrayOutputStream()
|
||||||
val sout = new SnappyOutputStream(out)
|
val sout = new SnappyOutputStream(out)
|
||||||
sout.write(input)
|
sout.write(input)
|
||||||
sout.close()
|
sout.close()
|
||||||
|
@ -43,8 +41,6 @@ class SnappyPerformanceTest extends SnappySpec {
|
||||||
//info(f"compressed size: ${compressed.length}%,d, input: ${data.length}%,d")
|
//info(f"compressed size: ${compressed.length}%,d, input: ${data.length}%,d")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,18 +5,10 @@ import xerial.core.log.Logger
|
||||||
import xerial.core.util.Timer
|
import xerial.core.util.Timer
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
trait SnappySpec
|
trait SnappySpec extends WordSpec with Matchers with GivenWhenThen with OptionValues with BeforeAndAfter with Timer with Logger {
|
||||||
extends WordSpec
|
|
||||||
with Matchers
|
|
||||||
with GivenWhenThen
|
|
||||||
with OptionValues
|
|
||||||
with BeforeAndAfter
|
|
||||||
with Timer
|
|
||||||
with Logger
|
|
||||||
{
|
|
||||||
|
|
||||||
implicit def toTag(s:String) : Tag = Tag(s)
|
implicit def toTag(s: String): Tag = Tag(s)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue