-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathbuild.sbt
97 lines (87 loc) · 4.29 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
import sbt.{Def, project}
import sbtassembly.MergeStrategy
import scalariform.formatter.preferences._
import scala.collection.immutable
val testAndCompileDependencies: String = "test->test;compile->compile"
val awsVersion: String = "1.12.780"
val simpleConfigurationVersion: String = "1.6.2"
val jacksonData: String = "2.18.2"
val scalaRoot = file("scala")
scalaVersion := "2.13.16"
lazy val common = project.in(scalaRoot / "common")
.disablePlugins(AssemblyPlugin)
.settings(commonSettings("common"), libraryDependencies += "com.fasterxml.jackson.core" % "jackson-databind" % jacksonData)
lazy val userPurchasePersistence = project.in(scalaRoot / "user-purchase-persistence").disablePlugins(AssemblyPlugin)
.settings(commonSettings("user-purchase-persistence"), libraryDependencies += "com.fasterxml.jackson.core" % "jackson-databind" % jacksonData)
.dependsOn(common % testAndCompileDependencies)
lazy val googleOauth = project.in(scalaRoot / "google-oauth").enablePlugins(AssemblyPlugin)
.settings(
commonAssemblySettings("google-oauth"),
libraryDependencies ++= List(
"com.google.auth" % "google-auth-library-oauth2-http" % "1.15.0",
"com.gu" %% "simple-configuration-ssm" % simpleConfigurationVersion,
"com.fasterxml.jackson.core" % "jackson-databind" % jacksonData
)
)
.dependsOn(common % testAndCompileDependencies)
lazy val root = project
.in(file("."))
.aggregate(common, googleOauth)
.settings(
fork := true, // was hitting deadlock, found similar complaints online, disabling concurrency helps: https://github.com/sbt/sbt/issues/3022, https://github.com/mockito/mockito/issues/1067
name := "mobile-purchases",
)
def commonAssemblySettings(module: String): immutable.Seq[Def.Setting[_]] = commonSettings(module) ++ List(
Compile / packageDoc / publishArtifact := false,
assembly / assemblyMergeStrategy := {
case "META-INF/MANIFEST.MF" => MergeStrategy.discard
case "META-INF/org/apache/logging/log4j/core/config/plugins/Log4j2Plugins.dat" => new MergeFilesStrategy
case "module-info.class" => MergeStrategy.discard // See: https://stackoverflow.com/a/55557287
case x => MergeStrategy.first
},
assemblyJarName := s"${name.value}.jar"
)
def commonSettings(module: String): immutable.Seq[Def.Setting[_]] = {
val specsVersion: String = "4.19.2" // Not possible to upgrade to 5.*.* unless moving to Scala 3.
val log4j2Version: String = "2.17.1"
val jacksonVersion: String = "2.18.2"
val upgradeTransitiveDependencies = Seq(
"com.amazonaws" % "aws-java-sdk-ec2" % awsVersion,
"com.amazonaws" % "aws-java-sdk-dynamodb" % awsVersion,
"com.amazonaws" % "aws-java-sdk-core" % awsVersion,
"com.fasterxml.jackson.dataformat" % "jackson-dataformat-cbor" % jacksonVersion,
"org.apache.logging.log4j" % "log4j-api" % log4j2Version
)
List(
scalariformPreferences := scalariformPreferences.value
.setPreference(AlignSingleLineCaseStatements, true)
.setPreference(DoubleIndentConstructorArguments, true)
.setPreference(DanglingCloseParenthesis, Preserve),
fork := true, // was hitting deadlock, found similar complaints online, disabling concurrency helps: https://github.com/sbt/sbt/issues/3022, https://github.com/mockito/mockito/issues/1067
Test / scalacOptions ++= Seq("-Yrangepos"),
libraryDependencies ++= Seq(
"commons-io" % "commons-io" % "2.6",
"com.amazonaws" % "aws-lambda-java-core" % "1.2.0",
"com.amazonaws" % "aws-lambda-java-log4j2" % "1.5.0",
"com.amazonaws" % "aws-java-sdk-cloudwatch" % awsVersion,
"org.apache.logging.log4j" % "log4j-slf4j-impl" % log4j2Version,
"com.fasterxml.jackson.module" %% "jackson-module-scala" % jacksonVersion,
"org.scanamo" %% "scanamo" % "1.0.0-M23",
"com.gu" %% "simple-configuration-core" % simpleConfigurationVersion,
"org.specs2" %% "specs2-core" % specsVersion % "test",
"org.specs2" %% "specs2-scalacheck" % specsVersion % "test",
"org.specs2" %% "specs2-mock" % specsVersion % "test"
),
libraryDependencies ++= upgradeTransitiveDependencies,
name := s"mobile-purchases-$module",
organization := "com.gu",
description := "Validate Receipts",
version := "1.0",
scalacOptions ++= Seq(
"-deprecation",
"-encoding", "UTF-8",
"-Ywarn-dead-code",
"-Xfatal-warnings",
)
)
}