Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix unused nowarn in sbt plugins #6431

Merged
merged 1 commit into from Apr 6, 2021
Merged

Fix unused nowarn in sbt plugins #6431

merged 1 commit into from Apr 6, 2021

Conversation

adpi2
Copy link
Member

@adpi2 adpi2 commented Apr 6, 2021

Fixes #6430

@adpi2 adpi2 requested a review from eed3si9n April 6, 2021 11:23

object SbtPlugin extends AutoPlugin {
override def requires = ScriptedPlugin

override lazy val projectSettings: Seq[Setting[_]] = Seq(
sbtPlugin := true
sbtPlugin := true,
Compile / scalacOptions += "-Wconf:cat=unused-nowarn:s"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this too global? Wouldn't this silence also other "unused" warnings?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This option does only silence the unused @nowarn warnings in the SbtPlugin projects.

@nowarn annotation does not suppress any warnings

It is not a perfect solution because it will silence your own unused @nowarn annotations. But it is very specific to sbt plugins and it is harmless.

A better solution would be to have scala/scala#9491 but it is only available in 2.13.

Copy link
Member

@eed3si9n eed3si9n left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the quick fix!

The fix LGTM but could you add fatal warning to some scripted plugin build as a test plz?

@adpi2 adpi2 force-pushed the fix-6430 branch 4 times, most recently from 3da6160 to 6768987 Compare April 6, 2021 13:09
@adpi2
Copy link
Member Author

adpi2 commented Apr 6, 2021

Test added.

Also the option is only added if scalaVersion >= 2.12.13 because it was not available in 2.12.12.

So the solution in 2.12.12 is to upgrade to 2.12.13

@adpi2 adpi2 requested a review from eed3si9n April 6, 2021 13:49
@eed3si9n eed3si9n merged commit 34a52a4 into sbt:develop Apr 6, 2021
@eed3si9n eed3si9n added this to the 1.5.1 milestone Apr 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

@nowarn annotation does not suppress any warnings when compiling SBT plugins
3 participants