forked from hmrc/help-to-save-stub
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sbt
136 lines (126 loc) · 5.67 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
import play.core.PlayVersion
import sbt.Keys.compile
import uk.gov.hmrc.DefaultBuildSettings.{addTestReportOption, defaultSettings, scalaSettings}
import uk.gov.hmrc.SbtArtifactory
import uk.gov.hmrc.sbtdistributables.SbtDistributablesPlugin.publishingSettings
import wartremover.{Wart, Warts, wartremoverErrors, wartremoverExcluded}
val appName = "help-to-save-stub"
lazy val appDependencies: Seq[ModuleID] = dependencies ++ testDependencies()
lazy val plugins: Seq[Plugins] = Seq.empty
lazy val playSettings: Seq[Setting[_]] = Seq.empty
val dependencies = Seq(
ws,
"uk.gov.hmrc" %% "play-health" % "3.10.0-play-25",
"uk.gov.hmrc" %% "play-config" % "7.2.0",
"uk.gov.hmrc" %% "domain" % "5.3.0",
"org.scalacheck" %% "scalacheck" % "1.14.0",
"org.typelevel" %% "cats-core" % "1.5.0",
"uk.gov.hmrc" %% "stub-data-generator" % "0.5.3",
"ai.x" %% "play-json-extensions" % "0.10.0",
"uk.gov.hmrc" %% "bootstrap-play-25" % "4.8.0",
"com.github.kxbmap" %% "configs" % "0.4.4",
"com.google.inject" % "guice" % "4.2.0"
)
def testDependencies(scope: String = "test,it") = Seq(
"uk.gov.hmrc" %% "hmrctest" % "3.4.0-play-25" % scope,
"org.scalatest" %% "scalatest" % "3.0.5" % scope,
"com.typesafe.play" %% "play-test" % PlayVersion.current % scope,
"com.miguno.akka" %% "akka-mock-scheduler" % "0.5.1" % scope
)
lazy val scoverageSettings = {
import scoverage.ScoverageKeys
Seq(
// Semicolon-separated list of regexs matching classes to exclude
ScoverageKeys.coverageExcludedPackages := "<empty>;.*config.*;.*(AuthService|BuildInfo|Routes).*",
//ScoverageKeys.coverageMinimum := 70,
ScoverageKeys.coverageFailOnMinimum := true,
ScoverageKeys.coverageHighlighting := true,
parallelExecution in Test := false
)
}
lazy val scalariformSettings = {
import com.typesafe.sbt.SbtScalariform.ScalariformKeys
import scalariform.formatter.preferences._
// description of options found here -> https://github.com/scala-ide/scalariform
ScalariformKeys.preferences := ScalariformKeys.preferences.value
.setPreference(AlignArguments, true)
.setPreference(AlignParameters, true)
.setPreference(AlignSingleLineCaseStatements, true)
.setPreference(CompactControlReadability, false)
.setPreference(CompactStringConcatenation, false)
.setPreference(DanglingCloseParenthesis, Preserve)
.setPreference(DoubleIndentConstructorArguments, true)
.setPreference(DoubleIndentMethodDeclaration, true)
.setPreference(FirstArgumentOnNewline, Preserve)
.setPreference(FirstParameterOnNewline, Preserve)
.setPreference(FormatXml, true)
.setPreference(IndentLocalDefs, true)
.setPreference(IndentPackageBlocks, true)
.setPreference(IndentSpaces, 2)
.setPreference(IndentWithTabs, false)
.setPreference(MultilineScaladocCommentsStartOnFirstLine, false)
.setPreference(NewlineAtEndOfFile, true)
.setPreference(PlaceScaladocAsterisksBeneathSecondAsterisk, false)
.setPreference(PreserveSpaceBeforeArguments, true)
.setPreference(RewriteArrowSymbols, true)
.setPreference(SpaceBeforeColon, false)
.setPreference(SpaceBeforeContextColon, false)
.setPreference(SpaceInsideBrackets, false)
.setPreference(SpaceInsideParentheses, false)
.setPreference(SpacesAroundMultiImports, false)
.setPreference(SpacesWithinPatternBinders, true)
}
lazy val wartRemoverSettings = {
// list of warts here: http://www.wartremover.org/doc/warts.html
val excludedWarts = Seq(
Wart.DefaultArguments,
Wart.FinalCaseClass,
Wart.FinalVal,
Wart.ImplicitConversion,
Wart.ImplicitParameter,
Wart.LeakingSealed,
Wart.Nothing,
Wart.Overloading,
Wart.ToString,
Wart.Var)
wartremoverErrors in (Compile, compile) ++= Warts.allBut(excludedWarts: _*)
}
lazy val microservice = Project(appName, file("."))
.enablePlugins(Seq(play.sbt.PlayScala, SbtAutoBuildPlugin, SbtGitVersioning, SbtDistributablesPlugin, SbtArtifactory) ++ plugins: _*)
.settings(addCompilerPlugin("org.psywerx.hairyfotr" %% "linter" % "0.1.17"))
.settings(playSettings ++ scoverageSettings: _*)
.settings(scalaSettings: _*)
.settings(majorVersion := 2)
.settings(publishingSettings: _*)
.settings(defaultSettings(): _*)
.settings(PlayKeys.playDefaultPort := 7002)
.settings(scalariformSettings: _*)
.settings(wartRemoverSettings)
// disable some wart remover checks in tests - (Any, Null, PublicInference) seems to struggle with
// scalamock, (Equals) seems to struggle with stub generator AutoGen and (NonUnitStatements) is
// imcompatible with a lot of WordSpec
.settings(wartremoverErrors in (Test, compile) --= Seq(Wart.Any, Wart.Equals, Wart.Null, Wart.NonUnitStatements, Wart.PublicInference))
.settings(wartremoverExcluded ++=
routes.in(Compile).value ++
(baseDirectory.value ** "*.sc").get ++
Seq(sourceManaged.value / "main" / "sbt-buildinfo" / "BuildInfo.scala")
)
.settings(
libraryDependencies ++= appDependencies,
retrieveManaged := true,
evictionWarningOptions in update := EvictionWarningOptions.default.withWarnScalaVersionEviction(false),
routesGenerator := StaticRoutesGenerator
)
.settings(scalacOptions += "-Xcheckinit")
.configs(IntegrationTest)
.settings(inConfig(IntegrationTest)(Defaults.itSettings): _*)
.settings(
Keys.fork in IntegrationTest := false,
unmanagedSourceDirectories in IntegrationTest := Seq((baseDirectory in IntegrationTest).value / "it"),
addTestReportOption(IntegrationTest, "int-test-reports"),
//testGrouping in IntegrationTest := oneForkedJvmPerTest((definedTests in IntegrationTest).value),
parallelExecution in IntegrationTest := false)
.settings(resolvers ++= Seq(
Resolver.bintrayRepo("hmrc", "releases"),
Resolver.jcenterRepo
))