From f90efe8364896eaa7e0df30953c7fc83c134286d Mon Sep 17 00:00:00 2001 From: xuwei-k <6b656e6a69@gmail.com> Date: Sun, 22 Nov 2015 04:47:16 +0900 Subject: [PATCH] fix build.sbt --- build.sbt | 129 ++++++++++++++++++++++++++---------------------------- 1 file changed, 61 insertions(+), 68 deletions(-) diff --git a/build.sbt b/build.sbt index b99461796..365719b83 100644 --- a/build.sbt +++ b/build.sbt @@ -1,43 +1,71 @@ import de.johoop.findbugs4sbt.ReportType +import ReleaseTransformations._ -organization := "org.msgpack" -organizationName := "MessagePack" -organizationHomepage := Some(new URL("http://msgpack.org/")) -description := "MessagePack for Java" -scalaVersion in Global := "2.11.7" -logBuffered in Test := false -autoScalaLibrary := false -crossPaths := false - -// For performance testing, ensure each test run one-by-one -concurrentRestrictions in Global := Seq( - Tags.limit(Tags.Test, 1) +val buildSettings = findbugsSettings ++ jacoco.settings ++ Seq[Setting[_]]( + organization := "org.msgpack", + organizationName := "MessagePack", + organizationHomepage := Some(new URL("http://msgpack.org/")), + description := "MessagePack for Java", + scalaVersion := "2.11.7", + logBuffered in Test := false, + autoScalaLibrary := false, + crossPaths := false, + // For performance testing, ensure each test run one-by-one + concurrentRestrictions in Global := Seq( + Tags.limit(Tags.Test, 1) + ), + // JVM options for building + scalacOptions ++= Seq("-encoding", "UTF-8", "-deprecation", "-unchecked", "-target:jvm-1.6", "-feature"), + javaOptions in Test ++= Seq("-ea"), + javacOptions in (Compile, compile) ++= Seq("-encoding", "UTF-8", "-Xlint:unchecked", "-Xlint:deprecation", "-source", "1.6", "-target", "1.6"), + // Use lenient validation mode when generating Javadoc (for Java8) + javacOptions in doc := { + val opts = Seq("-source", "1.6") + if (scala.util.Properties.isJavaAtLeast("1.8")) { + opts ++ Seq("-Xdoclint:none") + } + else { + opts + } + }, + // Release settings + releaseTagName := { (version in ThisBuild).value }, + releaseProcess := Seq[ReleaseStep]( + checkSnapshotDependencies, + inquireVersions, + runClean, + runTest, + setReleaseVersion, + commitReleaseVersion, + tagRelease, + ReleaseStep(action = Command.process("publishSigned", _)), + setNextVersion, + commitNextVersion, + ReleaseStep(action = Command.process("sonatypeReleaseAll", _)), + pushChanges + ), + + // Jacoco code coverage report + parallelExecution in jacoco.Config := false, + + // Find bugs + findbugsReportType := Some(ReportType.FancyHtml), + findbugsReportPath := Some(crossTarget.value / "findbugs" / "report.html"), + + // Style check config: (sbt-jchekcstyle) + jcheckStyleConfig := "facebook", + + // Run jcheckstyle both for main and test codes + compile <<= (compile in Compile) dependsOn (jcheckStyle in Compile), + compile <<= (compile in Test) dependsOn (jcheckStyle in Test) ) -incOptions := incOptions.value.withNameHashing(true) - -// JVM options for building -scalacOptions ++= Seq("-encoding", "UTF-8", "-deprecation", "-unchecked", "-target:jvm-1.6", "-feature") - -javaOptions in Test ++= Seq("-ea") -javacOptions in (Compile, compile) ++= Seq("-encoding", "UTF-8", "-Xlint:unchecked", "-Xlint:deprecation", "-source", "1.6", "-target", "1.6") - -// Use lenient validation mode when generating Javadoc (for Java8) -javacOptions in doc := { - val opts = Seq("-source", "1.6") - if (scala.util.Properties.isJavaAtLeast("1.8")) { - opts ++ Seq("-Xdoclint:none") - } - else { - opts - } -} - val junitInterface = "com.novocode" % "junit-interface" % "0.11" % "test" // Project settings lazy val root = Project(id = "msgpack-java", base = file(".")) .settings( + buildSettings, // Do not publish the root project publishArtifact := false, publish := {}, @@ -49,6 +77,7 @@ lazy val root = Project(id = "msgpack-java", base = file(".")) lazy val msgpackCore = Project(id = "msgpack-core", base = file("msgpack-core")) .settings( + buildSettings, description := "Core library of the MessagePack for Java", libraryDependencies ++= Seq( // msgpack-core should have no external dependencies @@ -64,6 +93,7 @@ lazy val msgpackCore = Project(id = "msgpack-core", base = file("msgpack-core")) lazy val msgpackJackson = Project(id = "msgpack-jackson", base = file("msgpack-jackson")) .settings( + buildSettings, name := "jackson-dataformat-msgpack", description := "Jackson extension that adds support for MessagePack", libraryDependencies ++= Seq( @@ -73,40 +103,3 @@ lazy val msgpackJackson = Project(id = "msgpack-jackson", base = file("msgpack-j ), testOptions += Tests.Argument(TestFrameworks.JUnit, "-v") ).dependsOn(msgpackCore) - - -// Release settings - -import ReleaseTransformations._ - -releaseTagName := { (version in ThisBuild).value } -releaseProcess := Seq[ReleaseStep]( - checkSnapshotDependencies, - inquireVersions, - runClean, - runTest, - setReleaseVersion, - commitReleaseVersion, - tagRelease, - ReleaseStep(action = Command.process("publishSigned", _)), - setNextVersion, - commitNextVersion, - ReleaseStep(action = Command.process("sonatypeReleaseAll", _)), - pushChanges - ) - -// Jacoco code coverage report -jacoco.settings -parallelExecution in jacoco.Config := false - -// Find bugs -findbugsSettings -findbugsReportType := Some(ReportType.FancyHtml) -findbugsReportPath := Some(crossTarget.value / "findbugs" / "report.html") - -// Style check config: (sbt-jchekcstyle) -jcheckStyleConfig := "facebook" - -// Run jcheckstyle both for main and test codes -compile <<= (compile in Compile) dependsOn (jcheckStyle in Compile) -compile <<= (compile in Test) dependsOn (jcheckStyle in Test)