From 7e5dd70f03b8b36958ed55d869bb8cc8279464f5 Mon Sep 17 00:00:00 2001 From: David Gregory Date: Wed, 30 Mar 2022 21:23:41 +0100 Subject: [PATCH 1/2] Make sure that scalacOptions is a derived setting --- src/main/scala/io/github/davidgregory084/ScalacOption.scala | 3 +++ src/main/scala/io/github/davidgregory084/TpolecatPlugin.scala | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/scala/io/github/davidgregory084/ScalacOption.scala b/src/main/scala/io/github/davidgregory084/ScalacOption.scala index a1c2c1d..4a126c2 100644 --- a/src/main/scala/io/github/davidgregory084/ScalacOption.scala +++ b/src/main/scala/io/github/davidgregory084/ScalacOption.scala @@ -36,4 +36,7 @@ class ScalacOption( case that: ScalacOption => this.tokens == that.tokens case _ => false } + + override def toString = + "ScalacOption(" + tokens.mkString(" ") + ")" } diff --git a/src/main/scala/io/github/davidgregory084/TpolecatPlugin.scala b/src/main/scala/io/github/davidgregory084/TpolecatPlugin.scala index bef623f..bca4ef3 100644 --- a/src/main/scala/io/github/davidgregory084/TpolecatPlugin.scala +++ b/src/main/scala/io/github/davidgregory084/TpolecatPlugin.scala @@ -128,7 +128,7 @@ object TpolecatPlugin extends AutoPlugin { ) ++ commandAliases override def projectSettings: Seq[Setting[_]] = Seq( - scalacOptions := scalacOptionsFor(scalaVersion.value, tpolecatScalacOptions.value), + Def.derive(scalacOptions := scalacOptionsFor(scalaVersion.value, tpolecatScalacOptions.value)), tpolecatDevModeOptions := ScalacOptions.default, tpolecatCiModeOptions := tpolecatDevModeOptions.value + ScalacOptions.fatalWarnings, tpolecatReleaseModeOptions := tpolecatCiModeOptions.value + ScalacOptions.optimizerMethodLocal, From ca2272739a579ca9ee1a877bc6683e907b464d3b Mon Sep 17 00:00:00 2001 From: David Gregory Date: Wed, 30 Mar 2022 21:47:54 +0100 Subject: [PATCH 2/2] Make settings with dependencies into derived settings --- .../davidgregory084/TpolecatPlugin.scala | 25 +++++++++++++------ 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/src/main/scala/io/github/davidgregory084/TpolecatPlugin.scala b/src/main/scala/io/github/davidgregory084/TpolecatPlugin.scala index bca4ef3..6c273b4 100644 --- a/src/main/scala/io/github/davidgregory084/TpolecatPlugin.scala +++ b/src/main/scala/io/github/davidgregory084/TpolecatPlugin.scala @@ -128,17 +128,28 @@ object TpolecatPlugin extends AutoPlugin { ) ++ commandAliases override def projectSettings: Seq[Setting[_]] = Seq( - Def.derive(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 )