Testing out JmonkeyEngine to make a game in Scala with Akka Actors within a pure FP layer
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

192 lines
8.4 KiB

4 years ago
  1. // The simplest possible sbt build file is just one line:
  2. scalaVersion := "2.13.3"
  3. // That is, to create a valid sbt build, all you've got to do is define the
  4. // version of Scala you'd like your project to use.
  5. // ============================================================================
  6. // Lines like the above defining `scalaVersion` are called "settings". Settings
  7. // are key/value pairs. In the case of `scalaVersion`, the key is "scalaVersion"
  8. // and the value is "2.13.1"
  9. // It's possible to define many kinds of settings, such as:
  10. // Note, it's not required for you to define these three settings. These are
  11. // mostly only necessary if you intend to publish your library's binaries on a
  12. // place like Sonatype or Bintray.
  13. // Want to use a published library in your project?
  14. // You can define other libraries as dependencies in your build like this:
  15. resolvers += "Jcenter" at "https://jcenter.bintray.com/"
  16. resolvers += "JME Bintray" at "https://bintray.com/jmonkeyengine/com.jme3"
  17. resolvers += Resolver.mavenLocal
  18. resolvers += Resolver.sonatypeRepo("snapshots")
  19. lazy val jmeVersion = "3.3.2-stable"
  20. lazy val osName = System.getProperty("os.name") match {
  21. case n if n.startsWith("Linux") => "linux"
  22. case n if n.startsWith("Mac") => "mac"
  23. case n if n.startsWith("Windows") => "win"
  24. case _ => throw new Exception("Unknown platform!")
  25. }
  26. lazy val javaFXModules =
  27. Seq("base", "controls", "fxml", "graphics", "media", "swing", "web")
  28. lazy val root = (project in file(".")).settings(
  29. inThisBuild(
  30. List(
  31. scalaVersion := scalaVersion.value, // 2.11.12, or 2.13.3
  32. semanticdbEnabled := true, // enable SemanticDB
  33. semanticdbVersion := "4.3.24" // use Scalafix compatible version
  34. )
  35. ),
  36. name := "mygame",
  37. organization := "wow.doge",
  38. version := "1.0-SNAPSHOT",
  39. libraryDependencies ++= Seq(
  40. "org.scala-lang.modules" %% "scala-parser-combinators" % "1.1.2",
  41. // https://mvnrepository.com/artifact/org.jmonkeyengine/jme3-core
  42. "org.jmonkeyengine" % "jme3-core" % jmeVersion,
  43. // https://mvnrepository.com/artifact/org.jmonkeyengine/jme3-desktop
  44. "org.jmonkeyengine" % "jme3-desktop" % jmeVersion,
  45. // https://mvnrepository.com/artifact/org.jmonkeyengine/jme3-lwjgl3
  46. "org.jmonkeyengine" % "jme3-lwjgl3" % jmeVersion,
  47. "org.jmonkeyengine" % "jme3-effects" % jmeVersion,
  48. "org.jmonkeyengine" % "jme3-plugins" % jmeVersion,
  49. "org.jmonkeyengine" % "jme3-blender" % jmeVersion,
  50. // https://mvnrepository.com/artifact/com.github.stephengold/Minie
  51. "com.github.stephengold" % "Minie" % "3.0.0",
  52. // https://mvnrepository.com/artifact/com.simsilica/zay-es
  53. "com.simsilica" % "zay-es" % "1.2.1",
  54. "org.typelevel" %% "cats-core" % "2.1.1",
  55. "com.lihaoyi" % "ammonite" % "2.2.0" cross CrossVersion.full,
  56. "org.jetbrains.kotlin" % "kotlin-main-kts" % "1.4.10",
  57. "org.jetbrains.kotlin" % "kotlin-scripting-jsr223" % "1.4.10",
  58. // "wow.doge" % "game" % "1.0-SNAPSHOT",
  59. "org.scalafx" %% "scalafx" % "14-R19",
  60. "com.typesafe.akka" %% "akka-actor-typed" % "2.6.10",
  61. "ch.qos.logback" % "logback-classic" % "1.2.3",
  62. "org.typelevel" %% "cats-core" % "2.1.1",
  63. "org.typelevel" %% "cats-effect" % "2.1.4",
  64. "io.monix" %% "monix" % "3.2.2",
  65. "io.monix" %% "monix-bio" % "1.0.0",
  66. "io.circe" %% "circe-core" % "0.13.0",
  67. "io.circe" %% "circe-generic" % "0.13.0",
  68. "com.softwaremill.sttp.client" %% "core" % "2.2.5",
  69. "com.softwaremill.sttp.client" %% "monix" % "2.2.5",
  70. "com.softwaremill.sttp.client" %% "circe" % "2.2.5",
  71. "com.softwaremill.sttp.client" %% "async-http-client-backend-monix" % "2.2.5",
  72. "com.github.valskalla" %% "odin-monix" % "0.8.1",
  73. "com.softwaremill.macwire" %% "util" % "2.3.7",
  74. "com.softwaremill.macwire" %% "macros" % "2.3.6" % "provided",
  75. "com.softwaremill.macwire" %% "macrosakka" % "2.3.6" % "provided",
  76. "com.github.valskalla" %% "odin-slf4j" % "0.8.1",
  77. "com.softwaremill.quicklens" %% "quicklens" % "1.6.1"
  78. ),
  79. // Determine OS version of JavaFX binaries
  80. // Add JavaFX dependencies
  81. libraryDependencies ++= javaFXModules.map(m =>
  82. "org.openjfx" % s"javafx-$m" % "14.0.1" classifier osName
  83. ),
  84. scalacOptions ++= Seq(
  85. "-encoding",
  86. "UTF-8",
  87. "-deprecation",
  88. "-feature",
  89. "-unchecked",
  90. "-Xlint",
  91. "-Ywarn-numeric-widen",
  92. "-Ymacro-annotations",
  93. // "utf-8", // Specify character encoding used by source files.
  94. "-explaintypes" // Explain type errors in more detail.
  95. ),
  96. javacOptions ++= Seq("-source", "11", "-target", "11"),
  97. javaOptions ++= Seq("-Xmx2G", "-Xms2G"),
  98. fork := true,
  99. assemblyMergeStrategy in assembly := {
  100. case PathList("javax", "servlet", xs @ _*) => MergeStrategy.first
  101. case PathList(ps @ _*) if ps.last endsWith ".html" => MergeStrategy.first
  102. case "application.conf" => MergeStrategy.concat
  103. case "unwanted.txt" => MergeStrategy.discard
  104. case x if Assembly.isConfigFile(x) =>
  105. MergeStrategy.concat
  106. case PathList("META-INF", xs @ _*) =>
  107. (xs map { _.toLowerCase }) match {
  108. case ("manifest.mf" :: Nil) | ("index.list" :: Nil) |
  109. ("dependencies" :: Nil) =>
  110. MergeStrategy.discard
  111. case ps @ (x :: xs)
  112. if ps.last.endsWith(".sf") || ps.last.endsWith(".dsa") =>
  113. MergeStrategy.discard
  114. case "plexus" :: xs =>
  115. MergeStrategy.discard
  116. case "services" :: xs =>
  117. MergeStrategy.filterDistinctLines
  118. case ("spring.schemas" :: Nil) | ("spring.handlers" :: Nil) =>
  119. MergeStrategy.filterDistinctLines
  120. case _ => MergeStrategy.first // Changed deduplicate to first
  121. }
  122. case PathList(_*) => MergeStrategy.first
  123. // case x =>
  124. // val oldStrategy = (assemblyMergeStrategy in assembly).value
  125. // oldStrategy(x)
  126. }
  127. // scalaVersion := "2.13.2", // 2.11.12, or 2.13.3
  128. // semanticdbEnabled := true, // enable SemanticDB
  129. // semanticdbVersion := scalafixSemanticdb.revision // use Scalafix compatible version
  130. // semanticdbVersion := "4.3.24",
  131. )
  132. // Here, `libraryDependencies` is a set of dependencies, and by using `+=`,
  133. // we're adding the scala-parser-combinators dependency to the set of dependencies
  134. // that sbt will go and fetch when it starts up.
  135. // Now, in any Scala file, you can import classes, objects, etc., from
  136. // scala-parser-combinators with a regular import.
  137. // TIP: To find the "dependency" that you need to add to the
  138. // `libraryDependencies` set, which in the above example looks like this:
  139. // "org.scala-lang.modules" %% "scala-parser-combinators" % "1.1.2"
  140. // You can use Scaladex, an index of all known published Scala libraries. There,
  141. // after you find the library you want, you can just copy/paste the dependency
  142. // information that you need into your build file. For example, on the
  143. // scala/scala-parser-combinators Scaladex page,
  144. // https://index.scala-lang.org/scala/scala-parser-combinators, you can copy/paste
  145. // the sbt dependency from the sbt box on the right-hand side of the screen.
  146. // IMPORTANT NOTE: while build files look _kind of_ like regular Scala, it's
  147. // important to note that syntax in *.sbt files doesn't always behave like
  148. // regular Scala. For example, notice in this build file that it's not required
  149. // to put our settings into an enclosing object or class. Always remember that
  150. // sbt is a bit different, semantically, than vanilla Scala.
  151. // ============================================================================
  152. // Most moderately interesting Scala projects don't make use of the very simple
  153. // build file style (called "bare style") used in this build.sbt file. Most
  154. // intermediate Scala projects make use of so-called "multi-project" builds. A
  155. // multi-project build makes it possible to have different folders which sbt can
  156. // be configured differently for. That is, you may wish to have different
  157. // dependencies or different testing frameworks defined for different parts of
  158. // your codebase. Multi-project builds make this possible.
  159. // Here's a quick glimpse of what a multi-project build looks like for this
  160. // build, with only one "subproject" defined, called `root`:
  161. // lazy val root = (project in file(".")).
  162. // settings(
  163. // inThisBuild(List(
  164. // organization := "ch.epfl.scala",
  165. // scalaVersion := "2.13.1"
  166. // )),
  167. // name := "hello-world"
  168. // )
  169. // To learn more about multi-project builds, head over to the official sbt
  170. // documentation at http://www.scala-sbt.org/documentation.html