|
| 1 | +import de.johoop.findbugs4sbt.ReportType |
| 2 | + |
| 3 | +organization := "org.msgpack" |
| 4 | +organizationName := "MessagePack" |
| 5 | +organizationHomepage := Some(new URL("http://msgpack.org/")) |
| 6 | +description := "MessagePack for Java" |
| 7 | +scalaVersion in Global := "2.11.7" |
| 8 | +logBuffered in Test := false |
| 9 | +autoScalaLibrary := false |
| 10 | +crossPaths := false |
| 11 | + |
| 12 | +// For performance testing, ensure each test run one-by-one |
| 13 | +concurrentRestrictions in Global := Seq( |
| 14 | + Tags.limit(Tags.Test, 1) |
| 15 | +) |
| 16 | + |
| 17 | +incOptions := incOptions.value.withNameHashing(true) |
| 18 | + |
| 19 | +// JVM options for building |
| 20 | +scalacOptions ++= Seq("-encoding", "UTF-8", "-deprecation", "-unchecked", "-target:jvm-1.6", "-feature") |
| 21 | + |
| 22 | +javaOptions in Test ++= Seq("-ea") |
| 23 | +javacOptions in (Compile, compile) ++= Seq("-encoding", "UTF-8", "-Xlint:unchecked", "-Xlint:deprecation", "-source", "1.6", "-target", "1.6") |
| 24 | + |
| 25 | +// Use lenient validation mode when generating Javadoc (for Java8) |
| 26 | +javacOptions in doc := { |
| 27 | + val opts = Seq("-source", "1.6") |
| 28 | + if (scala.util.Properties.isJavaAtLeast("1.8")) { |
| 29 | + opts ++ Seq("-Xdoclint:none") |
| 30 | + } |
| 31 | + else { |
| 32 | + opts |
| 33 | + } |
| 34 | +} |
| 35 | + |
| 36 | +val junitInterface = "com.novocode" % "junit-interface" % "0.11" % "test" |
| 37 | + |
| 38 | +// Project settings |
| 39 | +lazy val root = Project(id = "msgpack-java", base = file(".")) |
| 40 | + .settings( |
| 41 | + // Do not publish the root project |
| 42 | + publishArtifact := false, |
| 43 | + publish := {}, |
| 44 | + publishLocal := {}, |
| 45 | + findbugs := { |
| 46 | + // do not run findbugs for the root project |
| 47 | + } |
| 48 | + ).aggregate(msgpackCore, msgpackJackson) |
| 49 | + |
| 50 | +lazy val msgpackCore = Project(id = "msgpack-core", base = file("msgpack-core")) |
| 51 | + .settings( |
| 52 | + description := "Core library of the MessagePack for Java", |
| 53 | + libraryDependencies ++= Seq( |
| 54 | + // msgpack-core should have no external dependencies |
| 55 | + junitInterface, |
| 56 | + "org.scalatest" %% "scalatest" % "2.2.4" % "test", |
| 57 | + "org.scalacheck" %% "scalacheck" % "1.12.2" % "test", |
| 58 | + "org.xerial" % "xerial-core" % "3.3.6" % "test", |
| 59 | + "org.msgpack" % "msgpack" % "0.6.11" % "test", |
| 60 | + "commons-codec" % "commons-codec" % "1.10" % "test", |
| 61 | + "com.typesafe.akka" %% "akka-actor" % "2.3.9" % "test" |
| 62 | + ) |
| 63 | + ) |
| 64 | + |
| 65 | +lazy val msgpackJackson = Project(id = "msgpack-jackson", base = file("msgpack-jackson")) |
| 66 | + .settings( |
| 67 | + name := "jackson-dataformat-msgpack", |
| 68 | + description := "Jackson extension that adds support for MessagePack", |
| 69 | + libraryDependencies ++= Seq( |
| 70 | + "com.fasterxml.jackson.core" % "jackson-databind" % "2.6.3", |
| 71 | + junitInterface, |
| 72 | + "org.apache.commons" % "commons-math3" % "3.4.1" % "test" |
| 73 | + ), |
| 74 | + testOptions += Tests.Argument(TestFrameworks.JUnit, "-v") |
| 75 | + ).dependsOn(msgpackCore) |
| 76 | + |
| 77 | + |
| 78 | +// Release settings |
| 79 | + |
| 80 | +import ReleaseTransformations._ |
| 81 | + |
| 82 | +releaseTagName := { (version in ThisBuild).value } |
| 83 | +releaseProcess := Seq[ReleaseStep]( |
| 84 | + checkSnapshotDependencies, |
| 85 | + inquireVersions, |
| 86 | + runClean, |
| 87 | + runTest, |
| 88 | + setReleaseVersion, |
| 89 | + commitReleaseVersion, |
| 90 | + tagRelease, |
| 91 | + ReleaseStep(action = Command.process("publishSigned", _)), |
| 92 | + setNextVersion, |
| 93 | + commitNextVersion, |
| 94 | + ReleaseStep(action = Command.process("sonatypeReleaseAll", _)), |
| 95 | + pushChanges |
| 96 | + ) |
| 97 | + |
| 98 | +// Jacoco code coverage report |
| 99 | +jacoco.settings |
| 100 | +parallelExecution in jacoco.Config := false |
| 101 | + |
| 102 | +// Find bugs |
| 103 | +findbugsSettings |
| 104 | +findbugsReportType := Some(ReportType.FancyHtml) |
| 105 | +findbugsReportPath := Some(crossTarget.value / "findbugs" / "report.html") |
| 106 | + |
| 107 | +// Style check config: (sbt-jchekcstyle) |
| 108 | +jcheckStyleConfig := "facebook" |
| 109 | + |
| 110 | +// Run jcheckstyle both for main and test codes |
| 111 | +compile <<= (compile in Compile) dependsOn (jcheckStyle in Compile) |
| 112 | +compile <<= (compile in Test) dependsOn (jcheckStyle in Test) |
0 commit comments