build.sbt 4.3 KB

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