build.sbt 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. def commonSettings = Seq(
  2. scalaVersion := "2.13.3",
  3. version := "0.1.0",
  4. )
  5. lazy val server: Project = (project in file("server"))
  6. .settings(commonSettings)
  7. .settings(
  8. scalaJSProjects := Seq(client),
  9. pipelineStages in Assets := Seq(scalaJSPipeline),
  10. compile in Compile := ((compile in Compile) dependsOn scalaJSPipeline).value,
  11. javaOptions in Test += "-Dconfig.file=conf/testing.conf",
  12. libraryDependencies ++= Seq(
  13. guice,
  14. "codes.reactive" %% "scala-time" % "0.4.2",
  15. // OAuth
  16. "com.nulab-inc" %% "scala-oauth2-core" % "1.5.0",
  17. "com.nulab-inc" %% "play2-oauth2-provider" % "1.5.0",
  18. "com.github.t3hnar" %% "scala-bcrypt" % "4.3.0",
  19. // Client Libraries
  20. "com.vmunier" %% "scalajs-scripts" % "1.1.4",
  21. "org.webjars" %% "webjars-play" % "2.8.0",
  22. "org.webjars" % "jquery" % "3.4.1",
  23. "org.webjars" % "bootstrap" % "4.4.1-1",
  24. // Mogno + ORM
  25. "org.mongodb.scala" %% "mongo-scala-driver" % "4.1.0",
  26. // Testing
  27. specs2 % Test,
  28. "org.scalatestplus.play" %% "scalatestplus-play" % "5.0.0" % Test
  29. )
  30. )
  31. .enablePlugins(PlayScala)
  32. .dependsOn(sharedJvm)
  33. .dependsOn(fdcJvm)
  34. import com.tflucke.webroutes.endpoints.PlayEndpointFile
  35. lazy val client = (project in file("client"))
  36. .settings(commonSettings)
  37. .settings(
  38. scalaJSUseMainModuleInitializer := true,
  39. Compile / apiDefinitions += PlayEndpointFile(server),
  40. libraryDependencies += "org.querki" %%% "jquery-facade" % "2.0",
  41. libraryDependencies += "in.nvilla" %%% "monadic-html" % "0.4.1",
  42. libraryDependencies += "in.nvilla" %%% "monadic-rx-cats" % "0.4.1",
  43. // libraryDependencies += "com.thoughtworks.binding" %%% "binding" % "12.0.1+8-8f3c7f31",
  44. // libraryDependencies += "org.lrng.binding" %%% "html" % "1.0.3",
  45. // libraryDependencies += "org.scala-lang.modules" %%% "scala-xml" % "2.0.0-M2",
  46. scalacOptions ++= {
  47. import Ordering.Implicits._
  48. if (VersionNumber(scalaVersion.value).numbers >= Seq(2L, 13L))
  49. Seq("-Ymacro-annotations")
  50. else Nil
  51. }
  52. )
  53. .enablePlugins(ScalaJSPlugin, RestRPC, ScalaJSWeb)
  54. .dependsOn(sharedJs)
  55. .dependsOn(fdcJs)
  56. lazy val shared = crossProject(JSPlatform, JVMPlatform)
  57. .in(file("shared"))
  58. .settings(commonSettings)
  59. .settings(
  60. libraryDependencies += "com.typesafe.play" %%% "play-json" % "2.9.2",
  61. // Temporary workaround due to mongodb limitations
  62. libraryDependencies += "org.julienrf" %%% "play-json-derived-codecs" % "8.0.0"
  63. )
  64. .jsConfigure(_ enablePlugins ScalaJSWeb)
  65. lazy val sharedJvm = shared.jvm.dependsOn(fdcJvm).settings(
  66. libraryDependencies += "org.mongodb.scala" %% "mongo-scala-bson" % "4.1.0"
  67. )
  68. lazy val sharedJs = shared.js.dependsOn(fdcJs)
  69. lazy val fdc = crossProject(JSPlatform, JVMPlatform)
  70. .in(file("fdc"))
  71. .settings(commonSettings)
  72. .settings(
  73. libraryDependencies += "com.typesafe.play" %% "play-json" % "2.9.2",
  74. libraryDependencies += "com.tflucke" %%% "rest-rpc" % "0.3.1"
  75. )
  76. lazy val fdcJs = fdc.js
  77. lazy val fdcJvm = fdc.jvm
  78. // loads the server project at sbt startup
  79. onLoad in Global := (onLoad in Global).value.andThen(
  80. state => "project server" :: state
  81. )