forked from rchain/rchain
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sbt
290 lines (272 loc) · 9.6 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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
import Dependencies._
import BNFC._
import NativePackagerHelper._
lazy val projectSettings = Seq(
organization := "coop.rchain",
scalaVersion := "2.12.4",
version := "0.1.0-SNAPSHOT",
resolvers += Resolver.sonatypeRepo("releases"),
scalafmtOnCompile := true
)
lazy val coverageSettings = Seq(
coverageMinimum := 90,
coverageFailOnMinimum := false,
coverageExcludedFiles := Seq(
(javaSource in Compile).value,
(sourceManaged in Compile).value.getPath ++ "/.*"
).mkString(";")
)
lazy val compilerSettings = CompilerSettings.options ++ Seq(
crossScalaVersions := Seq("2.11.12", scalaVersion.value)
)
lazy val commonSettings = projectSettings ++ coverageSettings ++ compilerSettings
lazy val shared = (project in file("shared"))
.settings(commonSettings: _*)
.settings(
version := "0.1",
libraryDependencies ++= commonDependencies ++ Seq(
catsCore,
monix
)
)
lazy val casper = (project in file("casper"))
.settings(commonSettings: _*)
.settings(
libraryDependencies ++= commonDependencies ++ protobufDependencies ++ Seq(
catsCore,
catsMtl,
monix,
scalapbRuntimegGrpc
),
PB.targets in Compile := Seq(
scalapb.gen() -> (sourceManaged in Compile).value
)
)
.dependsOn(comm % "compile->compile;test->test", shared, crypto) // TODO: Add models, rspace
lazy val comm = (project in file("comm"))
.settings(commonSettings: _*)
.settings(
version := "0.1",
libraryDependencies ++= commonDependencies ++ kamonDependencies ++ protobufDependencies ++ Seq(
scalaUri,
weupnp,
hasher,
catsCore,
monix,
guava
),
PB.targets in Compile := Seq(
PB.gens.java -> (sourceManaged in Compile).value,
scalapb.gen(javaConversions = true) -> (sourceManaged in Compile).value
)
).dependsOn(shared)
lazy val crypto = (project in file("crypto"))
.settings(commonSettings: _*)
.settings(
name := "crypto",
libraryDependencies ++= commonDependencies ++ protobufDependencies ++ Seq(
guava,
bouncyCastle,
kalium,
jaxb
),
fork := true,
unmanagedSourceDirectories in Compile += baseDirectory.value / "secp256k1/src/java",
javaOptions += "-Djava.library.path=secp256k1/.libs",
doctestTestFramework := DoctestTestFramework.ScalaTest
)
lazy val models = (project in file("models"))
.settings(commonSettings: _*)
.settings(
libraryDependencies ++= commonDependencies ++ protobufDependencies ++ Seq(
catsCore,
scalacheck,
scalacheckShapeless
),
PB.targets in Compile := Seq(
scalapb.gen(flatPackage = true) -> (sourceManaged in Compile).value
)
)
.dependsOn(rspace)
lazy val node = (project in file("node"))
.settings(commonSettings: _*)
.enablePlugins(sbtdocker.DockerPlugin, RpmPlugin, DebianPlugin, JavaAppPackaging, BuildInfoPlugin)
.settings(
version := "0.3.1",
name := "rnode",
libraryDependencies ++=
apiServerDependencies ++ commonDependencies ++ kamonDependencies ++ protobufDependencies ++ Seq(
catsCore,
grpcNetty,
jline,
scallop,
scalaUri,
scalapbRuntimegGrpc
),
PB.targets in Compile := Seq(
PB.gens.java -> (sourceManaged in Compile).value / "protobuf",
scalapb.gen(javaConversions = true) -> (sourceManaged in Compile).value / "protobuf"
),
buildInfoKeys := Seq[BuildInfoKey](name, version, scalaVersion, sbtVersion),
buildInfoPackage := "coop.rchain.node",
mainClass in assembly := Some("coop.rchain.node.Main"),
assemblyMergeStrategy in assembly := {
case x if x.endsWith("io.netty.versions.properties") => MergeStrategy.first
case x =>
val oldStrategy = (assemblyMergeStrategy in assembly).value
oldStrategy(x)
},
/* Dockerization */
dockerfile in docker := {
val artifact: File = assembly.value
val artifactTargetPath = s"/${artifact.name}"
val entry: File = baseDirectory(_ / "main.sh").value
val entryTargetPath = "/bin"
val rholangExamples = (baseDirectory in rholang).value / "examples"
new Dockerfile {
from("openjdk:8u151-jre-alpine")
add(artifact, artifactTargetPath)
copy(rholangExamples, "/usr/share/rnode/examples")
env("RCHAIN_TARGET_JAR", artifactTargetPath)
add(entry, entryTargetPath)
run("apk", "update")
run("apk", "add", "libsodium")
entryPoint("/bin/main.sh")
}
},
/* Packaging */
maintainer in Linux := "Pyrofex, Inc. <info@pyrofex.net>",
packageSummary in Linux := "RChain Node",
packageDescription in Linux := "RChain Node - the RChain blockchain node server software.",
linuxPackageMappings ++= {
val file = baseDirectory.value / "rnode.service"
val rholangExamples = directory((baseDirectory in rholang).value / "examples")
.map { case (f, p) => (f, s"/usr/share/rnode/$p") }
Seq(packageMapping(file -> "/lib/systemd/system/rnode.service"), packageMapping(rholangExamples:_*))
},
/* Debian */
debianPackageDependencies in Debian ++= Seq("openjdk-8-jre-headless", "bash (>= 2.05a-11)", "libsodium18 (>= 1.0.8-5)"),
/* Redhat */
rpmVendor := "rchain.coop",
rpmUrl := Some("https://rchain.coop"),
rpmLicense := Some("Apache 2.0"),
packageArchitecture in Rpm := "noarch",
maintainerScripts in Rpm := maintainerScriptsAppendFromFile((maintainerScripts in Rpm).value)(
RpmConstants.Post -> (sourceDirectory.value / "rpm" / "scriptlets" / "post")
),
rpmPrerequisites := Seq("libsodium >= 1.0.14-1")
)
.dependsOn(casper, comm, crypto, rholang)
lazy val regex = (project in file("regex"))
.settings(commonSettings: _*)
.settings(libraryDependencies ++= commonDependencies)
lazy val rholang = (project in file("rholang"))
.settings(commonSettings: _*)
.settings(bnfcSettings: _*)
.settings(
scalacOptions ++= Seq(
"-language:existentials",
"-language:higherKinds",
"-Yno-adapted-args"
),
libraryDependencies ++= commonDependencies ++ Seq(monix, scallop),
mainClass in assembly := Some("coop.rchain.rho2rose.Rholang2RosetteCompiler"),
coverageExcludedFiles := Seq(
(javaSource in Compile).value,
(bnfcGrammarDir in BNFCConfig).value,
(bnfcOutputDir in BNFCConfig).value,
baseDirectory.value / "src" / "main" / "k",
baseDirectory.value / "src" / "main" / "rbl"
).map(_.getPath ++ "/.*").mkString(";"),
fork in Test := true
)
.dependsOn(models, rspace)
lazy val rholangCLI = (project in file("rholang-cli"))
.settings(commonSettings: _*)
.settings(
mainClass in assembly := Some("coop.rchain.rholang.interpreter.RholangCLI")
)
.dependsOn(rholang)
lazy val roscala_macros = (project in file("roscala/macros"))
.settings(commonSettings: _*)
.settings(
libraryDependencies ++= commonDependencies ++ Seq(
"org.scala-lang" % "scala-reflect" % scalaVersion.value
)
)
lazy val roscala = (project in file("roscala"))
.settings(commonSettings: _*)
.settings(
name := "Rosette",
mainClass in assembly := Some("coop.rchain.rosette.Main"),
assemblyJarName in assembly := "rosette.jar",
inThisBuild(
List(addCompilerPlugin("org.scalamacros" % "paradise" % "2.1.0" cross CrossVersion.full))),
libraryDependencies ++= commonDependencies ++ Seq(catsCore, shapeless, scalacheck)
)
.dependsOn(roscala_macros)
lazy val rspace = (project in file("rspace"))
.enablePlugins(SiteScaladocPlugin, GhpagesPlugin, TutPlugin)
.settings(commonSettings: _*)
.settings(
name := "rspace",
version := "0.1.1",
libraryDependencies ++= commonDependencies ++ Seq(
lmdbjava,
catsCore,
scodecCore,
scodecBits
),
/* Tutorial */
tutTargetDirectory := (baseDirectory in Compile).value / ".." / "docs" / "rspace",
/* Publishing Settings */
scmInfo := Some(ScmInfo(url("https://github.com/rchain/rchain"), "git@github.com:rchain/rchain.git")),
git.remoteRepo := scmInfo.value.get.connection,
useGpg := true,
pomIncludeRepository := { _ => false },
publishMavenStyle := true,
publishTo := {
val nexus = "https://oss.sonatype.org/"
if (isSnapshot.value)
Some("snapshots" at nexus + "content/repositories/snapshots")
else
Some("releases" at nexus + "service/local/staging/deploy/maven2")
},
publishArtifact in Test := false,
licenses := Seq("Apache-2.0" -> url("https://www.apache.org/licenses/LICENSE-2.0")),
homepage := Some(url("https://www.rchain.coop")),
developers := List(
Developer(
id = "guardbotmk3",
name = "Kyle Butt",
email = "kyle@pyrofex.net",
url = url("https://www.pyrofex.net")
),
Developer(
id = "ys-pyrofex",
name = "Yaraslau Levashkevich",
email = "yaraslau@pyrofex.net",
url = url("https://www.pyrofex.net")
),
Developer(
id = "KentShikama",
name = "Kent Shikama",
email = "kent@kentshikama.com",
url = url("https://www.rchain.coop")
),
Developer(
id = "henrytill",
name = "Henry Till",
email = "henrytill@gmail.com",
url = url("https://www.pyrofex.net")
)
)
)
.dependsOn(shared)
lazy val rspaceBench = (project in file("rspace-bench"))
.settings(commonSettings, libraryDependencies ++= commonDependencies)
.enablePlugins(JmhPlugin)
.dependsOn(rspace)
lazy val rchain = (project in file("."))
.settings(commonSettings: _*)
.aggregate(casper, crypto, comm, models, regex, rspace, node, rholang, rholangCLI, roscala)