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

Is it possible to disable the unused warnings for generated src code in target/src_manged? #125

Open
Kalin-Rudnicki opened this issue Oct 26, 2022 · 9 comments

Comments

@Kalin-Rudnicki
Copy link

No description provided.

@iRevive
Copy link

iRevive commented Nov 14, 2022

Not the same, but in Scala 2.13 you can suppress warnings in a directory:

Compile / scalacOptions += "-Wconf:src=target/.*:silent" // suppress all warnings for autogenerated files

@DavidGregory084
Copy link
Member

@iRevive's suggestion is how I've seen most projects deal with this problem (see e.g. https://github.com/hmrc/transit-movements-guarantee-balance/blob/main/build.sbt#L45), but if your code generator uses a custom sbt configuration (i.e. not Compile or Test but e.g. Routes) you could potentially set options in that configuration instead.

@ccarlile
Copy link

ccarlile commented Mar 7, 2023

I came to the repo specifically to find this info - maybe it should be added to the README?

@hugo-vrijswijk
Copy link

Is there a similar option for Scala 3?

@DavidGregory084
Copy link
Member

DavidGregory084 commented Jul 7, 2023

@hugo-vrijswijk The Compiler Options Lookup Table says that -Wconf is available in Scala 3.3.x, so it should be the same?

@hugo-vrijswijk
Copy link

I think the syntax might be different, or it is unsupported:

[warn] Failed to parse `-Wconf` configuration: src=target/.*:silent
[warn] unknown filter: src

@DavidGregory084
Copy link
Member

DavidGregory084 commented Jul 7, 2023

Unfortunately it looks like the src filter for -Wconf is not yet supported on Scala 3.x.

@lenguyenthanh
Copy link
Member

lenguyenthanh commented Aug 17, 2024

fyi src filter is supported in scala 3.3.4 and 3.5.0: scala/scala3#18783

@FunkyFunctor-Chris
Copy link

Confirmed: the following worked for the ScalaPb generated classes on Scala 3.5.1
Compile / scalacOptions += "-Wconf:src=target/scala[^/]*/src_managed/.*:silent"

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

No branches or pull requests

7 participants