-
Notifications
You must be signed in to change notification settings - Fork 12
/
build.sbt
185 lines (172 loc) · 5.38 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
import Dependencies._
inThisBuild(
List(
organization := "io.github.xencura",
organizationName := "Xencura GmbH",
homepage := Some(url("https://github.com/xencura/kagera")),
licenses := List(License.MIT),
tlBaseVersion := "0.5",
crossScalaVersions := Seq("2.13.8"),
scalaVersion := crossScalaVersions.value.head,
tlSonatypeUseLegacyHost := false,
developers := List(
Developer("nightscape", "Martin Mauch", "[email protected]", url("https://github.com/nightscape"))
)
)
)
val commonScalacOptions = Seq(
"-encoding",
"utf8",
"-target:jvm-1.8",
"-feature",
"-language:implicitConversions",
"-language:postfixOps",
"-language:higherKinds",
"-unchecked",
"-deprecation",
"-Xlog-reflective-calls"
)
lazy val basicSettings =
Seq(
crossScalaVersions := Seq("2.13.8"),
scalaVersion := crossScalaVersions.value.head,
scalacOptions := commonScalacOptions
)
lazy val defaultProjectSettings = basicSettings
lazy val api = crossProject(JSPlatform, JVMPlatform)
// .withoutSuffixFor(JVMPlatform)
.crossType(CrossType.Pure)
.in(file("api"))
.settings(defaultProjectSettings: _*)
.settings(
name := "kagera-api",
libraryDependencies ++= Seq(
collectionCompat,
scalaGraph.value,
catsEffect.value,
catsCore.value,
fs2Core.value,
scalatest % "test"
)
)
.jsConfigure(_.enablePlugins(ScalaJSBundlerPlugin))
.jsSettings(scalaJSLinkerConfig ~= {
_.withModuleKind(ModuleKind.CommonJSModule)
})
lazy val visualization = crossProject(JSPlatform, JVMPlatform)
.withoutSuffixFor(JVMPlatform)
.enablePlugins(ScalaJSBundlerPlugin)
.in(file("visualization"))
.dependsOn(api)
.settings(defaultProjectSettings: _*)
.settings(
name := "kagera-visualization",
libraryDependencies ++= Seq(scalaGraph.value, scalaTags.value, upickle.value)
)
.jsConfigure(_.enablePlugins(JSDependenciesPlugin, ScalaJSBundlerPlugin))
.jsSettings(
resolvers += "jitpack" at "https://jitpack.io",
webpackBundlingMode := BundlingMode.LibraryAndApplication(),
addCompilerPlugin("org.typelevel" % "kind-projector" % "0.13.2" cross CrossVersion.full),
libraryDependencies ++= Seq(scalaJsDom.value, d3.value, laminar.value),
jsDependencies ++= Seq(
"org.webjars.bower" % "cytoscape" % cytoscapeVersion
/ s"$cytoscapeVersion/dist/cytoscape.js"
minified s"$cytoscapeVersion/dist/cytoscape.min.js"
commonJSName "cytoscape"
)
)
.jvmSettings(libraryDependencies ++= Seq(scalaGraphDot))
lazy val execution = crossProject(JSPlatform, JVMPlatform)
.withoutSuffixFor(JVMPlatform)
.crossType(CrossType.Pure)
.in(file("execution"))
.dependsOn(api)
.settings(
defaultProjectSettings ++ Seq(
name := "kagera-execution",
libraryDependencies ++= Seq(
"org.scala-lang" % "scala-reflect" % scalaVersion.value,
scalaGraph.value,
scalatest % "test"
)
)
)
lazy val akka = project
.in(file("akka"))
.dependsOn(api.jvm, execution.jvm)
.settings(
defaultProjectSettings ++ Seq(
name := "kagera-akka",
libraryDependencies ++= Seq(
"org.scala-lang" % "scala-reflect" % scalaVersion.value,
akkaActor,
akkaPersistence,
akkaSlf4j,
akkaStream,
akkaQuery,
akkaCoordination,
akkaRemote,
akkaCluster,
akkaClusterTools,
akkaPki,
scalaGraph.value,
akkaInmemoryJournal % "test",
akkaTestkit % "test",
scalatest % "test"
),
PB.protocVersion := "3.17.3",
Compile / PB.targets := Seq(scalapb.gen() -> (Compile / sourceManaged).value)
)
)
lazy val demo = (crossProject(JSPlatform, JVMPlatform) in file("demo"))
.dependsOn(api, visualization)
.settings(defaultProjectSettings: _*)
.settings(
Compile / unmanagedSourceDirectories += baseDirectory.value / "shared" / "main" / "scala",
libraryDependencies ++= Seq(scalaTags.value, upickle.value)
)
.jsConfigure(_.enablePlugins(JSDependenciesPlugin, ScalaJSBundlerPlugin))
.jsSettings(
webpackBundlingMode := BundlingMode.LibraryAndApplication(),
libraryDependencies ++= Seq(scalaJsDom.value)
)
.jvmSettings(
libraryDependencies ++= Seq(akkaHttpUpickle, akkaHttp, akkaQuery, akkaPersistenceCassandra),
name := "demo-app",
mainClass := Some("io.kagera.demo.Main")
)
lazy val demoJs = demo.js
lazy val demoJvm = demo.jvm
.dependsOn(api.jvm, visualization.jvm, akka)
.settings(
// include the compiled javascript result from js module
Compile / resources += (demoJs / Compile / fastOptJS).value.data,
// include the javascript dependencies
Compile / resources += (demoJs / Compile / packageJSDependencies).value
)
lazy val root = tlCrossRootProject
.aggregate(api, akka, execution, visualization, visualization, demo)
.enablePlugins(BuildInfoPlugin)
.settings(defaultProjectSettings)
.settings(
publish := {},
buildInfoKeys := Seq[BuildInfoKey](
name,
version,
scalaVersion,
BuildInfoKey.map(git.gitHeadCommit) { case (key, value) =>
key -> value.getOrElse("-")
},
BuildInfoKey.action("buildTime") {
buildTime
}
)
)
def buildTime = {
import java.text.SimpleDateFormat
import java.util._
val sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS '(UTC)'")
sdf.setTimeZone(TimeZone.getTimeZone("UTC"))
sdf.format(new Date())
}