-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.sbt
147 lines (136 loc) · 5.57 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
import com.typesafe.sbt.packager.archetypes.systemloader.ServerLoader.Systemd
import play.sbt.PlayImport.PlayKeys.*
import sbt.Keys.*
import sbt.{addCompilerPlugin, *}
import sbtrelease.ReleasePlugin.autoImport.ReleaseTransformations.*
import sbtversionpolicy.withsbtrelease.ReleaseVersion
ThisBuild / organization := "com.gu"
ThisBuild / licenses := Seq(License.Apache2)
val awsSdkVersion = "1.12.704"
val awscalaVersion = "0.9.2"
val circeVersion = "0.14.10"
val commonDependencies = Seq(
"org.typelevel" %% "cats-core" % "2.12.0",
"joda-time" % "joda-time" % "2.13.0",
"org.joda" % "joda-convert" % "3.0.1",
"com.github.seratch" %% "awscala-iam" % awscalaVersion,
"com.github.seratch" %% "awscala-sts" % awscalaVersion,
"com.github.seratch" %% "awscala-dynamodb" % awscalaVersion,
"org.scalatest" %% "scalatest" % "3.2.19" % Test,
"org.scalacheck" %% "scalacheck" % "1.18.1" % Test,
"org.scalatestplus" %% "scalacheck-1-16" % "3.2.14.0" % Test,
"ch.qos.logback" % "logback-classic" % "1.5.12"
)
lazy val commonSettings = Seq(
scalaVersion := "2.13.15",
scalacOptions ++= Seq(
"-deprecation",
"-feature",
"-unchecked",
"-release:11",
"-Xfatal-warnings"
),
Test / testOptions ++= Seq(
Tests.Argument(TestFrameworks.ScalaTest, "-o"),
Tests.Argument(TestFrameworks.ScalaTest, "-u", "logs/test-reports")
)
)
/*
Workaround for CVE-2020-36518 in Jackson
@see https://github.com/orgs/playframework/discussions/11222
*/
val jacksonVersion = "2.18.1"
val jacksonDatabindVersion = "2.18.1"
val jacksonOverrides = Seq(
"com.fasterxml.jackson.core" % "jackson-core",
"com.fasterxml.jackson.core" % "jackson-annotations",
"com.fasterxml.jackson.datatype" % "jackson-datatype-jdk8",
"com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310"
).map(_ % jacksonVersion)
val jacksonDatabindOverrides = Seq(
"com.fasterxml.jackson.core" % "jackson-databind" % jacksonDatabindVersion
)
val pekkoSerializationJacksonOverrides = Seq(
"com.fasterxml.jackson.dataformat" % "jackson-dataformat-cbor",
"com.fasterxml.jackson.module" % "jackson-module-parameter-names",
"com.fasterxml.jackson.module" %% "jackson-module-scala"
).map(_ % jacksonVersion)
lazy val root = (project in file("."))
.enablePlugins(PlayScala, JDebPackaging, SystemdPlugin)
.dependsOn(configTools % "compile->compile;test->test")
.aggregate(configTools)
.settings(
commonSettings,
name := """janus""",
// The version is concatenated with the name to generate the filename for the deb file when building this project.
// The result must match the URL in the cloudformation userdata in another repository, so the version is hard-coded.
// We hard-code it only in the Debian scope so it affects the name of the deb file, but does not override the version
// that is used for the published config-tools library.
Debian / version := "1.0-SNAPSHOT",
Universal / javaOptions ++= Seq(
"-Dconfig.file=/etc/gu/janus.conf", // for PROD, overridden by local sbt file
"-Dpidfile.path=/dev/null",
"-J-Xms1g",
"-J-Xmx1g"
),
libraryDependencies ++= commonDependencies ++ Seq(
ws,
filters,
"com.gu.play-googleauth" %% "play-v30" % "15.1.1",
"com.amazonaws" % "aws-java-sdk-iam" % awsSdkVersion,
"com.amazonaws" % "aws-java-sdk-sts" % awsSdkVersion,
"com.amazonaws" % "aws-java-sdk-dynamodb" % awsSdkVersion,
"net.logstash.logback" % "logstash-logback-encoder" % "7.3" // scala-steward:off
) ++ jacksonDatabindOverrides
++ jacksonOverrides
++ pekkoSerializationJacksonOverrides,
dependencyOverrides += "org.scala-lang.modules" %% "scala-java8-compat" % "1.0.2", // Avoid binary incompatibility error.
// local development
playDefaultPort := 9100,
Test / fork := false,
// Settings for sbt release, which gets run from the root in the reusable workflow,
// the configTools module (below) is the one that will be published.
// We skip publishing here, because we do not want to publish the root module.
publish / skip := true,
releaseVersion := ReleaseVersion
.fromAggregatedAssessedCompatibilityWithLatestRelease()
.value,
releaseProcess := Seq[ReleaseStep](
checkSnapshotDependencies,
inquireVersions,
runClean,
runTest,
setReleaseVersion,
commitReleaseVersion,
tagRelease,
setNextVersion,
commitNextVersion
),
// packaging / running package
Assets / pipelineStages := Seq(digest),
Compile / doc / sources := Seq.empty,
Compile / packageDoc / publishArtifact := false,
Debian / topLevelDirectory := Some(normalizedName.value),
Debian / serverLoading := Some(Systemd),
Debian / maintainer := "Developer Experience <[email protected]>",
Debian / packageSummary := "Janus webapp",
Debian / packageDescription := "Janus: Google-based federated AWS login"
)
lazy val configTools = (project in file("configTools"))
.enablePlugins(SbtTwirl)
.settings(
addCompilerPlugin(
"org.typelevel" %% "kind-projector" % "0.13.3" cross CrossVersion.full
),
commonSettings,
libraryDependencies ++= commonDependencies ++ Seq(
"com.typesafe" % "config" % "1.4.3",
"io.circe" %% "circe-core" % circeVersion,
"io.circe" %% "circe-generic" % circeVersion,
"io.circe" %% "circe-parser" % circeVersion,
"io.circe" %% "circe-config" % "0.10.1",
"com.amazonaws" % "aws-java-sdk-dynamodb" % awsSdkVersion
) ++ jacksonDatabindOverrides,
name := "janus-config-tools",
description := "Library for reading and writing Janus configuration files"
)