build.sbt 4.3 KB

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