-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
126 lines (116 loc) · 4.84 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
import scala.concurrent.duration.DurationInt
ThisBuild / scalaVersion := "2.13.12"
ThisBuild / version := "0.1.0-SNAPSHOT"
ThisBuild / organization := "io.adamnfish"
ThisBuild / organizationName := "adamnfish"
ThisBuild / scalacOptions ++= Seq(
"-Xfatal-warnings",
"-encoding", "UTF-8",
"-Ywarn-dead-code",
"-deprecation",
"-explaintypes",
)
val circeVersion = "0.14.5"
val scanamoVersion = "1.0-M14"
val awsJavaSdkVersion = "2.20.68"
val commonDeps = Seq(
"org.scalatest" %% "scalatest" % "3.2.15" % Test,
"org.scalacheck" %% "scalacheck" % "1.17.0" % Test,
"org.scalatestplus" %% "scalacheck-1-14" % "3.2.2.0" % Test,
)
val loggingDeps = Seq(
"ch.qos.logback" % "logback-classic" % "1.4.7",
"com.typesafe.scala-logging" %% "scala-logging" % "3.9.5",
)
// https://aws.amazon.com/blogs/developer/tuning-the-aws-java-sdk-2-x-to-reduce-startup-time/
// url-connection-client is included in modules that make AWS API calls (lambda, devserver and integration)
// some other jars are also filtered out of the Lambda in its native packager settings
ThisBuild / excludeDependencies ++= Seq(
ExclusionRule("software.amazon.awssdk", "netty-nio-client"),
ExclusionRule("software.amazon.awssdk", "apache-client"),
)
lazy val root = (project in file("."))
.settings(
name := "pokerdot",
libraryDependencies ++= commonDeps,
)
.aggregate(core, lambda, devServer, integration)
lazy val core = (project in file("core"))
.settings(
name := "core",
libraryDependencies ++= Seq(
"dev.zio" %% "zio" % "2.0.13",
"io.circe" %% "circe-core" % circeVersion,
"io.circe" %% "circe-generic" % circeVersion,
"io.circe" %% "circe-parser" % circeVersion,
"org.scanamo" %% "scanamo" % scanamoVersion,
"software.amazon.awssdk" % "dynamodb" % awsJavaSdkVersion,
) ++ commonDeps,
)
lazy val lambda = (project in file("lambda"))
.enablePlugins(JavaAppPackaging)
.settings(
name := "lambda",
libraryDependencies ++= Seq(
"com.typesafe.scala-logging" %% "scala-logging" % "3.9.5",
"com.amazonaws" % "aws-lambda-java-core" % "1.2.2",
"com.amazonaws" % "aws-lambda-java-events" % "3.11.1",
"com.amazonaws" % "aws-xray-recorder-sdk-core" % "2.15.0",
"software.amazon.awssdk" % "apigatewaymanagementapi" % awsJavaSdkVersion,
"software.amazon.awssdk" % "url-connection-client" % awsJavaSdkVersion,
) ++ commonDeps ++ loggingDeps,
// native-packager
Universal / topLevelDirectory := None,
Universal / packageName := "pokerdot-lambda",
Compile / packageDoc / mappings := Seq(),
Universal / mappings := (Universal / mappings).value.filter {
case (_, path) =>
// these are only used at compile time to generate code, I think?
// !path.contains("org.scala-lang.scala-compiler") && // required :-(
// !path.contains("org.scala-lang.scala-reflect") && // required :-(
!path.contains("net.java.dev.jna.jna") &&
!path.contains("org.jline.jline")
}
)
.dependsOn(core)
lazy val integration = (project in file("integration"))
.settings(
name := "integration",
libraryDependencies ++= Seq(
"org.scanamo" %% "scanamo-testkit" % scanamoVersion % Test,
"software.amazon.awssdk" % "url-connection-client" % awsJavaSdkVersion % Test,
"software.amazon.awssdk" % "dynamodb" % awsJavaSdkVersion % Test,
) ++ commonDeps ++ loggingDeps,
// start DynamoDB for tests
dynamoDBLocalDownloadDir := file(".dynamodb-local"),
dynamoDBLocalPort := 8042,
dynamoDBLocalDownloadIfOlderThan := 14.days,
startDynamoDBLocal := startDynamoDBLocal.dependsOn(Test / compile).value,
Test / test := (Test / test).dependsOn(startDynamoDBLocal).value,
Test / testOnly := (Test / testOnly).dependsOn(startDynamoDBLocal).evaluated,
Test / testOptions += dynamoDBLocalTestCleanup.value,
)
.dependsOn(core % "compile->compile;test->test")
lazy val devServer = (project in file("devserver"))
.settings(
name := "devserver",
libraryDependencies ++= Seq(
"io.javalin" % "javalin" % "5.6.3",
"org.scanamo" %% "scanamo-testkit" % scanamoVersion,
"software.amazon.awssdk" % "dynamodb" % awsJavaSdkVersion,
"software.amazon.awssdk" % "url-connection-client" % awsJavaSdkVersion,
) ++ commonDeps ++ loggingDeps,
// console logging and ctrl-c to kill support
run / fork := true,
run / connectInput := true,
outputStrategy := Some(StdoutOutput),
// start DynamoDB on run
dynamoDBLocalDownloadDir := file(".dynamodb-local"),
dynamoDBLocalPort := 8042,
dynamoDBLocalDownloadIfOlderThan := 14.days,
startDynamoDBLocal := startDynamoDBLocal.dependsOn(Compile / compile).value,
Compile / run := (Compile / run).dependsOn(startDynamoDBLocal).evaluated,
// allows browsing DB from http://localhost:8042/shell/
dynamoDBLocalSharedDB := true,
)
.dependsOn(core)