You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 4, 2024. It is now read-only.
If you attempt to use a scalac plugin such as scapegoat or silencer, you'll get the following warning from phase_classpaths:
WARNING! It is slightly inefficient to use a JVM target with dependencies directly as a scalac plugin. Please SingleJar the target before using it as a scalac plugin in order to avoid additional overhead.
However, there is no available rule that makes it possible to "SingleJar" the target.
I wrote a quick rule that exposes the existing singlejar wrapper from rules_scala, but that feels a bit wrong since needs to load the action_singlejar from private/utils.bzl. It seems like it would make sense to add such a rule to make it easier to package plugins?
Hey @bjchambers! Thanks for opening this issue. For plugins that are only referenced directly in one package (like global plugins you specify when configuring the compiler) this shouldn't be an issue (since we only run the singlejar action once either way).
However, if you're specifying a plugin in multiple projects (for instance, directly in the plugins attribute of multiple scala_library/scala_binary targets) then the current approach would singlejar the plugin multiple times. A scala_plugin rule could help in those cases.
I'm only seeing the warning once, but I theorized that is because I have enabled de-duplicating messages. When I used the above to explicitly run onejar in the top-level BUILD where I was defining the global plugins, the total number of actions executed on a clean build was reduced by 57, which made me suspect that the onejar was actually being produced multiple times.
If this really only happens once, it would be good if there was a way to suppress the warning the first time. Could the code that produces this warning (and runs onejar) detect that is being used as part of setting the global plugins and not log?
If you attempt to use a scalac plugin such as scapegoat or silencer, you'll get the following warning from phase_classpaths:
[1] https://github.com/higherkindness/rules_scala/blob/master/rules/private/phases/phase_classpaths.bzl#L25
However, there is no available rule that makes it possible to "SingleJar" the target.
I wrote a quick rule that exposes the existing singlejar wrapper from
rules_scala
, but that feels a bit wrong since needs to load theaction_singlejar
fromprivate/utils.bzl
. It seems like it would make sense to add such a rule to make it easier to package plugins?The text was updated successfully, but these errors were encountered: