@@ -9,70 +9,126 @@ val nixBuild = sys.props.isDefinedAt("nix")
9
9
// Enable dev mode: disable certain flags, etc.
10
10
val mantisDev = sys.props.get(" mantisDev" ).contains(" true" ) || sys.env.get(" MANTIS_DEV" ).contains(" true" )
11
11
12
- val commonSettings = Seq (
13
- name := " mantis" ,
12
+ def commonSettings ( projectName : String ) : Seq [sbt. Def . Setting [_]] = Seq (
13
+ name := s " mantis- ${projectName} " ,
14
14
version := " 3.1.0" ,
15
15
scalaVersion := " 2.12.12" ,
16
16
// Scalanet snapshots are published to Sonatype after each build.
17
17
resolvers += " Sonatype OSS Snapshots" at " https://oss.sonatype.org/content/repositories/snapshots" ,
18
18
testOptions in Test += Tests
19
- .Argument (TestFrameworks .ScalaTest , " -l" , " EthashMinerSpec" ) // miner tests disabled by default
20
- )
19
+ .Argument (TestFrameworks .ScalaTest , " -l" , " EthashMinerSpec" ), // miner tests disabled by default,
20
+
21
+ scalacOptions := Seq (
22
+ " -unchecked" ,
23
+ " -deprecation" ,
24
+ " -feature" ,
25
+ " -Xfatal-warnings" ,
26
+ " -Xlint:unsound-match" ,
27
+ " -Ywarn-inaccessible" ,
28
+ " -Ywarn-unused-import" ,
29
+ " -Ypartial-unification" ,
30
+ " -encoding" ,
31
+ " utf-8"
32
+ ),
33
+
34
+ scalacOptions in (Compile , console) ~= (_.filterNot(
35
+ Set (
36
+ " -Ywarn-unused-import" ,
37
+ " -Xfatal-warnings"
38
+ )
39
+ )),
40
+
41
+ scalacOptions ~= (options => if (mantisDev) options.filterNot(_ == " -Xfatal-warnings" ) else options),
21
42
22
- val malletDeps = Seq (
23
- Dependencies .scopt
24
- ).flatten ++ Seq (
25
- Dependencies .jline,
26
- Dependencies .jna
43
+ Test / parallelExecution := true ,
44
+
45
+ testOptions in Test += Tests . Argument ( " -oDG " ),
46
+
47
+ (scalastyleConfig in Test ) := file( " scalastyle-test-config.xml " )
27
48
)
28
49
29
- val dep = {
30
- Seq (
31
- Dependencies .akka,
32
- Dependencies .akkaHttp,
33
- Dependencies .json4s,
34
- Dependencies .circe,
35
- Dependencies .boopickle,
36
- Dependencies .rocksDb,
37
- Dependencies .enumeratum,
38
- Dependencies .testing,
39
- Dependencies .cats,
40
- Dependencies .monix,
41
- Dependencies .network,
42
- Dependencies .twitterUtilCollection,
43
- Dependencies .crypto,
44
- Dependencies .scopt,
45
- Dependencies .logging,
46
- Dependencies .apacheCommons,
47
- Dependencies .micrometer,
48
- Dependencies .prometheus,
49
- Dependencies .cli,
50
- Dependencies .dependencies
51
- ).flatten ++ malletDeps
50
+ lazy val rlp = {
51
+ // Adding an "it" config because in `Dependencies.scala` some are declared with `% "it,test"`
52
+ // which would fail if the project didn't have configuration to add to.
53
+ val Integration = config(" it" ) extend Test
54
+
55
+ val rlp = project
56
+ .in(file(" rlp" ))
57
+ .configs(Integration )
58
+ .settings(commonSettings(" rlp" ))
59
+ .settings(
60
+ libraryDependencies ++=
61
+ Dependencies .akkaUtil ++
62
+ Dependencies .shapeless ++
63
+ Dependencies .testing
64
+ )
65
+
66
+ rlp
52
67
}
53
68
54
- val Integration = config( " it " ) extend Test
69
+ lazy val node = {
55
70
56
- val Benchmark = config(" benchmark " ) extend Test
71
+ val Integration = config(" it " ) extend Test
57
72
58
- val Evm = config(" evm " ) extend Test
73
+ val Benchmark = config(" benchmark " ) extend Test
59
74
60
- val Ets = config(" ets " ) extend Test
75
+ val Evm = config(" evm " ) extend Test
61
76
62
- val Snappy = config(" snappy " ) extend Test
77
+ val Ets = config(" ets " ) extend Test
63
78
64
- val Rpc = config(" rpcTest " ) extend Test
79
+ val Snappy = config(" snappy " ) extend Test
65
80
66
- val root = {
67
- val root = project
81
+ val Rpc = config(" rpcTest" ) extend Test
82
+
83
+ val malletDeps = Seq (
84
+ Dependencies .scopt
85
+ ).flatten ++ Seq (
86
+ Dependencies .jline,
87
+ Dependencies .jna
88
+ )
89
+
90
+ val dep = {
91
+ Seq (
92
+ Dependencies .akka,
93
+ Dependencies .akkaHttp,
94
+ Dependencies .json4s,
95
+ Dependencies .circe,
96
+ Dependencies .boopickle,
97
+ Dependencies .rocksDb,
98
+ Dependencies .enumeratum,
99
+ Dependencies .testing,
100
+ Dependencies .cats,
101
+ Dependencies .monix,
102
+ Dependencies .network,
103
+ Dependencies .twitterUtilCollection,
104
+ Dependencies .crypto,
105
+ Dependencies .scopt,
106
+ Dependencies .logging,
107
+ Dependencies .apacheCommons,
108
+ Dependencies .micrometer,
109
+ Dependencies .prometheus,
110
+ Dependencies .cli,
111
+ Dependencies .dependencies
112
+ ).flatten ++ malletDeps
113
+ }
114
+
115
+ scalastyleSources in Test ++= { (unmanagedSourceDirectories in Integration ).value }
116
+
117
+ (test in Evm ) := (test in Evm ).dependsOn(solidityCompile).value
118
+ (sourceDirectory in Evm ) := baseDirectory.value / " src" / " evmTest"
119
+
120
+ val sep = java.io.File .separator
121
+
122
+ val node = project
68
123
.in(file(" ." ))
69
124
.configs(Integration , Benchmark , Evm , Ets , Snappy , Rpc )
70
125
.enablePlugins(BuildInfoPlugin )
126
+ .dependsOn(rlp)
71
127
.settings(
72
128
buildInfoKeys := Seq [BuildInfoKey ](name, version, git.gitHeadCommit),
73
129
buildInfoPackage := " io.iohk.ethereum.utils"
74
130
)
75
- .settings(commonSettings : _* )
131
+ .settings(commonSettings( " node " ) : _* )
76
132
.settings(
77
133
libraryDependencies ++= dep
78
134
)
@@ -88,80 +144,50 @@ val root = {
88
144
.settings(inConfig(Ets )(Defaults .testSettings :+ (Test / parallelExecution := false )): _* )
89
145
.settings(inConfig(Snappy )(Defaults .testSettings :+ (Test / parallelExecution := false )): _* )
90
146
.settings(inConfig(Rpc )(Defaults .testSettings :+ (Test / parallelExecution := false )): _* )
147
+ .settings(
148
+ // protobuf compilation
149
+ // Into a subdirectory of src_managed to avoid it deleting other generated files; see https://github.com/sbt/sbt-buildinfo/issues/149
150
+ PB .targets in Compile := Seq (
151
+ scalapb.gen() -> (sourceManaged in Compile ).value / " protobuf"
152
+ ),
153
+
154
+ // have the protobuf API version file as a resource
155
+ unmanagedResourceDirectories in Compile += baseDirectory.value / " src" / " main" / " protobuf" ,
156
+
157
+ // Packaging
158
+ mainClass in Compile := Some (" io.iohk.ethereum.App" ),
159
+ executableScriptName := name.value,
160
+ discoveredMainClasses in Compile := Seq (),
161
+ // Requires the 'ant-javafx.jar' that comes with Oracle JDK
162
+ // Enables creating an executable with the configuration files, has to be run on the OS corresponding to the desired version
163
+ ThisBuild / jdkPackagerType := " image" ,
164
+
165
+ mappings in Universal += (resourceDirectory in Compile ).value / " logback.xml" -> " conf/logback.xml" ,
166
+ mappings in Universal += (resourceDirectory in Compile ).value / " application.conf" -> " conf/base.conf" ,
167
+ mappings in Universal ++= directory((resourceDirectory in Compile ).value / " chains" ).map { case (f, name) =>
168
+ f -> s " conf/ $name"
169
+ },
170
+
171
+ jdkPackagerJVMArgs := Seq (
172
+ " -Dconfig.file=." + sep + " conf" + sep + " app.conf" ,
173
+ " -Dlogback.configurationFile=." + sep + " conf" + sep + " logback.xml" ,
174
+ " -Xss10M"
175
+ )
176
+ )
91
177
92
178
if (! nixBuild)
93
- root
179
+ node
94
180
else
95
- root .settings(PB .runProtoc in Compile := (args => Process (" protoc" , args) ! ))
181
+ node .settings(PB .runProtoc in Compile := (args => Process (" protoc" , args) ! ))
96
182
}
97
183
98
- scalacOptions := Seq (
99
- " -unchecked" ,
100
- " -deprecation" ,
101
- " -feature" ,
102
- " -Xfatal-warnings" ,
103
- " -Xlint:unsound-match" ,
104
- " -Ywarn-inaccessible" ,
105
- " -Ywarn-unused-import" ,
106
- " -Ypartial-unification" ,
107
- " -encoding" ,
108
- " utf-8"
109
- )
110
-
111
- scalacOptions in (Compile , console) ~= (_.filterNot(
112
- Set (
113
- " -Ywarn-unused-import" ,
114
- " -Xfatal-warnings"
115
- )
116
- ))
117
-
118
- scalacOptions ~= (options => if (mantisDev) options.filterNot(_ == " -Xfatal-warnings" ) else options)
119
-
120
- Test / parallelExecution := true
121
-
122
- testOptions in Test += Tests .Argument (" -oDG" )
123
-
124
- // protobuf compilation
125
- // Into a subdirectory of src_managed to avoid it deleting other generated files; see https://github.com/sbt/sbt-buildinfo/issues/149
126
- PB .targets in Compile := Seq (
127
- scalapb.gen() -> (sourceManaged in Compile ).value / " protobuf"
128
- )
129
-
130
- // have the protobuf API version file as a resource
131
- unmanagedResourceDirectories in Compile += baseDirectory.value / " src" / " main" / " protobuf"
132
-
133
- (test in Evm ) := (test in Evm ).dependsOn(solidityCompile).value
134
- (sourceDirectory in Evm ) := baseDirectory.value / " src" / " evmTest"
135
-
136
- (scalastyleConfig in Test ) := baseDirectory.value / " scalastyle-test-config.xml"
137
- scalastyleSources in Test ++= { (unmanagedSourceDirectories in Integration ).value }
138
-
139
- // Packaging
140
- mainClass in Compile := Some (" io.iohk.ethereum.App" )
141
- Universal / executableScriptName := name.value
142
- discoveredMainClasses in Compile := Seq ()
143
- // Requires the 'ant-javafx.jar' that comes with Oracle JDK
144
- // Enables creating an executable with the configuration files, has to be run on the OS corresponding to the desired version
145
- ThisBuild / jdkPackagerType := " image"
146
-
147
- Universal / mappings += (resourceDirectory in Compile ).value / " logback.xml" -> " conf/logback.xml"
148
- Universal / mappings += (resourceDirectory in Compile ).value / " application.conf" -> " conf/base.conf"
149
- Universal / mappings ++= directory((resourceDirectory in Compile ).value / " chains" ).map { case (f, name) =>
150
- f -> s " conf/ $name"
151
- }
152
-
153
- val sep = java.io.File .separator
154
- jdkPackagerJVMArgs := Seq (
155
- " -Dconfig.file=." + sep + " conf" + sep + " app.conf" ,
156
- " -Dlogback.configurationFile=." + sep + " conf" + sep + " logback.xml" ,
157
- " -Xss10M"
158
- )
159
-
160
184
coverageExcludedPackages := " io\\ .iohk\\ .ethereum\\ .extvm\\ .msg.*"
161
185
162
186
addCommandAlias(
163
187
" compile-all" ,
164
- """ ;compile
188
+ """ ;rlp/compile
189
+ |;rlp/test:compile
190
+ |;compile
165
191
|;test:compile
166
192
|;evm:compile
167
193
|;it:compile
@@ -176,9 +202,13 @@ addCommandAlias(
176
202
addCommandAlias(
177
203
" pp" ,
178
204
""" ;compile-all
205
+ |;rlp/scalafmtAll
206
+ |;rlp/scalastyle
207
+ |;rlp/test:scalastyle
179
208
|;scalafmtAll
180
209
|;scalastyle
181
210
|;test:scalastyle
211
+ |;rlp/test
182
212
|;testQuick
183
213
|;it:test
184
214
|""" .stripMargin
0 commit comments