-
Notifications
You must be signed in to change notification settings - Fork 5
/
build.sbt
262 lines (219 loc) · 9.04 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
import Dependencies._
val scalaSettings = Seq(
scalaVersion := "2.12.6",
version := "0.0.1",
organization := "com.gu",
scalacOptions ++= Seq(
"-deprecation",
"-encoding", "UTF-8",
"-feature",
"-target:jvm-1.8",
"-language:existentials",
"-language:higherKinds",
"-language:implicitConversions",
"-unchecked",
"-Xlint",
"-Yno-adapted-args",
"-Ywarn-dead-code",
"-Ywarn-numeric-widen",
"-Ywarn-value-discard"
),
javaOptions in Test += s"""-Dlog4j.configuration=file:${new File(".").getCanonicalPath}/test_log4j.properties""",
fork in Test := true,
{
import scalariform.formatter.preferences._
scalariformPreferences := scalariformPreferences.value
.setPreference(DanglingCloseParenthesis, Force)
.setPreference(SpacesAroundMultiImports, false)
.setPreference(NewlineAtEndOfFile, true)
},libraryDependencies += "com.lihaoyi" %% "acyclic" % "0.1.7" % "provided",
autoCompilerPlugins := true,
addCompilerPlugin("com.lihaoyi" %% "acyclic" % "0.1.7"),
scalacOptions += "-P:acyclic:force"
)
// fixme this whole file needs splitting down appropriately
lazy val EffectsTest = config("effectsTest") extend(Test) describedAs("run the edge tests")
lazy val HealthCheckTest = config("healthCheck") extend(Test) describedAs("run the health checks against prod/code")
val testSettings = inConfig(EffectsTest)(Defaults.testTasks) ++ inConfig(HealthCheckTest)(Defaults.testTasks) ++ Seq(
testOptions in Test += Tests.Argument("-l", "com.gu.test.EffectsTest"),
testOptions in Test += Tests.Argument("-l", "com.gu.test.HealthCheck"),
testOptions in EffectsTest -= Tests.Argument("-l", "com.gu.test.EffectsTest"),
testOptions in EffectsTest -= Tests.Argument("-l", "com.gu.test.HealthCheck"),
testOptions in EffectsTest += Tests.Argument("-n", "com.gu.test.EffectsTest"),
testOptions in HealthCheckTest -= Tests.Argument("-l", "com.gu.test.EffectsTest"),
testOptions in HealthCheckTest -= Tests.Argument("-l", "com.gu.test.HealthCheck"),
testOptions in HealthCheckTest += Tests.Argument("-n", "com.gu.test.HealthCheck")
)
def all(theProject: Project) = theProject.settings(scalaSettings, testSettings).configs(EffectsTest, HealthCheckTest)
// ==== START libraries ====
lazy val test = all(project in file("lib/test"))
.settings(
libraryDependencies ++= Seq(
scalatest,
playJson % "test"
)
)
val testDep = test % "test->test"
lazy val zuora = all(project in file("lib/zuora"))
.dependsOn(
restHttp,
testDep,
handler,// TODO only for the config, which needs to be split out
effects % "test->test"
)
.settings(
libraryDependencies ++= Seq(okhttp3, logging, scalaz, playJson, scalatest, jacksonDatabind)
)
lazy val salesforce = all(project in file("lib/salesforce"))
.dependsOn(
restHttp,
handler,// % "test->test" TODO make this dep only in test - SF client shouldn't depends on ApiGateway
effects % "test->test",
testDep
)
.settings(
libraryDependencies ++= Seq(okhttp3, logging, scalaz, playJson, scalatest)
)
lazy val `holiday-stops` = all(project in file("lib/holiday-stops"))
.dependsOn(
salesforce,
effects % "test->test",
testDep
)
.settings(
libraryDependencies ++= Seq(okhttp3, logging, scalaz, playJson, scalatest, playJsonExtensions)
)
lazy val restHttp = all(project in file("lib/restHttp"))
.settings(
libraryDependencies ++= Seq(okhttp3, logging, scalaz, playJson, scalatest)
)
lazy val s3ConfigValidator = all(project in file("lib/s3ConfigValidator"))
.dependsOn(
testDep,
handler,
zuora,
`digital-subscription-expiry`,
`identity-backfill`,
effectsDepIncludingTestFolder,
`cancellation-sf-cases`,
`sf-gocardless-sync`
)
.settings(
libraryDependencies ++= Seq(scalatest)
)
lazy val handler = all(project in file("lib/handler"))
.settings(
libraryDependencies ++= Seq(okhttp3, logging, scalaz, playJson, scalatest, awsLambda, awsS3)
)
// to aid testability, only the actual handlers called as a lambda can depend on this
lazy val effects = all(project in file("lib/effects"))
.dependsOn(handler)
.settings(
libraryDependencies ++= Seq(okhttp3, logging, scalaz, playJson, scalatest, awsS3, jacksonDatabind)
)
lazy val `effects-sqs` = all(project in file("lib/effects-sqs"))
.dependsOn(testDep)
.settings(
libraryDependencies ++= Seq(logging, awsSQS)
)
lazy val `effects-ses` = all(project in file("lib/effects-ses"))
.dependsOn(testDep)
.settings(
libraryDependencies ++= Seq(logging, awsSES)
)
lazy val `effects-cloudwatch` = all(project in file("lib/effects-cloudwatch"))
.dependsOn(testDep)
.settings(
libraryDependencies ++= Seq(logging, awsCloudwatch)
)
val effectsDepIncludingTestFolder: ClasspathDependency = effects % "compile->compile;test->test"
lazy val `zuora-reports` = all(project in file("lib/zuora-reports"))
.dependsOn(zuora, handler, effectsDepIncludingTestFolder, testDep)
// ==== END libraries ====
// ==== START handlers ====
// currently the original code is lying in the root, in due course we need to make three separate sub projects for these original lambdas
// they should produce their own self contained jar to reduce the artifact size and startup time. Any shared code can be
// a set of projects that is "dependsOn(..)" by the sharing projects. Don't be afraid to restructure things to keep the code nice!
lazy val root = all(project in file(".")).enablePlugins(RiffRaffArtifact).aggregate(
`identity-backfill`,
`digital-subscription-expiry`,
`catalog-service`,
`identity-retention`,
`zuora-retention`,
`sf-contact-merge`,
`cancellation-sf-cases`,
`sf-gocardless-sync`,
effects,
handler,
restHttp,
zuora,
`zuora-reports`,
salesforce,
`holiday-stops`,
s3ConfigValidator,
`new-product-api`,
`effects-sqs`,
`effects-ses`,
`effects-cloudwatch`,
`sf-datalake-export`,
`zuora-datalake-export`,
`batch-email-sender`,
`braze-to-salesforce-file-upload`,
`holiday-stop-processor`,
`metric-push-api`
).dependsOn(zuora, handler, effectsDepIncludingTestFolder, `effects-sqs`, testDep)
lazy val `identity-backfill` = all(project in file("handlers/identity-backfill")) // when using the "project identity-backfill" command it uses the lazy val name
.enablePlugins(RiffRaffArtifact)
.dependsOn(
zuora,
salesforce % "compile->compile;test->test",
handler,
effectsDepIncludingTestFolder,
testDep
)
lazy val `digital-subscription-expiry` = all(project in file("handlers/digital-subscription-expiry"))
.enablePlugins(RiffRaffArtifact)
.dependsOn(zuora, handler, effectsDepIncludingTestFolder, testDep)
lazy val `catalog-service` = all(project in file("handlers/catalog-service"))
.enablePlugins(RiffRaffArtifact)
.dependsOn(zuora, handler, effectsDepIncludingTestFolder, testDep)
lazy val `identity-retention` = all(project in file("handlers/identity-retention"))
.enablePlugins(RiffRaffArtifact)
.dependsOn(zuora, handler, effectsDepIncludingTestFolder, testDep)
lazy val `new-product-api` = all(project in file("handlers/new-product-api"))
.enablePlugins(RiffRaffArtifact)
.dependsOn(zuora, handler, `effects-sqs`, effectsDepIncludingTestFolder, testDep)
lazy val `zuora-retention` = all(project in file("handlers/zuora-retention"))
.enablePlugins(RiffRaffArtifact)
.dependsOn(`zuora-reports`, handler, effectsDepIncludingTestFolder, testDep)
lazy val `sf-contact-merge` = all(project in file("handlers/sf-contact-merge"))
.enablePlugins(RiffRaffArtifact)
.dependsOn(zuora, salesforce % "compile->compile;test->test", handler, effectsDepIncludingTestFolder, testDep)
lazy val `cancellation-sf-cases` = all(project in file("handlers/cancellation-sf-cases"))
.enablePlugins(RiffRaffArtifact)
.dependsOn(salesforce, handler, effectsDepIncludingTestFolder, testDep)
lazy val `sf-gocardless-sync` = all(project in file("handlers/sf-gocardless-sync"))
.enablePlugins(RiffRaffArtifact)
.dependsOn(salesforce, handler, effectsDepIncludingTestFolder, testDep)
lazy val `sf-datalake-export` = all(project in file("handlers/sf-datalake-export"))
.enablePlugins(RiffRaffArtifact)
.dependsOn(salesforce, handler, effectsDepIncludingTestFolder, testDep)
lazy val `zuora-datalake-export` = all(project in file("handlers/zuora-datalake-export"))
.enablePlugins(RiffRaffArtifact)
lazy val `batch-email-sender` = all(project in file("handlers/batch-email-sender"))
.enablePlugins(RiffRaffArtifact)
.dependsOn(handler, `effects-sqs`, effectsDepIncludingTestFolder, testDep)
lazy val `braze-to-salesforce-file-upload` = all(project in file("handlers/braze-to-salesforce-file-upload"))
.enablePlugins(RiffRaffArtifact)
lazy val `holiday-stop-processor` = all(project in file("handlers/holiday-stop-processor"))
.enablePlugins(RiffRaffArtifact)
.dependsOn(`holiday-stops`, effects)
lazy val `metric-push-api` = all(project in file("handlers/metric-push-api"))
.enablePlugins(RiffRaffArtifact)
.dependsOn()
// ==== END handlers ====
initialize := {
val _ = initialize.value
assert(sys.props("java.specification.version") == "1.8",
"Java 8 is required for this project.")
}