forked from bamarsha/superposition
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.sbt
76 lines (67 loc) · 2.64 KB
/
build.sbt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
import java.nio.file.Files.copy
import java.nio.file.StandardCopyOption.REPLACE_EXISTING
import scala.reflect.io.Directory
import scala.sys.process.stringSeqToProcess
name := "Superposition"
version := "0.2-SNAPSHOT"
ThisBuild / scalaVersion := "2.13.2"
Compile / scalacOptions ++= Seq(
"-Xsource:3",
"-Ymacro-annotations",
"-opt:l:method",
// TODO:
// "-opt:l:inline",
// "-opt-inline-from:**",
"-feature",
"-deprecation")
Compile / scalaSource := baseDirectory.value / "src"
Compile / resourceDirectory := baseDirectory.value / "resources"
resolvers += "Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots"
libraryDependencies += "com.badlogicgames.ashley" % "ashley" % "1.7.3"
libraryDependencies ++= {
val version = "1.9.11-SNAPSHOT"
Seq(
"com.badlogicgames.gdx" % "gdx" % version,
"com.badlogicgames.gdx" % "gdx-backend-lwjgl3" % version,
"com.badlogicgames.gdx" % "gdx-platform" % version classifier "natives-desktop")
}
libraryDependencies += "com.beachape" %% "enumeratum" % "1.6.0"
libraryDependencies += "io.estatico" %% "newtype" % "0.4.4"
libraryDependencies += "org.scala-lang.modules" %% "scala-parser-combinators" % "1.1.2"
libraryDependencies += "org.typelevel" %% "cats-core" % "2.0.0"
libraryDependencies += "org.typelevel" %% "spire" % "0.17.0-M1"
assemblyMergeStrategy in assembly := {
case PathList("META-INF", "versions", "9", "module-info.class") => MergeStrategy.first
case path => (assemblyMergeStrategy in assembly).value(path)
}
val appImage = taskKey[File]("Creates an application image.")
appImage := {
val log = streams.value.log
val originalJar = assembly.value
val jarMainClass = (assembly / mainClass).value
val baseDir = originalJar.getParentFile / "app-image"
val inputDir = baseDir / "input"
val destDir = baseDir / "dest"
val inputJar = inputDir / originalJar.getName
if (originalJar.lastModified <= destDir.lastModified) {
log.info(s"Application image is already up-to-date in: ${destDir.getAbsolutePath}")
} else {
// jpackage needs this directory to be empty.
Directory(destDir).deleteRecursively()
inputDir.mkdirs()
copy(originalJar.toPath, inputJar.toPath, REPLACE_EXISTING)
assert(
Seq("jpackage",
"--type", "app-image",
"--input", inputDir.getAbsolutePath,
"--dest", destDir.getAbsolutePath,
"--name", name.value,
"--main-jar", inputJar.getName,
"--main-class", jarMainClass.get,
"--java-options", "-XX:+UseParallelGC")
.! == 0,
"Running jpackage failed.")
log.info(s"Created application image in: ${destDir.getAbsolutePath}")
}
destDir
}