build.sbt 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. lazy val akkaHttpSlickPostgres =
  2. project
  3. .in(file("."))
  4. .enablePlugins(
  5. GitBranchPrompt,
  6. GitVersioning,
  7. JavaAppPackaging,
  8. DockerPlugin,
  9. AshScriptPlugin
  10. )
  11. .settings(settings)
  12. .settings(
  13. name := "akka-http-slick-postgres",
  14. mainClass in Compile := Some("net.benchmark.akka.http.Main"),
  15. libraryDependencies ++= Seq(
  16. library.akkaSlf4j,
  17. library.akkaStream,
  18. library.akkaHttp,
  19. library.akkaHttpCirce,
  20. library.akkaTestkit % Test,
  21. library.akkaHttpTestkit % Test,
  22. library.akkaStreamTestkit % Test,
  23. library.logbackClassic,
  24. library.postgresql,
  25. library.scalaCheck % Test,
  26. library.scalaTest % Test,
  27. library.scalateCore,
  28. library.slick,
  29. library.slickPgCore,
  30. library.slickHikariCP,
  31. ),
  32. parallelExecution in Test := true
  33. )
  34. lazy val library =
  35. new {
  36. object Version {
  37. val akka = "2.5.20"
  38. val akkaHttp = "10.1.7"
  39. val akkaHttpCirce = "1.23.0"
  40. val logback = "1.2.3"
  41. val postgresql = "42.2.5"
  42. val scalaCheck = "1.14.0"
  43. val scalaTest = "3.0.5"
  44. val scalate = "1.8.0"
  45. val slick = "3.3.0"
  46. val slickPg = "0.17.2"
  47. }
  48. val akkaSlf4j = "com.typesafe.akka" %% "akka-slf4j" % Version.akka
  49. val akkaHttp = "com.typesafe.akka" %% "akka-http" % Version.akkaHttp
  50. val akkaHttpTestkit = "com.typesafe.akka" %% "akka-http-testkit" % Version.akkaHttp
  51. val akkaHttpCirce = "de.heikoseeberger" %% "akka-http-circe" % Version.akkaHttpCirce
  52. val akkaStream = "com.typesafe.akka" %% "akka-stream" % Version.akka
  53. val akkaStreamTestkit = "com.typesafe.akka" %% "akka-stream-testkit" % Version.akka
  54. val akkaTestkit = "com.typesafe.akka" %% "akka-testkit" % Version.akka
  55. val logbackClassic = "ch.qos.logback" % "logback-classic" % Version.logback
  56. val postgresql = "org.postgresql" % "postgresql" % Version.postgresql
  57. val scalaCheck = "org.scalacheck" %% "scalacheck" % Version.scalaCheck
  58. val scalaTest = "org.scalatest" %% "scalatest" % Version.scalaTest
  59. val scalateCore = "org.scalatra.scalate" %% "scalate-core" % Version.scalate
  60. val slick = "com.typesafe.slick" %% "slick" % Version.slick
  61. val slickHikariCP = "com.typesafe.slick" %% "slick-hikaricp" % Version.slick
  62. val slickPgCore = "com.github.tminglei" %% "slick-pg" % Version.slickPg
  63. }
  64. lazy val settings =
  65. commonSettings ++
  66. gitSettings ++
  67. packagingSettings ++
  68. scalafmtSettings
  69. lazy val commonSettings =
  70. Seq(
  71. organization := "net.benchmark.akka.http",
  72. organizationName := "Akka",
  73. scalaVersion := "2.12.6",
  74. scalacOptions ++= Seq(
  75. "-deprecation",
  76. "-encoding",
  77. "UTF-8",
  78. "-explaintypes",
  79. "-feature",
  80. "-target:jvm-1.8",
  81. "-unchecked",
  82. "-Xfatal-warnings",
  83. "-Xfuture",
  84. "-Xlint",
  85. "-Ydelambdafy:method",
  86. "-Yno-adapted-args",
  87. "-Ypartial-unification",
  88. "-Ywarn-numeric-widen",
  89. "-Ywarn-unused-import",
  90. "-Ywarn-value-discard"
  91. ),
  92. scalacOptions in (Compile, console) --= Seq("-Xfatal-warnings"), // Relax settings for console
  93. scalacOptions in (Test, console) --= Seq("-Xfatal-warnings"), // Relax settings for console
  94. javacOptions ++= Seq(
  95. "-encoding",
  96. "UTF-8",
  97. "-source",
  98. "1.8",
  99. "-target",
  100. "1.8"
  101. ),
  102. javaOptions ++= Seq(
  103. "-jvm-debug 5555"
  104. ),
  105. transitiveClassifiers := Seq("sources"),
  106. publishArtifact in (Compile, packageDoc) := false,
  107. unmanagedSourceDirectories.in(Compile) := Seq(scalaSource.in(Compile).value),
  108. unmanagedSourceDirectories.in(Test) := Seq(scalaSource.in(Test).value),
  109. wartremoverWarnings in (Compile, compile) ++= Warts.unsafe
  110. )
  111. lazy val gitSettings =
  112. Seq(
  113. git.useGitDescribe := true
  114. )
  115. lazy val packagingSettings =
  116. Seq(
  117. mappings in Universal += {
  118. // we are using the reference.conf as default application.conf
  119. // the user can override settings here
  120. val conf = (resourceDirectory in Compile).value / "reference.conf"
  121. conf -> "conf/application.conf"
  122. },
  123. scriptClasspath := Seq("../conf/") ++ scriptClasspath.value,
  124. daemonUser.in(Docker) := "root",
  125. maintainer.in(Docker) := "sourcekick",
  126. version.in(Docker) := version.value,
  127. dockerBaseImage := "openjdk:jre-alpine",
  128. dockerExposedPorts := Seq(8080),
  129. dockerExposedVolumes in Docker := Seq("/config"),
  130. mappings in Universal += {
  131. var appjar = (packageBin in Test).value
  132. appjar -> s"lib/${appjar.getName}"
  133. }
  134. )
  135. lazy val scalafmtSettings =
  136. Seq(
  137. scalafmtOnCompile := true,
  138. scalafmtOnCompile.in(Sbt) := false,
  139. scalafmtVersion := "1.5.1"
  140. )