-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.sbt
More file actions
115 lines (100 loc) · 3.77 KB
/
build.sbt
File metadata and controls
115 lines (100 loc) · 3.77 KB
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
import play.sbt.routes.RoutesKeys
import sbt.Def
import scoverage.ScoverageKeys
import uk.gov.hmrc.DefaultBuildSettings
import uk.gov.hmrc.versioning.SbtGitVersioning.autoImport.majorVersion
lazy val appName: String = "pillar2-frontend"
ThisBuild / scalaVersion := "3.3.5"
ThisBuild / majorVersion := 0
ThisBuild / useSuperShell := false
ThisBuild / semanticdbEnabled := true
ThisBuild / semanticdbVersion := scalafixSemanticdb.revision
lazy val root: Project = (project in file("."))
.enablePlugins(PlayScala, SbtDistributablesPlugin)
.disablePlugins(JUnitXmlReportPlugin) // Required to prevent https://github.com/scalatest/scalatest/issues/1427
.settings(
name := appName,
// Play Framework configuration
PlayKeys.playDefaultPort := 10050,
// Routes and templates configuration
RoutesKeys.routesImport ++= Seq(
"models._",
"uk.gov.hmrc.play.bootstrap.binders.RedirectUrl"
),
TwirlKeys.templateImports ++= twirlImports,
// Build and dependency settings
Global / onChangedBuildSource := ReloadOnSourceChanges,
libraryDependencies ++= AppDependencies(),
retrieveManaged := true,
// Test and coverage configuration
inConfig(Test)(testSettings),
scoverageSettings,
// Compiler and formatting settings
Compile / scalafmtOnCompile := true,
Test / scalafmtOnCompile := true,
scalacOptions ++= compilerSettings,
// Asset pipeline configuration
// bundle multiple JS files into a single file
Concat.groups := Seq("javascripts/application.js" -> group(Seq("javascripts/app.js"))),
// prevent minifier from removing code that third-party libraries need
uglifyCompressOptions := Seq("unused=false", "dead_code=false"),
// only minify bundled files generated by concat
uglify / includeFilter := GlobFilter("application.js"),
// add hashes to assets for browser caching
pipelineStages := Seq(digest),
// force asset bundling and minification to run in development mode (normally only runs in production mode)
Assets / pipelineStages := Seq(concat, uglify)
)
lazy val it: Project = project
.enablePlugins(PlayScala)
.dependsOn(root % "test->test") // the "test->test" allows reusing test code and test dependencies
.settings(
DefaultBuildSettings.itSettings(),
libraryDependencies ++= AppDependencies.it
)
lazy val testSettings = Seq(
fork := true,
unmanagedSourceDirectories += baseDirectory.value / "test-utils"
)
lazy val scoverageSettings = Seq(
coverageMinimumStmtTotal := 90.54,
coverageMinimumBranchTotal := 86.55,
coverageFailOnMinimum := true,
coverageHighlighting := true,
coverageExcludedFiles :=
"""|.*handlers.*;
|.*queries.*;
|.*viewmodels.*;
|.*components.*;
|.*config.*;
|.*models.*;
|.*mapping.*;
|.*stubsonly.*;
|.*utils.*;
|.*Routes.*;
|.*views.xml.pdf.*;
|.*views.ViewUtils;
|.*views.html.templates.*;
|""".stripMargin.replaceAll("\n", ";")
)
lazy val twirlImports: Seq[String] = Seq(
"play.twirl.api.HtmlFormat",
"play.twirl.api.HtmlFormat._",
"uk.gov.hmrc.govukfrontend.views.html.components._",
"uk.gov.hmrc.hmrcfrontend.views.html.components._",
"uk.gov.hmrc.hmrcfrontend.views.html.helpers._",
"uk.gov.hmrc.hmrcfrontend.views.config._",
"views.ViewUtils._",
"models.Mode",
"controllers.routes._",
"viewmodels.govuk.all._",
"viewmodels.implicits.given"
)
lazy val compilerSettings = Seq(
"-feature",
"-Wconf:cat=deprecation:w,cat=feature:w,src=target/.*:s,msg=Flag.*repeatedly:s",
"-Yretain-trees"
)
addCommandAlias("prePrChecks", "; scalafmtCheckAll; scalafmtSbtCheck; scalafixAll --check")
addCommandAlias("checkCodeCoverage", "; clean; coverage; test; it/test; coverageReport")
addCommandAlias("lint", "; scalafmtAll; scalafmtSbt; scalafixAll")