-
Notifications
You must be signed in to change notification settings - Fork 11
/
build.sbt
107 lines (98 loc) · 3.88 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
import com.typesafe.sbt.digest.Import._
import com.typesafe.sbt.uglify.Import._
import com.typesafe.sbt.web.Import._
import net.ground5hark.sbt.concat.Import._
import uk.gov.hmrc.DefaultBuildSettings
import uk.gov.hmrc.DefaultBuildSettings._
lazy val appName = "api-gatekeeper-frontend"
Global / bloopAggregateSourceDependencies := true
Global / bloopExportJarClassifiers := Some(Set("sources"))
ThisBuild / scalaVersion := "2.13.12"
ThisBuild / majorVersion := 0
ThisBuild / evictionWarningOptions := EvictionWarningOptions.default.withWarnScalaVersionEviction(false)
ThisBuild / libraryDependencySchemes += "org.scala-lang.modules" %% "scala-xml" % VersionScheme.Always
ThisBuild / semanticdbEnabled := true
ThisBuild / semanticdbVersion := scalafixSemanticdb.revision
lazy val microservice = Project(appName, file("."))
.enablePlugins(PlayScala, SbtDistributablesPlugin)
.disablePlugins(JUnitXmlReportPlugin)
.settings(
Concat.groups := Seq(
"javascripts/apis-app.js" -> group(
(baseDirectory.value / "app" / "assets" / "javascripts") ** "*.js"
)
),
uglifyCompressOptions := Seq(
"unused=true",
"dead_code=true"
),
uglify / includeFilter := GlobFilter("apis-*.js"),
pipelineStages := Seq(digest),
Assets / pipelineStages := Seq(
concat,
uglify
)
)
.settings(
libraryDependencies ++= AppDependencies(),
retrieveManaged := true,
shellPrompt := (_ => "> ")
)
.settings(
Test / testOptions += Tests.Argument(TestFrameworks.ScalaTest, "-eT"),
Test / unmanagedSourceDirectories += baseDirectory.value / "testCommon"
)
.settings(ScoverageSettings())
.settings(
routesImport ++= Seq(
"uk.gov.hmrc.gatekeeper.controllers.binders._",
"uk.gov.hmrc.gatekeeper.models._",
"uk.gov.hmrc.apiplatform.modules.apis.domain.models._"
)
)
.settings(
TwirlKeys.templateImports ++= Seq(
"views.html.helper.CSPNonce",
"uk.gov.hmrc.hmrcfrontend.views.html.helpers._",
"uk.gov.hmrc.gatekeeper.views.html._",
"uk.gov.hmrc.gatekeeper.views.html.include._",
"uk.gov.hmrc.gatekeeper.controllers",
"uk.gov.hmrc.apiplatform.modules.apis.domain.models._",
"uk.gov.hmrc.gatekeeper.config.AppConfig"
)
)
.settings(
scalacOptions ++= Seq(
"-Wconf:cat=unused&src=views/.*\\.scala:s",
// https://www.scala-lang.org/2021/01/12/configuring-and-suppressing-warnings.html
// suppress warnings in generated routes files
"-Wconf:src=routes/.*:s"
)
)
lazy val it = (project in file("it"))
.enablePlugins(PlayScala)
.dependsOn(microservice % "test->test")
.settings(
name := "integration-tests",
Test / testOptions += Tests.Argument(TestFrameworks.ScalaTest, "-eT"),
DefaultBuildSettings.itSettings(),
addTestReportOption(Test, "int-test-reports")
)
lazy val acceptance = (project in file("acceptance"))
.enablePlugins(PlayScala)
.dependsOn(microservice % "test->test")
.settings(
name := "acceptance-tests",
Test / testOptions += Tests.Argument(TestFrameworks.ScalaTest, "-eT"),
DefaultBuildSettings.itSettings(),
addTestReportOption(Test, "acceptance-reports")
)
commands ++= Seq(
Command.command("cleanAll") { state => "clean" :: "it/clean" :: "acceptance/clean" :: state },
Command.command("fmtAll") { state => "scalafmtAll" :: "it/scalafmtAll" :: "acceptance/scalafmtAll" :: state },
Command.command("fixAll") { state => "scalafixAll" :: "it/scalafixAll" :: "acceptance/scalafixAll" :: state },
Command.command("testAll") { state => "test" :: "it/test" :: "acceptance/test" :: state },
Command.command("run-all-tests") { state => "testAll" :: state },
Command.command("clean-and-test") { state => "cleanAll" :: "compile" :: "run-all-tests" :: state },
Command.command("pre-commit") { state => "cleanAll" :: "fmtAll" :: "fixAll" :: "coverage" :: "testAll" :: "coverageOff" :: "coverageAggregate" :: state }
)