Skip to content

Commit

Permalink
update build, migrate to build.sbt
Browse files Browse the repository at this point in the history
  • Loading branch information
levkhomich committed Aug 16, 2017
1 parent 2b39b47 commit ffde442
Show file tree
Hide file tree
Showing 4 changed files with 147 additions and 212 deletions.
105 changes: 105 additions & 0 deletions build.sbt
@@ -0,0 +1,105 @@
import sbt._
import Keys._

import com.typesafe.tools.mima.plugin.MimaKeys.previousArtifact
import com.typesafe.tools.mima.plugin.MimaPlugin.mimaDefaultSettings
import org.scoverage.coveralls.CoverallsPlugin
import sbtdoge.CrossPerProjectPlugin

lazy val projectInfo = Seq (
organization := "com.github.levkhomich",
version := "0.6.1-SNAPSHOT",
homepage := Some(url("https://github.com/levkhomich/akka-tracing")),
scmInfo := Some(ScmInfo(
url("https://github.com/levkhomich/akka-tracing.git"),
"scm:git:git@github.com:levkhomich/akka-tracing.git"
)),
startYear := Some(2014),
licenses := Seq("Apache Public License 2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0")),
developers := List(
Developer("levkhomich", "Lev Khomich", "levkhomich@gmail.com", url("http://github.com/levkhomich"))
)
)

lazy val root = (project in file(".")).settings(commonSettings).settings(
publish := (),
publishLocal := (),
// workaround for sbt-pgp
packagedArtifacts := Map.empty,
previousArtifact := None
).aggregate(`akka-tracing-core`, `akka-tracing-play`, `akka-tracing-http`).enablePlugins(CrossPerProjectPlugin)

lazy val `akka-tracing-core` = (project in file("core")).settings(commonSettings).settings(
libraryDependencies ++= Dependencies.thrift ++ Dependencies.akka ++ Dependencies.test(scalaVersion.value),
sourceGenerators in Compile += Def.task {
val srcManaged = (sourceManaged in Compile).value
val thriftSrc = (sourceDirectory in Compile).value / "thrift" / "zipkin.thrift"
s"${baseDirectory.value}/project/gen_thrift.sh $thriftSrc $srcManaged".!
(srcManaged / "com" / "github" / "levkhomich" / "akka" / "tracing" / "thrift").listFiles().toSeq
}.taskValue
)

lazy val `akka-tracing-play` = (project in file("play")).settings(commonSettings).settings(
crossScalaVersions := Seq("2.11.11"),
libraryDependencies ++= Dependencies.play ++ Dependencies.testPlay(scalaVersion.value),
previousArtifact := None
).dependsOn(`akka-tracing-core` % passTestDeps)

lazy val `akka-tracing-http` = (project in file("akka-http")).settings(commonSettings).settings(
libraryDependencies ++= Dependencies.http ++ Dependencies.test(scalaVersion.value)
).dependsOn(`akka-tracing-core` % passTestDeps)

lazy val commonSettings = projectInfo ++ compilationSettings ++ testSettings ++ publicationSettings ++ scalariformSettings

lazy val compilationSettings =
Seq(
scalaVersion := "2.11.11",
crossScalaVersions := Seq("2.11.11", "2.12.3"),
scalacOptions ++= Seq(
"-target:jvm-1.8",
"-encoding", "utf8",
"-deprecation",
"-unchecked",
"-feature",
"-language:_",
"-Xcheckinit",
"-Xlint",
"-Xlog-reflective-calls"
),
javacOptions ++= Seq(
"-Xlint:all",
"-source", "1.8",
"-target", "1.8"
),
updateOptions := updateOptions.value.withCachedResolution(true)
)

lazy val testSettings =
CoverallsPlugin.projectSettings ++
mimaDefaultSettings ++
Seq(
previousArtifact := Some(organization.value % (moduleName.value + '_' + scalaBinaryVersion.value) % "0.4"),
scalacOptions in Test ++= Seq("-Yrangepos")
)

