forked from wavesplatform/Waves
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
220 lines (194 loc) · 6.83 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
/* IDEA notes
* May require to delete .idea and re-import with all checkboxes
* Worksheets may not work: https://youtrack.jetbrains.com/issue/SCL-6726
* To work with worksheets, make sure:
1. You've selected the appropriate project
2. You've checked "Make project before run"
*/
import sbt.Def
import sbt.Keys._
Global / onChangedBuildSource := ReloadOnSourceChanges
lazy val lang =
crossProject(JSPlatform, JVMPlatform)
.withoutSuffixFor(JVMPlatform)
.crossType(CrossType.Full)
.settings(
assembly / test := {},
libraryDependencies ++= Dependencies.lang.value ++ Dependencies.test,
inConfig(Compile)(
Seq(
PB.protoSources := Seq(baseDirectory.value.getParentFile / "shared" / "src" / "main" / "protobuf"),
PB.targets := Seq(
scalapb.gen(flatPackage = true) -> sourceManaged.value
),
PB.deleteTargetDirectory := false
)
)
)
lazy val `lang-jvm` = lang.jvm
.settings(
name := "RIDE Compiler",
normalizedName := "lang",
description := "The RIDE smart contract language compiler",
libraryDependencies += "org.scala-js" %% "scalajs-stubs" % "1.1.0" % Provided
)
lazy val `lang-js` = lang.js
.enablePlugins(VersionObject)
.settings(
Compile / sourceGenerators += Tasks.docSource
)
lazy val `lang-testkit` = project
.dependsOn(`lang-jvm`)
.in(file("lang/testkit"))
.settings(
libraryDependencies ++= Dependencies.test.map(_.withConfigurations(Some("compile")))
)
lazy val `lang-tests` = project
.in(file("lang/tests"))
.dependsOn(`lang-testkit`)
.settings(
Compile / sourceGenerators += Tasks.docSource
)
lazy val `lang-doc` = project
.in(file("lang/doc"))
.dependsOn(`lang-jvm`)
.settings(
Compile / sourceGenerators += Tasks.docSource,
libraryDependencies ++= Seq("com.github.spullara.mustache.java" % "compiler" % "0.9.5") ++ Dependencies.test
)
lazy val node = project.dependsOn(`lang-jvm`, `lang-testkit` % "test")
lazy val `grpc-server` = project.dependsOn(node % "compile;test->test;runtime->provided")
lazy val `node-it` = project.dependsOn(node, `lang-testkit`, `repl-jvm`, `grpc-server`)
lazy val `node-generator` = project.dependsOn(node)
lazy val benchmark = project.dependsOn(node % "compile;test->test")
lazy val repl = crossProject(JSPlatform, JVMPlatform)
.withoutSuffixFor(JVMPlatform)
.crossType(CrossType.Full)
.settings(
libraryDependencies ++= Dependencies.protobuf.value ++ Dependencies.langCompilerPlugins.value,
inConfig(Compile)(
Seq(
PB.targets += scalapb.gen(flatPackage = true) -> sourceManaged.value,
PB.protoSources += PB.externalIncludePath.value,
PB.generate / includeFilter := { (f: File) =>
(** / "waves" / "*.proto").matches(f.toPath)
}
)
)
)
lazy val `repl-jvm` = repl.jvm
.dependsOn(`lang-jvm`)
.settings(
libraryDependencies ++= Dependencies.circe.value ++ Seq(
"org.scala-js" %% "scalajs-stubs" % "1.1.0" % Provided,
Dependencies.sttp3
)
)
lazy val `repl-js` = repl.js.dependsOn(`lang-js`)
lazy val `curve25519-test` = project.dependsOn(node)
lazy val root = (project in file("."))
.aggregate(
`lang-js`,
`lang-jvm`,
`lang-tests`,
`lang-testkit`,
node,
`node-it`,
`node-generator`,
benchmark
)
inScope(Global)(
Seq(
scalaVersion := "2.13.6",
organization := "com.wavesplatform",
organizationName := "Waves Platform",
V.fallback := (1, 3, 10),
organizationHomepage := Some(url("https://wavesplatform.com")),
licenses := Seq(("MIT", url("https://github.com/wavesplatform/Waves/blob/master/LICENSE"))),
scalacOptions ++= Seq(
"-feature",
"-deprecation",
"-unchecked",
"-language:higherKinds",
"-language:implicitConversions",
"-language:postfixOps",
"-Ywarn-unused:-implicits",
"-Xlint",
"-Wconf:cat=deprecation&site=com.wavesplatform.api.grpc.*:s", // Ignore gRPC warnings
"-Wconf:cat=deprecation&site=com.wavesplatform.protobuf.transaction.InvokeScriptResult.*:s", // Ignore deprecated argsBytes
"-Wconf:cat=deprecation&site=com.wavesplatform.state.InvokeScriptResult.*:s"
),
crossPaths := false,
dependencyOverrides ++= Dependencies.enforcedVersions.value,
cancelable := true,
parallelExecution := false,
testListeners := Seq.empty, // Fix for doubled test reports
/* http://www.scalatest.org/user_guide/using_the_runner
* o - select the standard output reporter
* I - show reminder of failed and canceled tests without stack traces
* D - show all durations
* O - drop InfoProvided events
* F - show full stack traces
* u - select the JUnit XML reporter with output directory
*/
testOptions += Tests.Argument("-oIDOF", "-u", "target/test-reports"),
testOptions += Tests.Setup(_ => sys.props("sbt-testing") = "true"),
network := Network.default(),
resolvers += Resolver.sonatypeRepo("snapshots"),
Compile / doc / sources := Seq.empty,
Compile / packageDoc / publishArtifact := false
)
)
// ThisBuild options
git.useGitDescribe := true
git.uncommittedSignifier := Some("DIRTY")
lazy val packageAll = taskKey[Unit]("Package all artifacts")
packageAll := {
(node / assembly).value
(`grpc-server` / Universal / packageZipTarball).value
IO.copyFile((node / Debian / packageBin).value, new File(baseDirectory.value, "docker/target/waves.deb"))
IO.copyFile((`grpc-server` / Debian / packageBin).value, new File(baseDirectory.value, "docker/target/waves-grpc-server.deb"))
}
lazy val checkPRRaw = taskKey[Unit]("Build a project and run unit tests")
checkPRRaw := Def
.sequential(
root / clean,
Def.task {
(Test / compile).value
(`lang-tests` / Test / test).value
(`lang-js` / Compile / fastOptJS).value
(`grpc-server` / Test / test).value
(node / Test / test).value
(`repl-js` / Compile / fastOptJS).value
}
)
.value
def checkPR: Command = Command.command("checkPR") { state =>
val newState = Project
.extract(state)
.appendWithoutSession(
Seq(Global / scalacOptions ++= Seq("-Xfatal-warnings")),
state
)
Project.extract(newState).runTask(checkPRRaw, newState)
state
}
lazy val buildDebPackages = taskKey[Unit]("Build debian packages")
buildDebPackages := {
(`grpc-server` / Debian / packageBin).value
(node / Debian / packageBin).value
}
def buildPackages: Command = Command("buildPackages")(_ => Network.networkParser) { (state, args) =>
args.toSet[Network].foreach { n =>
val newState = Project
.extract(state)
.appendWithoutSession(
Seq(Global / network := n),
state
)
Project.extract(newState).runTask(buildDebPackages, newState)
}
Project.extract(state).runTask(packageAll, state)
state
}
commands ++= Seq(checkPR, buildPackages)