Skip to content

Commit 10dd161

Browse files
[KAIZEN] Refactor build.sbt
Retain old settings for Compile/doc (otherwise derivation build fails in buildkite)
1 parent a1f4a6a commit 10dd161

File tree

1 file changed

+23
-18
lines changed

1 file changed

+23
-18
lines changed

build.sbt

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,27 @@ val `scala-2.12` = "2.12.13"
4444
val `scala-2.13` = "2.13.6"
4545
val supportedScalaVersions = List(`scala-2.12`, `scala-2.13`)
4646

47+
val baseScalacOptions = Seq(
48+
"-unchecked",
49+
"-deprecation",
50+
"-feature",
51+
"-Ywarn-unused",
52+
"-Xlint",
53+
"-encoding",
54+
"utf-8"
55+
)
56+
57+
// https://www.scala-lang.org/2021/01/12/configuring-and-suppressing-warnings.html
58+
// cat={warning-name}:ws prints a summary with the number of warnings of the given type
59+
// any:e turns all remaining warnings into errors
60+
val fatalWarnings = Seq(
61+
if (sys.env.get("MANTIS_FULL_WARNS").contains("true")) {
62+
"-Wconf:any:w"
63+
}
64+
else {
65+
"-Wconf:cat=deprecation:ws,cat=lint-package-object-classes:ws,cat=unused:ws,cat=lint-infer-any:ws,cat=lint-byname-implicit:ws,cat=other-match-analysis:ws,any:e"
66+
}) ++ Seq("-Ypatmat-exhaust-depth", "off")
67+
4768
def commonSettings(projectName: String): Seq[sbt.Def.Setting[_]] = Seq(
4869
name := projectName,
4970
organization := "io.iohk",
@@ -59,31 +80,15 @@ def commonSettings(projectName: String): Seq[sbt.Def.Setting[_]] = Seq(
5980
resolvers += "Sonatype OSS Snapshots".at("https://oss.sonatype.org/content/repositories/snapshots"),
6081
(Test / testOptions) += Tests
6182
.Argument(TestFrameworks.ScalaTest, "-l", "EthashMinerSpec"), // miner tests disabled by default,
62-
scalacOptions := Seq(
63-
"-unchecked",
64-
"-deprecation",
65-
"-feature",
66-
// https://www.scala-lang.org/2021/01/12/configuring-and-suppressing-warnings.html
67-
// cat={warning-name}:ws prints a summary with the number of warnings of the given type
68-
// any:e turns all remaining warnings into errors
69-
if (sys.env.get("MANTIS_FULL_WARNS").contains("true") || nixBuild) {
70-
"-Wconf:any:w"
71-
}
72-
else {
73-
"-Wconf:cat=deprecation:ws,cat=lint-package-object-classes:ws,cat=unused:ws,cat=lint-infer-any:ws,cat=lint-byname-implicit:ws,cat=other-match-analysis:ws,any:e"
74-
} ,
75-
"-Ywarn-unused",
76-
"-Xlint",
77-
"-encoding",
78-
"utf-8"
79-
) ++ Seq("-Ypatmat-exhaust-depth", "off"),
83+
scalacOptions := baseScalacOptions ++ fatalWarnings,
8084
scalacOptions ++= (if (mantisDev) Seq.empty else compilerOptimizationsForProd),
8185
(Compile / console / scalacOptions) ~= (_.filterNot(
8286
Set(
8387
"-Ywarn-unused-import",
8488
"-Xfatal-warnings"
8589
)
8690
)),
91+
(Compile / doc / scalacOptions) := baseScalacOptions,
8792
scalacOptions ~= (options => if (mantisDev) options.filterNot(_ == "-Xfatal-warnings") else options),
8893
Test / parallelExecution := true,
8994
(Test / testOptions) += Tests.Argument("-oDG"),

0 commit comments

Comments
 (0)