-
Notifications
You must be signed in to change notification settings - Fork 75
/
build.sbt
147 lines (121 loc) · 3.9 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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
enablePlugins(JDKPackagerPlugin, JavaAppPackaging, SolidityPlugin)
import scala.sys.process.Process
// Necessary for the nix build, please do not remove.
val nixBuild = sys.props.isDefinedAt("nix")
val commonSettings = Seq(
name := "mantis",
version := "3.0",
scalaVersion := "2.12.12",
testOptions in Test += Tests
.Argument(TestFrameworks.ScalaTest, "-l", "EthashMinerSpec") // miner tests disabled by default
)
val malletDeps = Seq(
Dependencies.scopt
).flatten ++ Seq(
"org.jline" % "jline" % "3.16.0",
"net.java.dev.jna" % "jna" % "5.6.0"
)
val dep = {
Seq(
Dependencies.akka,
Dependencies.akkaHttp,
Dependencies.json4s,
Dependencies.circe,
Dependencies.boopickle,
Dependencies.rocksDb,
Dependencies.enumeratum,
Dependencies.testing,
Dependencies.cats,
Dependencies.monix,
Dependencies.twitterUtilCollection,
Dependencies.crypto,
Dependencies.scopt,
Dependencies.logging,
Dependencies.apacheCommons,
Dependencies.micrometer,
Dependencies.prometheus,
Dependencies.dependencies
).flatten ++ malletDeps
}
val Integration = config("it") extend Test
val Benchmark = config("benchmark") extend Test
val Evm = config("evm") extend Test
val Ets = config("ets") extend Test
val Snappy = config("snappy") extend Test
val Rpc = config("rpcTest") extend Test
val root = {
val root = project
.in(file("."))
.configs(Integration, Benchmark, Evm, Ets, Snappy, Rpc)
.settings(commonSettings: _*)
.settings(
libraryDependencies ++= dep
)
.settings(executableScriptName := name.value)
.settings(inConfig(Integration)(Defaults.testSettings): _*)
.settings(inConfig(Benchmark)(Defaults.testSettings): _*)
.settings(inConfig(Evm)(Defaults.testSettings): _*)
.settings(inConfig(Ets)(Defaults.testSettings): _*)
.settings(inConfig(Snappy)(Defaults.testSettings): _*)
.settings(inConfig(Rpc)(Defaults.testSettings): _*)
if (!nixBuild)
root
else
root.settings(PB.runProtoc in Compile := (args => Process("protoc", args) !))
}
scalacOptions := Seq(
"-unchecked",
"-deprecation",
"-feature",
"-Xfatal-warnings",
"-Xlint:unsound-match",
"-Ywarn-inaccessible",
"-Ywarn-unused-import",
"-encoding",
"utf-8"
)
scalacOptions in (Compile, console) ~= (_.filterNot(
Set(
"-Ywarn-unused-import",
"-Xfatal-warnings"
)
))
Test / parallelExecution := false
testOptions in Test += Tests.Argument("-oDG")
// protobuf compilation
PB.targets in Compile := Seq(
scalapb.gen() -> (sourceManaged in Compile).value
)
// have the protobuf API version file as a resource
unmanagedResourceDirectories in Compile += baseDirectory.value / "src" / "main" / "protobuf"
(test in Evm) := (test in Evm).dependsOn(solidityCompile).value
(sourceDirectory in Evm) := baseDirectory.value / "src" / "evmTest"
(scalastyleConfig in Test) := baseDirectory.value / "scalastyle-test-config.xml"
scalastyleSources in Test ++= { (unmanagedSourceDirectories in Integration).value }
// Packaging
mainClass in Compile := Some("io.iohk.ethereum.App")
Universal / executableScriptName := name.value
discoveredMainClasses in Compile := Seq()
// Requires the 'ant-javafx.jar' that comes with Oracle JDK
// Enables creating an executable with the configuration files, has to be run on the OS corresponding to the desired version
ThisBuild / jdkPackagerType := "image"
Universal / mappings += (resourceDirectory in Compile).value / "logback.xml" -> "conf/logback.xml"
val sep = java.io.File.separator
jdkPackagerJVMArgs := Seq(
"-Dconfig.file=." + sep + "conf" + sep + "mantis.conf",
"-Dlogback.configurationFile=." + sep + "conf" + sep + "logback.xml",
"-Xss10M"
)
coverageExcludedPackages := "io\\.iohk\\.ethereum\\.extvm\\.msg.*"
addCommandAlias(
"compile-all",
""";compile
|;test:compile
|;evm:compile
|;it:compile
|;ets:compile
|;rpcTest:compile
|;snappy:compile
|;benchmark:compile
|""".stripMargin
)