Skip to content

Commit

Permalink
Merge pull request #58 from DavidGregory084/derived-scalac-options
Browse files Browse the repository at this point in the history
Make settings with dependencies into derived settings
  • Loading branch information
DavidGregory084 authored Mar 30, 2022
2 parents bda560f + ca22727 commit f5a8426
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
3 changes: 3 additions & 0 deletions src/main/scala/io/github/davidgregory084/ScalacOption.scala
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,7 @@ class ScalacOption(
case that: ScalacOption => this.tokens == that.tokens
case _ => false
}

override def toString =
"ScalacOption(" + tokens.mkString(" ") + ")"
}
25 changes: 18 additions & 7 deletions src/main/scala/io/github/davidgregory084/TpolecatPlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -128,17 +128,28 @@ object TpolecatPlugin extends AutoPlugin {
) ++ commandAliases

override def projectSettings: Seq[Setting[_]] = Seq(
scalacOptions := scalacOptionsFor(scalaVersion.value, tpolecatScalacOptions.value),
tpolecatDevModeOptions := ScalacOptions.default,
tpolecatCiModeOptions := tpolecatDevModeOptions.value + ScalacOptions.fatalWarnings,
tpolecatReleaseModeOptions := tpolecatCiModeOptions.value + ScalacOptions.optimizerMethodLocal,
tpolecatScalacOptions := {
(ThisBuild / tpolecatOptionsMode).value match {
Def.derive(
scalacOptions := scalacOptionsFor(scalaVersion.value, tpolecatScalacOptions.value)
),

tpolecatDevModeOptions := ScalacOptions.default,

Def.derive(
tpolecatCiModeOptions := tpolecatDevModeOptions.value + ScalacOptions.fatalWarnings
),

Def.derive(
tpolecatReleaseModeOptions := tpolecatCiModeOptions.value + ScalacOptions.optimizerMethodLocal
),

Def.derive(tpolecatScalacOptions := {
tpolecatOptionsMode.value match {
case DevMode => tpolecatDevModeOptions.value
case CiMode => tpolecatCiModeOptions.value
case ReleaseMode => tpolecatReleaseModeOptions.value
}
},
}),

Compile / console / tpolecatScalacOptions ~= tpolecatConsoleOptionsFilter,
Test / console / tpolecatScalacOptions ~= tpolecatConsoleOptionsFilter
)
Expand Down

0 comments on commit f5a8426

Please sign in to comment.