-
Notifications
You must be signed in to change notification settings - Fork 8
/
build.sbt
58 lines (54 loc) · 2.23 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
import java.io.File
import java.nio.file.{Files, StandardCopyOption}
import sbt.TupleSyntax.t2ToTable2
val copyNativeImageConfigs = taskKey[Unit]("Copy native-image configurations to target")
copyNativeImageConfigs := ((baseDirectory, target) map { (base, trg) =>
{
Some(new File(trg, "native-image/META-INF/native-image").toPath)
.filterNot(p => Files.isDirectory(p))
.foreach(p => Files.createDirectories(p))
new File(base, "META-INF/native-image")
.listFiles()
.foreach(file =>
Files.copy(
file.toPath,
new File(trg, s"native-image/META-INF/native-image/${file.getName}").toPath,
StandardCopyOption.REPLACE_EXISTING
)
)
}
}).value
lazy val root = (project in file("."))
.enablePlugins(GitVersioning, BuildInfoPlugin, NativeImagePlugin)
.settings(
name := """my-photo-timeline""",
organization := "net.wiringbits",
scalaVersion := "2.13.8",
fork in Test := true,
buildInfoKeys := Seq[BuildInfoKey](name, version, scalaVersion, sbtVersion, git.baseVersion, git.gitHeadCommit),
buildInfoPackage := "net.wiringbits.myphototimeline",
buildInfoUsePackageAsPath := true,
libraryDependencies ++= Seq(
"com.lihaoyi" %% "os-lib" % "0.8.1",
"com.lihaoyi" %% "fansi" % "0.3.1",
"com.google.guava" % "guava" % "28.0-jre",
"com.drewnoakes" % "metadata-extractor" % "2.16.0",
"com.monovore" %% "decline" % "2.2.0",
"org.scalatest" %% "scalatest" % "3.2.11" % Test
),
Compile / mainClass := Some("net.wiringbits.myphototimeline.Main"),
nativeImageOptions ++= List(
"--no-fallback",
"-H:+AddAllCharsets"
),
// To generate this file, run "sbt console",
// and then, "net.wiringbits.myphototimeline.util.GenerateNativeReflectionConfig.generateConfigFile()"
// That's enough to regenerated the config file.
//
// TODO: Generate such config automatically before building the native image
nativeImageOptions ++= List(
"-H:ReflectionConfigurationFiles=META-INF/native-image/metadata-extractor-reflect-config.json",
"-H:ResourceConfigurationFiles=META-INF/native-image/resource-config.json"
),
nativeImage := (nativeImage dependsOn copyNativeImageConfigs).value
)