lazy val publicationSettings = Seq(
publishMavenStyle := true,
publishTo <<= version { v =>
if (v.endsWith("SNAPSHOT"))
Some(Resolver.sonatypeRepo("snapshots"))
else
Some("releases" at "https://oss.sonatype.org/service/local/staging/deploy/maven2")
},
publishArtifact in Test := false,
pomIncludeRepository := { _ => false },
com.typesafe.sbt.SbtScalariform.ScalariformKeys.preferences := {
import scalariform.formatter.preferences._
FormattingPreferences()
.setPreference(AlignParameters, true)
.setPreference(DoubleIndentClassDeclaration, true)
.setPreference(PreserveDanglingCloseParenthesis, true)
.setPreference(PreserveSpaceBeforeArguments, true)
}
)

lazy val passTestDeps = "test->test;compile->compile"
210 changes: 0 additions & 210 deletions project/Build.scala

This file was deleted.

42 changes: 42 additions & 0 deletions project/Dependencies.scala
@@ -0,0 +1,42 @@
import sbt._

object Dependencies {

val PlayVersion = "2.5.13"
val AkkaVersion = "2.4.17"
val AkkaHttpVersion = "10.0.5"

object Compile {
val akkaActor = "com.typesafe.akka" %% "akka-actor" % AkkaVersion
val akkaAgent = "com.typesafe.akka" %% "akka-agent" % AkkaVersion
val akkaStream = "com.typesafe.akka" %% "akka-stream" % AkkaVersion
val akkaHttp = "com.typesafe.akka" %% "akka-http" % AkkaHttpVersion
val play = "com.typesafe.play" %% "play" % PlayVersion
val config = "com.typesafe" % "config" % "1.3.1"
val libThrift = "org.apache.thrift" % "libthrift" % "0.10.0"
}

object Test {
val specs = "org.specs2" %% "specs2-core" % "3.8.9" % "test"
val finagle = "com.twitter" %% "finagle-core" % "6.43.0" % "test"
val braveCore = "io.zipkin.brave" % "brave-core" % "4.0.6" % "test"
val playSpecs2 = "com.typesafe.play" %% "play-specs2" % PlayVersion % "test"
val akkaTest = "com.typesafe.akka" %% "akka-testkit" % AkkaVersion % "test"
val akkaRemote = "com.typesafe.akka" %% "akka-remote" % AkkaVersion % "test"
val akkaSlf4j = "com.typesafe.akka" %% "akka-slf4j" % AkkaVersion % "test"
val akkaHttpTest = "com.typesafe.akka" %% "akka-http-testkit" % AkkaHttpVersion % "test"
val logback = "ch.qos.logback" % "logback-classic" % "1.2.2" % "test"
}

val akka = Seq(Compile.akkaActor, Compile.akkaAgent, Compile.akkaStream, Compile.config)
val play = Seq(Compile.play)
val http = Seq(Compile.akkaHttp)
val thrift = Seq(Compile.libThrift)

def test(scalaVersion: String): Seq[ModuleID] =
Seq(Test.specs, Test.finagle, Test.braveCore, Test.akkaTest,
Test.akkaHttpTest, Test.akkaRemote, Test.akkaSlf4j, Test.logback)

def testPlay(scalaVersion: String): Seq[ModuleID] =
test(scalaVersion) :+ Test.playSpecs2
}
2 changes: 0 additions & 2 deletions project/plugins.sbt
@@ -1,7 +1,5 @@
resolvers += Classpaths.sbtPluginReleases

//addSbtPlugin("com.twitter" %% "scrooge-sbt-plugin" % "3.14.1")

addSbtPlugin("com.eed3si9n" % "sbt-doge" % "0.1.5")

addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.5.0")
Expand Down

0 comments on commit ffde442

Please sign in to comment.