-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.sbt
77 lines (71 loc) · 2.2 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
77
import BuildSettings._
ThisBuild / scalaVersion := "3.3.4"
ThisBuild / versionScheme := Some("semver-spec")
lazy val root = Project(id = "better-xdg", base = file("."))
.aggregate(
basedir,
basedirTests2
)
.settings(publish / skip := true)
.disablePlugins(HeaderPlugin)
lazy val basedir = module("basedir")
.settings(Dependencies.basedir)
.settings(
Test / fork := true,
Test / forkOptions := {
val testDirs = (Test / sourceDirectory).value / "dirs"
ForkOptions()
.withEnvVars(
fileVars(
Map(
"XDG_DATA_HOME" -> testDirs / "home" / "local" / "share",
"XDG_CONFIG_HOME" -> testDirs / "home" / "config"
)
) ++ dirsVars(
Map(
"XDG_DATA_DIRS" -> Seq(
testDirs / "usr" / "local" / "share",
testDirs / "usr" / "share"
),
"XDG_CONFIG_DIRS" -> Seq(
testDirs / "etc" / "xdg",
testDirs / "usr" / "share" / "settings" / "xdg"
)
)
)
)
.withRunJVMOptions(Vector("-Dtest.conf1=sysprops"))
}
)
lazy val basedirTests2 = module("basedir-tests2")
.dependsOn(basedir % "test->test")
.settings(
Test / fork := true,
Test / forkOptions := {
val testDirs = (Test / sourceDirectory).value / "dirs"
ForkOptions()
.withEnvVars(
fileVars(
Map(
"XDG_DATA_HOME" -> testDirs / "home" / "local" / "share",
"XDG_CONFIG_HOME" -> testDirs / "home" / "config"
)
) ++ dirsVars(
Map(
"XDG_DATA_DIRS" -> Seq(
testDirs / "usr" / "local" / "share",
testDirs / "usr" / "share"
),
"XDG_CONFIG_DIRS" -> Seq(
testDirs / "etc" / "xdg",
testDirs / "usr" / "share" / "settings" / "xdg"
)
)
)
)
}
)
def fileVars(vars: Map[String, File]): Map[String, String] =
vars.mapValues(_.toString)
def dirsVars(vars: Map[String, Seq[File]]): Map[String, String] =
vars.mapValues(_.map(_.toString).mkString(java.io.File.pathSeparator))