forked from guardian/frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
231 lines (209 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
221
222
223
224
225
226
227
228
229
230
import com.gu.riffraff.artifact.RiffRaffArtifact.autoImport._
import play.sbt.Play.autoImport._
import play.sbt.routes.RoutesKeys
import com.typesafe.sbt.web.SbtWeb.autoImport._
import com.gu.Dependencies._
import com.gu.ProjectSettings._
val common = library("common").settings(
javaOptions in Test += "-Dconfig.file=common/conf/test.conf",
libraryDependencies ++= Seq(
guBox,
apacheCommonsMath3,
awsCore,
awsCloudwatch,
awsDynamodb,
awsS3,
awsSns,
awsSts,
awsSqs,
awsSsm,
contentApiClient,
enumeratumPlayJson,
filters,
commonsLang,
jodaConvert,
jodaTime,
jSoup,
liftJson,
json4s,
playGoogleAuth,
quartzScheduler,
redisClient,
rome,
romeModules,
scalaCheck,
nScalaTime,
ws,
faciaFapiScalaClient,
closureCompiler,
jerseyCore,
jerseyClient,
cssParser,
w3cSac,
logback,
kinesisLogbackAppender,
targetingClient,
scanamo,
scalaUri,
commercialShared,
playJson,
playJsonExtensions,
playJsonJoda,
jodaForms,
jacksonDataFormat,
atomRenderer,
identityModel,
capiAws,
okhttp,
jsonSchema
)
).settings(
mappings in TestAssets ~= filterAssets
)
val commonWithTests = withTests(common)
val sanityTest = application("sanity-tests")
val facia = application("facia").dependsOn(commonWithTests).aggregate(common).settings(
libraryDependencies += scalaCheck
)
val article = application("article").dependsOn(commonWithTests).aggregate(common)
val applications = application("applications")
.dependsOn(commonWithTests).aggregate(common)
val archive = application("archive").dependsOn(commonWithTests).aggregate(common).settings(
)
val sport = application("sport").dependsOn(commonWithTests).aggregate(common).settings(
libraryDependencies ++= Seq(
paClient,
akkaContrib
)
)
val discussion = application("discussion").dependsOn(commonWithTests).aggregate(common)
val diagnostics = application("diagnostics").dependsOn(commonWithTests).aggregate(common).settings(
libraryDependencies ++= Seq(
redisClient
)
)
val admin = application("admin").dependsOn(commonWithTests).aggregate(common).settings(
libraryDependencies ++= Seq(
paClient,
dfpAxis,
bootstrap,
jquery,
jqueryui,
lodash,
react,
epoch,
d3,
awsElasticloadbalancing,
awsSes,
scalaUri,
playIteratees
),
RoutesKeys.routesImport += "bindables._",
RoutesKeys.routesImport += "org.joda.time.LocalDate"
)
val faciaPress = application("facia-press").dependsOn(commonWithTests).settings(
libraryDependencies ++= Seq(
awsKinesis
)
)
val identity = application("identity").dependsOn(commonWithTests).aggregate(common).settings(
libraryDependencies ++= Seq(
filters,
identityModel,
identityCookie,
liftJson,
slf4jExt,
libPhoneNumber,
supportInternationalisation
)
)
val commercial = application("commercial").dependsOn(commonWithTests).aggregate(common)
val onward = application("onward").dependsOn(commonWithTests).aggregate(common)
val dev = application("dev-build")
.dependsOn(
withTests(article)
).dependsOn(
facia,
applications,
archive,
sport,
discussion,
diagnostics,
identity,
admin,
commercial,
onward
).settings(
RoutesKeys.routesImport += "bindables._",
javaOptions in Runtime += "-Dconfig.file=dev-build/conf/dev-build.application.conf"
)
val preview = application("preview").dependsOn(
commonWithTests,
article,
facia,
applications,
sport,
commercial,
onward
).settings(
)
val rss = application("rss")
.dependsOn(commonWithTests)
.aggregate(common)
val main = root().aggregate(
common,
facia,
faciaPress,
article,
applications,
sport,
discussion,
diagnostics,
admin,
identity,
commercial,
onward,
archive,
preview,
rss
).settings(
riffRaffBuildIdentifier := System.getenv().getOrDefault("BUILD_NUMBER", "0").replaceAll("\"",""),
riffRaffUploadArtifactBucket := Some(System.getenv().getOrDefault("RIFF_RAFF_ARTIFACT_BUCKET", "aws-frontend-teamcity")),
riffRaffUploadManifestBucket := Some(System.getenv().getOrDefault("RIFF_RAFF_BUILD_BUCKET", "aws-frontend-teamcity")),
riffRaffManifestProjectName := s"dotcom:all",
riffRaffArtifactResources := Seq(
(packageBin in Universal in admin).value -> s"${(name in admin).value}/${(packageBin in Universal in admin).value.getName}",
(packageBin in Universal in applications).value -> s"${(name in applications).value}/${(packageBin in Universal in applications).value.getName}",
(packageBin in Universal in archive).value -> s"${(name in archive).value}/${(packageBin in Universal in archive).value.getName}",
(packageBin in Universal in article).value -> s"${(name in article).value}/${(packageBin in Universal in article).value.getName}",
(packageBin in Universal in commercial).value -> s"${(name in commercial).value}/${(packageBin in Universal in commercial).value.getName}",
(packageBin in Universal in diagnostics).value -> s"${(name in diagnostics).value}/${(packageBin in Universal in diagnostics).value.getName}",
(packageBin in Universal in discussion).value -> s"${(name in discussion).value}/${(packageBin in Universal in discussion).value.getName}",
(packageBin in Universal in identity).value -> s"${(name in identity).value}/${(packageBin in Universal in identity).value.getName}",
(packageBin in Universal in facia).value -> s"${(name in facia).value}/${(packageBin in Universal in facia).value.getName}",
(packageBin in Universal in faciaPress).value -> s"${(name in faciaPress).value}/${(packageBin in Universal in faciaPress).value.getName}",
(packageBin in Universal in onward).value -> s"${(name in onward).value}/${(packageBin in Universal in onward).value.getName}",
(packageBin in Universal in preview).value -> s"${(name in preview).value}/${(packageBin in Universal in preview).value.getName}",
(packageBin in Universal in rss).value -> s"${(name in rss).value}/${(packageBin in Universal in rss).value.getName}",
(packageBin in Universal in sport).value -> s"${(name in sport).value}/${(packageBin in Universal in sport).value.getName}",
baseDirectory.value / "riff-raff.yaml" -> "riff-raff.yaml"
)
)
val badgeHash = inputKey[Unit]("Generate special badge salts and hashes")
badgeHash := {
import java.math.BigInteger
import java.security.MessageDigest
import complete.DefaultParsers._
import java.util.UUID
val result = spaceDelimited("<arg>").parsed.headOption.map { tag =>
val salt = UUID.randomUUID.toString.replaceAll("-", "")
val saltedTag = salt + tag
val digest = MessageDigest.getInstance("MD5")
digest.update(saltedTag.getBytes(), 0, saltedTag.length)
val hash = new BigInteger(1, digest.digest()).toString(16)
s"salt=$salt\nhash=$hash"
}.getOrElse {
"error: expected tag parameter"
}
println(result)
}