build.sbt 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. def commonSettings = Seq(
  2. scalaVersion := "2.13.3",
  3. version := "0.1.0",
  4. scalacOptions ++= Seq(
  5. "-deprecation",
  6. "-unchecked",
  7. "-feature",
  8. "-Xlint:-unused,_",
  9. "-Ywarn-unused:imports",
  10. "-Ywarn-macros:after",
  11. )
  12. )
  13. lazy val server: Project = (project in file("server"))
  14. .settings(commonSettings)
  15. .settings(
  16. scalaJSProjects := Seq(client),
  17. Assets / pipelineStages := Seq(scalaJSPipeline),
  18. Compile / compile := ((Compile / compile) dependsOn scalaJSPipeline).value,
  19. Test / javaOptions += "-Dconfig.file=conf/testing.conf",
  20. libraryDependencies ++= Seq(
  21. guice,
  22. "codes.reactive" %% "scala-time" % "0.4.2",
  23. // OAuth
  24. "com.nulab-inc" %% "scala-oauth2-core" % "1.5.0",
  25. "com.nulab-inc" %% "play2-oauth2-provider" % "1.5.0",
  26. "com.github.t3hnar" %% "scala-bcrypt" % "4.3.0",
  27. // Client Libraries
  28. "com.vmunier" %% "scalajs-scripts" % "1.1.4",
  29. "org.webjars" %% "webjars-play" % "2.8.0",
  30. "org.webjars" % "jquery" % "3.4.1",
  31. "org.webjars" % "bootstrap" % "4.4.1-1",
  32. "org.webjars" % "jquery-ui" % "1.12.1",
  33. "org.webjars.npm" % "sortablejs" % "1.13.0",
  34. // Mogno + ORM
  35. "org.mongodb.scala" %% "mongo-scala-driver" % "4.1.0",
  36. //"com.scalableminds" %% "mongev" % "0.5.0",
  37. //"com.scalableminds" %% "mongev" % "0.5.0",
  38. // Testing
  39. specs2 % Test,
  40. "org.scalatestplus.play" %% "scalatestplus-play" % "5.0.0" % Test
  41. )
  42. )
  43. .enablePlugins(PlayScala)
  44. .dependsOn(sharedJvm)
  45. .dependsOn(fdcJvm)
  46. import com.tflucke.webroutes.endpoints.PlayEndpointFile
  47. import org.scalajs.linker.interface.ModuleInitializer
  48. lazy val client = (project in file("webClient"))
  49. .settings(commonSettings)
  50. .settings(
  51. //scalaJSMainModuleInitializer := Some(ModuleInitializer.mainMethod("com.weEat.Main", "main").withModuleID("we-eat")),
  52. scalaJSUseMainModuleInitializer := true,
  53. libraryDependencies ++= Seq(
  54. "net.exoego" %%% "scalajs-jquery3" % "2.2.0",
  55. "com.raquo" %%% "laminar" % "0.14.2",
  56. "io.laminext" %%% "core" % "0.16.2",
  57. "com.tflucke" %%% "typeahead-scala" % "0.2.2",
  58. "com.tflucke" %%% "sortablejs-facade" % "1.13.0",
  59. "org.scala-js" %%% "scala-js-macrotask-executor" % "1.0.0",
  60. "com.raquo" %%% "waypoint" % "7.0.0",
  61. ),
  62. scalacOptions ++= {
  63. import Ordering.Implicits._
  64. if (VersionNumber(scalaVersion.value).numbers >= Seq(2L, 13L))
  65. Seq("-Ymacro-annotations")
  66. else Nil
  67. }
  68. )
  69. .enablePlugins(ScalaJSPlugin, ScalaJSWeb)
  70. .dependsOn(sharedJs)
  71. .dependsOn(fdcJs)
  72. lazy val shared = crossProject(JSPlatform, JVMPlatform)
  73. .in(file("shared"))
  74. .settings(commonSettings)
  75. .settings(
  76. Compile / apiDefinitions += PlayEndpointFile(server),
  77. libraryDependencies += "com.typesafe.play" %%% "play-json" % "2.9.2",
  78. // Temporary workaround due to mongodb limitations
  79. libraryDependencies += "org.julienrf" %%% "play-json-derived-codecs" % "8.0.0"
  80. )
  81. .enablePlugins(RestRPC)
  82. .jsConfigure(_ enablePlugins ScalaJSWeb)
  83. lazy val sharedJvm = shared.jvm.dependsOn(fdcJvm).settings(
  84. libraryDependencies += "org.mongodb.scala" %% "mongo-scala-bson" % "4.1.0"
  85. )
  86. lazy val sharedJs = shared.js.dependsOn(fdcJs).settings(
  87. libraryDependencies ++= Seq(
  88. "org.scala-js" %%% "scala-js-macrotask-executor" % "1.0.0",
  89. "io.github.cquiroz" %%% "scala-java-time" % "2.2.2",
  90. "io.github.cquiroz" %%% "scala-java-time-tzdb" % "2.2.2",
  91. )
  92. )
  93. lazy val fdc = crossProject(JSPlatform, JVMPlatform)
  94. .in(file("fdc"))
  95. .settings(commonSettings)
  96. .settings(
  97. libraryDependencies += "com.typesafe.play" %% "play-json" % "2.9.2",
  98. libraryDependencies += "com.tflucke" %%% "rest-rpc" % "0.3.2"
  99. )
  100. lazy val fdcJs = fdc.js
  101. lazy val fdcJvm = fdc.jvm
  102. // loads the server project at sbt startup
  103. Global / onLoad := (Global / onLoad).value.andThen(
  104. state => "project server" :: state
  105. )