@@ -44,6 +44,27 @@ val `scala-2.12` = "2.12.13"
44
44
val `scala-2.13` = " 2.13.6"
45
45
val supportedScalaVersions = List (`scala-2.12`, `scala-2.13`)
46
46
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
+
47
68
def commonSettings (projectName : String ): Seq [sbt.Def .Setting [_]] = Seq (
48
69
name := projectName,
49
70
organization := " io.iohk" ,
@@ -59,31 +80,15 @@ def commonSettings(projectName: String): Seq[sbt.Def.Setting[_]] = Seq(
59
80
resolvers += " Sonatype OSS Snapshots" .at(" https://oss.sonatype.org/content/repositories/snapshots" ),
60
81
(Test / testOptions) += Tests
61
82
.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,
80
84
scalacOptions ++= (if (mantisDev) Seq .empty else compilerOptimizationsForProd),
81
85
(Compile / console / scalacOptions) ~= (_.filterNot(
82
86
Set (
83
87
" -Ywarn-unused-import" ,
84
88
" -Xfatal-warnings"
85
89
)
86
90
)),
91
+ (Compile / doc / scalacOptions) := baseScalacOptions,
87
92
scalacOptions ~= (options => if (mantisDev) options.filterNot(_ == " -Xfatal-warnings" ) else options),
88
93
Test / parallelExecution := true ,
89
94
(Test / testOptions) += Tests .Argument (" -oDG" ),
0 commit comments