-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
53 lines (46 loc) · 1.29 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
// import to add Scala Native options
import scala.scalanative.build._
name := "scala rust interoperability"
// defaults set with common options shown
nativeConfig ~= { c =>
c.withLTO(LTO.none) // thin
.withMode(Mode.debug) // releaseFast
.withGC(GC.immix) // commix
}
lazy val commonSettings = Seq(
organization := "com.native",
scalaVersion := "3.5.2",
logLevel := Level.Info /*,
scalacOptions ++= List(
"-Wunused"
)*/
)
lazy val root = (project in file("."))
.settings(commonSettings)
.aggregate(scalaModule)
lazy val scalaModule = project
.in(file("scala-module"))
.enablePlugins(ScalaNativePlugin)
.settings(commonSettings)
.dependsOn(rustModule)
.aggregate(rustModule)
.settings(
nativeConfig := {
nativeConfig.value
.withLinkingOptions(
Seq(
s"-L${baseDirectory.value.getParentFile}/rust-module/target/release/",
"-lrust_code"
)
)
},
libraryDependencies ++= Seq(
"org.scalameta" %% "munit" % "1.0.2" % Test,
"org.scalameta" %% "munit-scalacheck" % "1.0.0" % Test
)
)
lazy val rustModule = project
.in(file("rust-module"))
.settings(commonSettings)
addCommandAlias("checkFormat", ";scalafmtSbtCheck ;scalafmtCheckAll")
addCommandAlias("scalafixLint", ";compile ;scalafix")