build.sbt 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  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.akkaHttp,
  17. library.akkaHttpCirce,
  18. library.akkaSlf4j,
  19. library.akkaStream,
  20. library.logbackClassic,
  21. library.postgresql,
  22. library.scalateCore,
  23. library.slick,
  24. library.slickHikariCP,
  25. ),
  26. parallelExecution in Test := true
  27. )
  28. lazy val library =
  29. new {
  30. object Version {
  31. val akka = "2.5.22"
  32. val akkaHttp = "10.1.8"
  33. val akkaHttpCirce = "1.23.0"
  34. val logback = "1.2.3"
  35. val postgresql = "42.2.5"
  36. val scalate = "1.9.1"
  37. val slick = "3.3.0"
  38. }
  39. val akkaHttp = "com.typesafe.akka" %% "akka-http" % Version.akkaHttp
  40. val akkaHttpCirce = "de.heikoseeberger" %% "akka-http-circe" % Version.akkaHttpCirce
  41. val akkaSlf4j = "com.typesafe.akka" %% "akka-slf4j" % Version.akka
  42. val akkaStream = "com.typesafe.akka" %% "akka-stream" % Version.akka
  43. val logbackClassic = "ch.qos.logback" % "logback-classic" % Version.logback
  44. val postgresql = "org.postgresql" % "postgresql" % Version.postgresql
  45. val scalateCore = "org.scalatra.scalate" %% "scalate-core" % Version.scalate
  46. val slick = "com.typesafe.slick" %% "slick" % Version.slick
  47. val slickHikariCP = "com.typesafe.slick" %% "slick-hikaricp" % Version.slick
  48. }
  49. lazy val settings =
  50. commonSettings ++
  51. gitSettings ++
  52. packagingSettings ++
  53. scalafmtSettings
  54. lazy val commonSettings =
  55. Seq(
  56. organization := "net.benchmark.akka.http",
  57. organizationName := "Akka",
  58. scalaVersion := "2.12.8",
  59. scalacOptions ++= Seq(
  60. "-deprecation",
  61. "-encoding",
  62. "UTF-8",
  63. "-explaintypes",
  64. "-feature",
  65. "-target:jvm-1.8",
  66. "-unchecked",
  67. "-Xfatal-warnings",
  68. "-Xfuture",
  69. "-Xlint",
  70. "-Ydelambdafy:method",
  71. "-Yno-adapted-args",
  72. "-Ypartial-unification",
  73. "-Ywarn-numeric-widen",
  74. "-Ywarn-unused-import",
  75. "-Ywarn-value-discard"
  76. ),
  77. scalacOptions in (Compile, console) --= Seq("-Xfatal-warnings"), // Relax settings for console
  78. scalacOptions in (Test, console) --= Seq("-Xfatal-warnings"), // Relax settings for console
  79. javacOptions ++= Seq(
  80. "-encoding",
  81. "UTF-8",
  82. "-source",
  83. "1.8",
  84. "-target",
  85. "1.8"
  86. ),
  87. javaOptions ++= Seq(
  88. "-jvm-debug 5555"
  89. ),
  90. transitiveClassifiers := Seq("sources"),
  91. publishArtifact in (Compile, packageDoc) := false,
  92. unmanagedSourceDirectories.in(Compile) := Seq(scalaSource.in(Compile).value),
  93. unmanagedSourceDirectories.in(Test) := Seq(scalaSource.in(Test).value),
  94. wartremoverWarnings in (Compile, compile) ++= Warts.unsafe
  95. )
  96. lazy val gitSettings =
  97. Seq(
  98. git.useGitDescribe := true
  99. )
  100. lazy val packagingSettings =
  101. Seq(
  102. mappings in Universal += {
  103. // we are using the reference.conf as default application.conf
  104. // the user can override settings here
  105. val conf = (resourceDirectory in Compile).value / "reference.conf"
  106. conf -> "conf/application.conf"
  107. },
  108. scriptClasspath := Seq("../conf/") ++ scriptClasspath.value,
  109. daemonUser.in(Docker) := "root",
  110. maintainer.in(Docker) := "sourcekick",
  111. version.in(Docker) := version.value,
  112. dockerBaseImage := "openjdk:jre-alpine",
  113. dockerExposedPorts := Seq(8080),
  114. dockerExposedVolumes in Docker := Seq("/config"),
  115. mappings in Universal += {
  116. var appjar = (packageBin in Test).value
  117. appjar -> s"lib/${appjar.getName}"
  118. }
  119. )
  120. lazy val scalafmtSettings =
  121. Seq(
  122. scalafmtOnCompile := true,
  123. scalafmtOnCompile.in(Sbt) := false,
  124. scalafmtVersion := "1.5.1"
  125. )