Ideas for modes in this plugin #49
Replies: 2 comments
-
The problem I see with your proposal is that this would imply users to select the options they want. Which, IMHO, defeats the purpose of the plugin.
Ideally, we should try to preserve those three properties; especially I think that the best would be that the plugin provides some default sets of options that handle cross-compilation; and then a way to activate and deactivate those sets given some configurations. Also, those sets should be mutually exclusive. This I would imagine something like this (pseudo code)
|
Beta Was this translation helpful? Give feedback.
-
I don't see why we could not provide a default value for the dev-disabled options key. OTOH I wouldn't want to try and guess what options a user should use for their specific project to configure the optimizer. Perhaps that key could default to
👍 I like this idea of providing option |
Beta Was this translation helpful? Give feedback.
-
Recently @BalmungSan proposed #48, which contains some ideas that I am really excited about as it heads in the direction of having different modes for this plugin.
However, the current implementation will not work consistently across versions once e.g.
-Xfatal-warnings
is deprecated and replaced with-Werror
.The problem is that at the moment, once our options are configured, they are just a
Seq[String]
in thescalacOptions
key. It's difficult to work with them in a version-independent way and it's difficult to manipulate that key in general without interfering with the user's custom options.Scala users commonly have a few option sets that they want to use:
At the moment folks don't really seem to do 3. because there is no mechanism that allows them to do that, and they deal with 2. by manually filtering
String
options out inbuild.sbt
, re-importing their build all the time and trying to remember not to commit the code that does that. 😆I have been thinking about how to resolve this and I think the answer is to disconnect this plugin from the
Seq[String]
interface of providing options and to ask users to provide their options via some internal model or DSL.We can have different "modes" for different use cases (dev, CI, release) and different ways of setting the option sets for those modes, i.e. something like:
This would allow us to set
scalacOptions
via something like this and then leave it alone:We could add
tpolecatDevMode
,tpolecatBuildMode
,tpolecatReleaseMode
commands which set thetpolecatOptionsMode
to the desired value rather than interfering withscalacOptions
directly.However I'm currently not sure what
ScalacOption
should be or what setting those "disabled in dev" options and "enabled for release" options should look like:I think that @nafg's project (nafg/scalac-options) can do this part, but I don't know if it's the simplest interface to use at the moment as it is very detailed. It requires users to understand roughly when compiler options were added or removed from the compiler themselves in order to figure out which partial functions to write to match those options. I also worry that it might be difficult to maintain over time as the compiler output for options is not very stable. Perhaps there is a direction that we can take with that interface which makes this specific need a little easier?
Either way, I love the idea of encouraging folks to make better use of the optimizer and I love the idea of making it easier to use this plugin without having to fiddle with options right out of the box, so I look forward to hearing your ideas.
Beta Was this translation helpful? Give feedback.
All reactions