forked from hmrc/api-documentation-frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
106 lines (92 loc) · 3.82 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
import com.typesafe.sbt.digest.Import._
import com.typesafe.sbt.uglify.Import.{uglifyCompressOptions, _}
import com.typesafe.sbt.web.Import._
import net.ground5hark.sbt.concat.Import._
import sbt.Keys._
import sbt._
import uk.gov.hmrc.DefaultBuildSettings
import uk.gov.hmrc.DefaultBuildSettings._
import uk.gov.hmrc.sbtdistributables.SbtDistributablesPlugin
import bloop.integrations.sbt.BloopDefaults
Global / bloopAggregateSourceDependencies := true
scalaVersion := "2.13.12"
ThisBuild / libraryDependencySchemes += "org.scala-lang.modules" %% "scala-xml" % VersionScheme.Always
ThisBuild / semanticdbEnabled := true
ThisBuild / semanticdbVersion := scalafixSemanticdb.revision
ThisBuild / evictionWarningOptions := EvictionWarningOptions.default.withWarnScalaVersionEviction(false)
lazy val plugins: Seq[Plugins] = Seq(PlayScala, SbtDistributablesPlugin)
lazy val playSettings: Seq[Setting[_]] = Seq.empty
lazy val microservice = Project(appName, file("."))
.enablePlugins(plugins: _*)
.settings(
name := appName
)
.settings(
Concat.groups := Seq(
"javascripts/apis-app.js" -> group(
(baseDirectory.value / "app" / "assets" / "javascripts" / "combine") ** "*.js"
)
),
uglifyCompressOptions := Seq(
"unused=true",
"dead_code=true"
),
uglify / includeFilter := GlobFilter("apis-*.js"),
pipelineStages := Seq(digest),
Assets / pipelineStages := Seq(
concat,
uglify
)
)
.settings(
resolvers ++= Seq(
Resolver.typesafeRepo("releases")
)
)
.settings(playSettings: _*)
.settings(scalaSettings: _*)
.settings(ScoverageSettings(): _*)
.settings(defaultSettings(): _*)
.settings(
libraryDependencies ++= AppDependencies(),
retrieveManaged := true,
majorVersion := 0,
scalacOptions += "-language:postfixOps"
)
.settings(Compile / unmanagedResourceDirectories += baseDirectory.value / "resources")
.settings(
Test / testOptions := Seq(Tests.Argument(TestFrameworks.ScalaTest, "-eT")),
Test / unmanagedSourceDirectories += baseDirectory.value / "test",
Test / unmanagedSourceDirectories += baseDirectory.value / "testcommon",
Test / fork := false,
Test / parallelExecution := false
)
.configs(AcceptanceTest)
.settings(inConfig(AcceptanceTest)(Defaults.testSettings ++ BloopDefaults.configSettings))
.settings(
AcceptanceTest / testOptions := Seq(Tests.Argument(TestFrameworks.ScalaTest, "-eT")),
AcceptanceTest / unmanagedSourceDirectories += baseDirectory.value / "acceptance",
AcceptanceTest / unmanagedSourceDirectories += baseDirectory.value / "testcommon",
AcceptanceTest / unmanagedResourceDirectories := Seq((AcceptanceTest / baseDirectory).value / "test", (AcceptanceTest / baseDirectory).value / "target/web/public/test"),
AcceptanceTest / fork := false,
AcceptanceTest / parallelExecution := false,
addTestReportOption(AcceptanceTest, "acceptance-test-reports")
)
.settings(DefaultBuildSettings.integrationTestSettings())
.settings(headerSettings(AcceptanceTest) ++ automateHeaderSettings(AcceptanceTest))
.settings(
scalacOptions ++= Seq(
"-Wconf:cat=unused&src=views/.*\\.scala:s",
"-Wconf:cat=unused&src=.*RoutesPrefix\\.scala:s",
"-Wconf:cat=unused&src=.*Routes\\.scala:s",
"-Wconf:cat=unused&src=.*ReverseRoutes\\.scala:s"
)
)
lazy val AcceptanceTest = config("acceptance") extend Test
lazy val appName = "api-documentation-frontend"
commands ++= Seq(
Command.command("run-all-tests") { state => "test" :: "acceptance:test" :: state },
Command.command("clean-and-test") { state => "clean" :: "compile" :: "run-all-tests" :: state },
// Coverage does not need compile !
Command.command("pre-commit") { state => "clean" :: "scalafmtAll" :: "scalafixAll" :: "coverage" :: "run-all-tests" :: "coverageReport" :: "coverageOff" :: state }
)