build.sbt 3.2 KB

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