-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathbuild.sbt
More file actions
104 lines (98 loc) · 2.58 KB
/
build.sbt
File metadata and controls
104 lines (98 loc) · 2.58 KB
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
94
95
96
97
98
99
100
101
102
103
104
def scala212 = "2.12.20"
def scala3 = "3.8.2"
inThisBuild(
List(
organization := "org.scalameta",
homepage := Some(url("https://github.com/scalameta/sbt-native-image")),
licenses :=
List("Apache-2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0")),
developers :=
List(
Developer(
"olafurpg",
"Ólafur Páll Geirsson",
"olafurpg@gmail.com",
url("https://geirsson.com")
)
),
scalaVersion := scala212,
scalafixCaching := true,
semanticdbEnabled := true,
semanticdbVersion := "4.13.9"
)
)
crossScalaVersions := Nil
publish / skip := true
commands +=
Command.command("fixAll") { s =>
"scalafixAll" :: "+ scalafmtAll" :: "scalafmtSbt" :: s
}
commands +=
Command.command("checkAll") { s =>
"+ scalafmtCheckAll" :: "scalafmtSbtCheck" :: "scalafixAll --check" ::
"+ publishLocal" :: s
}
lazy val plugin = project
.in(file("plugin"))
.enablePlugins(SbtPlugin, BuildInfoPlugin)
.settings(
moduleName := "sbt-native-image",
addSbtPlugin("com.github.sbt" % "sbt2-compat" % "0.1.0"),
scalacOptions ++= {
scalaBinaryVersion.value match {
case "2.12" =>
Seq(
"-release:8",
"-Xlint",
"-Ywarn-unused-import",
"-Werror",
"-Xsource:3",
"-feature"
)
case "3" =>
Nil
}
},
(pluginCrossBuild / sbtVersion) := {
scalaBinaryVersion.value match {
case "2.12" =>
"1.5.8"
case _ =>
"2.0.0-RC10"
}
},
scriptedSbt := {
scalaBinaryVersion.value match {
case "2.12" =>
"1.10.6"
case _ =>
(pluginCrossBuild / sbtVersion).value
}
},
crossScalaVersions := List(scala212, scala3),
buildInfoPackage := "sbtnativeimage",
buildInfoKeys := Seq[BuildInfoKey](version),
scriptedBufferLog := false,
scriptedLaunchOpts ++=
Seq("-Xmx2048M", s"-Dplugin.version=${version.value}")
)
lazy val example = project
.in(file("example"))
.settings(
publish / skip := true,
Compile / mainClass := Some("example.Hello"),
test := {
val binary = nativeImage.value
val output = scala.sys.process.Process(List(binary.toString)).!!.trim
assert(output == "List(1, 2, 3)", output)
},
scalacOptions ++= {
scalaBinaryVersion.value match {
case "2.12" =>
Seq("-release:8", "-Xlint", "-Ywarn-unused-import", "-Werror")
case "3" =>
Nil
}
}
)
.enablePlugins(NativeImagePlugin)