sbt-tpolecat icon indicating copy to clipboard operation
sbt-tpolecat copied to clipboard

Provide a test to replicate issue #102

Open DavidGregory084 opened this issue 1 year ago • 3 comments

This is a test to replicate #102 thanks to @keynmol's great example on the ticket

DavidGregory084 avatar Jul 28 '22 13:07 DavidGregory084

Hmm FWIW @keynmol I actually get the same result here even if sbt-tpolecat is removed from plugins.sbt - -scalajs is not present in the scalacOptions. Am I missing something?

sbt:scalajs> show Compile/scalacOptions
[info] * -Xplugin:/Users/davidgregory/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/scala-js/scalajs-compiler_2.13.8/1.10.1/scalajs-compiler_2.13.8-1.10.1.jar
[success] Total time: 0 s, completed 28 Jul 2022, 14:36:56
sbt:scalajs> show Test/scalacOptions
[info] * -Xplugin:/Users/davidgregory/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/scala-js/scalajs-compiler_2.13.8/1.10.1/scalajs-compiler_2.13.8-1.10.1.jar
[success] Total time: 0 s, completed 28 Jul 2022, 14:37:14
sbt:scalajs> show Runtime/scalacOptions
[info] * -Xplugin:/Users/davidgregory/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/scala-js/scalajs-compiler_2.13.8/1.10.1/scalajs-compiler_2.13.8-1.10.1.jar
[success] Total time: 0 s, completed 28 Jul 2022, 14:37:19
sbt:scalajs> show scalacOptions
[info] * 
[success] Total time: 0 s, completed 28 Jul 2022, 14:37:32
sbt:scalajs> 

DavidGregory084 avatar Jul 28 '22 13:07 DavidGregory084

I've realised now that this -scalajs option is for Scala 3.x only

DavidGregory084 avatar Jul 28 '22 13:07 DavidGregory084

The latest commit attempts to resolve the problem by dropping derived settings and switching to configuration filters.

The immediate problem with this was that manipulating unscoped settings no longer worked, e.g. the following manipulation no longer contributed to Compile/tpolecatReleaseModeOptions:

tpolecatReleaseModeOptions ++= {
  ScalacOptions.optimizerOptions("**") +
    ScalacOptions.release("8") +
    ScalacOptions.privateBackendParallelism(8)
}

This prompted me to try appending to tpolecatReleaseModeOptions in the sbtTpolecatSettings, which unfortunately breaks the ordering of options that we got from using ListSet within the plugin:

    tpolecatDevModeOptions ++= ScalacOptions.default,
    tpolecatCiModeOptions ++= tpolecatDevModeOptions.value + ScalacOptions.fatalWarnings,
    tpolecatReleaseModeOptions ++= tpolecatCiModeOptions.value + ScalacOptions.optimizerMethodLocal,

I'm afraid it did not resolve the problem in any case as we still see settings duplication in the modePerConfiguration test in Test/scalacOptions regardless of whether ++= is used in the tpolecat*Options.

DavidGregory084 avatar Jul 29 '22 13:07 DavidGregory084

No longer needed due to #126

DavidGregory084 avatar Jan 06 '23 12:01 DavidGregory084