forked from databricks/sjsonnet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sbt
93 lines (84 loc) · 2.65 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
val sjsonnetVersion = "0.4.4"
val scala213 = "2.13.15"
val scala3 = "3.5.1"
val commonOptions: Seq[String] = Seq(
"-opt:l:inline",
"-opt-inline-from:sjsonnet.*,sjsonnet.**",
)
cancelable in Global := true
publish / skip := true
lazy val main = (project in file("sjsonnet"))
.settings(
name := "sjsonnet",
// Enable cross-compilation
scalaVersion := scala3,
crossScalaVersions := Seq(scala213, scala3),
scalacOptions ++= {
(CrossVersion.partialVersion(scalaVersion.value) match {
case Some((3, _)) =>
commonOptions ++ Seq(
// options dedicated for cross build / migration to Scala 3
"-source:3.5-migration"
)
case _ =>
commonOptions ++ Seq(
"-Xsource:3"
)
})
},
Test / fork := true,
Test / baseDirectory := (ThisBuild / baseDirectory).value,
libraryDependencies ++= Seq(
"com.lihaoyi" %% "fastparse" % "3.1.1",
"com.lihaoyi" %% "pprint" % "0.9.0",
"com.lihaoyi" %% "ujson" % "4.0.0",
"com.lihaoyi" %% "scalatags" % "0.12.0",
"com.lihaoyi" %% "os-lib" % "0.10.3",
"com.lihaoyi" %% "mainargs" % "0.7.5",
"org.lz4" % "lz4-java" % "1.8.0",
"org.json" % "json" % "20240303",
"org.scala-lang.modules" %% "scala-collection-compat" % "2.12.0",
"org.tukaani" % "xz" % "1.9",
"org.yaml" % "snakeyaml" % "2.0",
),
libraryDependencies ++= Seq(
"com.lihaoyi" %% "utest" % "0.8.3",
).map(_ % "test"),
testFrameworks += new TestFramework("utest.runner.Framework"),
(Compile / unmanagedSourceDirectories) := Seq(
baseDirectory.value / "src",
baseDirectory.value / "src-jvm",
baseDirectory.value / "src-jvm-native",
),
(Test / unmanagedSourceDirectories) := Seq(
baseDirectory.value / "test/src",
baseDirectory.value / "test/src-jvm",
baseDirectory.value / "test/src-jvm-native",
),
(Test / unmanagedResourceDirectories) := Seq(
baseDirectory.value / "test/resources",
),
(Compile / sourceGenerators) += Def.task {
val file = (Compile / sourceManaged).value / "jsonnet" / "Version.scala"
IO.write(file,
s"""package sjsonnet
|object Version{
| val version = "${sjsonnetVersion}"
|}
|""".stripMargin)
Seq(file)
}.taskValue
)
lazy val bench = (project in file("bench"))
.dependsOn(main % "compile->test")
.enablePlugins(JmhPlugin)
.settings(
run / fork := true,
// Do not cross-compile the benchmark
scalaVersion := scala3,
)
lazy val root = (project in file("."))
.aggregate(main)
.settings(
publishArtifact := false
)