-
Notifications
You must be signed in to change notification settings - Fork 36
Expand file tree
/
Copy pathbuild.sbt
More file actions
122 lines (108 loc) · 5.16 KB
/
build.sbt
File metadata and controls
122 lines (108 loc) · 5.16 KB
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
name := "local-drone-control"
organization := "com.lightbend.akka.samples"
organizationHomepage := Some(url("https://akka.io"))
licenses := Seq(("CC0", url("https://creativecommons.org/publicdomain/zero/1.0")))
resolvers += "Akka library repository".at("https://repo.akka.io/maven/github_actions")
scalaVersion := "2.13.17"
Compile / scalacOptions ++= Seq(
"-release:11",
"-deprecation",
"-feature",
"-unchecked",
"-Xlog-reflective-calls",
"-Xlint")
Compile / javacOptions ++= Seq("-Xlint:unchecked", "-Xlint:deprecation")
Test / parallelExecution := false
Test / testOptions += Tests.Argument("-oDF")
Test / logBuffered := false
run / fork := true
// use the single node main by default
Compile / mainClass := Some("local.drones.Main")
// pass along config selection to forked jvm
run / javaOptions ++= sys.props
.get("config.resource")
.fold(Seq.empty[String])(res => Seq(s"-Dconfig.resource=$res"))
Global / cancelable := false // ctrl-c
val AkkaVersion = "2.10.13"
val AkkaHttpVersion = "10.7.3"
val AkkaManagementVersion = "1.6.4"
val AkkaPersistenceR2dbcVersion = "1.3.12"
val AkkaProjectionVersion =
sys.props.getOrElse("akka-projection.version", "1.6.19")
val AkkaDiagnosticsVersion = "2.2.0"
enablePlugins(AkkaGrpcPlugin)
enablePlugins(JavaAppPackaging, DockerPlugin)
dockerBaseImage := "docker.io/library/eclipse-temurin:17.0.8.1_1-jre"
dockerUsername := sys.props.get("docker.username")
dockerRepository := sys.props.get("docker.registry")
dockerBuildxPlatforms := Seq("linux/amd64")
dockerUpdateLatest := true
ThisBuild / dynverSeparator := "-"
libraryDependencies ++= Seq(
// 1. Basic dependencies for a clustered application
"com.typesafe.akka" %% "akka-stream" % AkkaVersion,
"com.typesafe.akka" %% "akka-actor-typed" % AkkaVersion,
"com.typesafe.akka" %% "akka-actor" % AkkaVersion,
"com.typesafe.akka" %% "akka-actor-testkit-typed" % AkkaVersion % Test,
"com.typesafe.akka" %% "akka-stream-testkit" % AkkaVersion % Test,
"com.typesafe.akka" %% "akka-http" % AkkaHttpVersion,
"com.typesafe.akka" %% "akka-cluster" % AkkaVersion,
"com.typesafe.akka" %% "akka-cluster-sharding" % AkkaVersion,
"com.typesafe.akka" %% "akka-distributed-data" % AkkaVersion,
"com.typesafe.akka" %% "akka-remote" % AkkaVersion,
"com.typesafe.akka" %% "akka-cluster-typed" % AkkaVersion,
"com.typesafe.akka" %% "akka-cluster-sharding-typed" % AkkaVersion,
"com.typesafe.akka" %% "akka-discovery" % AkkaVersion,
"com.typesafe.akka" %% "akka-stream-typed" % AkkaVersion,
"com.typesafe.akka" %% "akka-protobuf-v3" % AkkaVersion,
// Note: diagnostics not supported in native image
// "com.lightbend.akka" %% "akka-diagnostics" % AkkaDiagnosticsVersion,
// Note: only management/bootstrap only needed when running the multi-node version of the service
// Akka Management powers Health Checks and Akka Cluster Bootstrapping
"com.lightbend.akka.management" %% "akka-management" % AkkaManagementVersion,
"com.typesafe.akka" %% "akka-http" % AkkaHttpVersion,
"com.typesafe.akka" %% "akka-http-spray-json" % AkkaHttpVersion,
"com.lightbend.akka.management" %% "akka-management-cluster-http" % AkkaManagementVersion,
"com.lightbend.akka.management" %% "akka-management-cluster-bootstrap" % AkkaManagementVersion,
"com.lightbend.akka.discovery" %% "akka-discovery-kubernetes-api" % AkkaManagementVersion,
// Common dependencies for logging and testing
"com.typesafe.akka" %% "akka-slf4j" % AkkaVersion,
"ch.qos.logback" % "logback-classic" % "1.5.18",
"org.scalatest" %% "scalatest" % "3.2.19" % Test,
// Prometheus client for custom metrics
"io.prometheus" % "simpleclient" % "0.16.0",
"io.prometheus" % "simpleclient_httpserver" % "0.16.0",
// 2. Using Akka Persistence
"com.typesafe.akka" %% "akka-persistence-typed" % AkkaVersion,
"com.typesafe.akka" %% "akka-serialization-jackson" % AkkaVersion,
"com.lightbend.akka" %% "akka-persistence-r2dbc" % AkkaPersistenceR2dbcVersion,
"com.typesafe.akka" %% "akka-persistence-testkit" % AkkaVersion % Test,
// local single-node lightweight database with h2
"com.h2database" % "h2" % "2.2.224",
"io.r2dbc" % "r2dbc-h2" % "1.0.0.RELEASE",
// 3. Querying or projecting data from Akka Persistence
"com.lightbend.akka" %% "akka-projection-r2dbc" % AkkaProjectionVersion,
"com.typesafe.akka" %% "akka-persistence-query" % AkkaVersion,
"com.lightbend.akka" %% "akka-projection-grpc" % AkkaProjectionVersion,
"com.lightbend.akka" %% "akka-projection-eventsourced" % AkkaProjectionVersion,
"com.lightbend.akka" %% "akka-projection-testkit" % AkkaProjectionVersion % Test)
// GraalVM native image build
enablePlugins(NativeImagePlugin)
nativeImageJvm := "graalvm-community"
nativeImageVersion := "21.0.2"
nativeImageOptions := Seq(
"--no-fallback",
"--verbose",
"--install-exit-handlers",
"--initialize-at-build-time=ch.qos.logback",
"-Dlogback.configurationFile=logback-native-image.xml" // configured at build time
)
NativeImage / mainClass := sys.props
.get("native.mode")
.collect {
case "clustered" =>
"local.drones.ClusteredMain"
}
.orElse((Compile / run / mainClass).value)
// silence warnings for these keys (used in dynamic task)
Global / excludeLintKeys ++= Set(nativeImageJvm, nativeImageVersion)