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

Unused imports included in headers break build #268

Open
chrisbenincasa opened this issue May 25, 2017 · 5 comments
Open

Unused imports included in headers break build #268

chrisbenincasa opened this issue May 25, 2017 · 5 comments

Comments

@chrisbenincasa
Copy link
Contributor

Unused imports are included in the headers of generated files causing 2.12 builds with the default -Yfatal-warnings` setting to fail (unless the correct linting options are unset)

Expected behavior

Scrooge generates files with headers including only the imports the current file needs.

Actual behavior

Scrooge generates import statements for classes that are never used.

Steps to reproduce the behavior

Generate a simple class with the following Thrift

struct Simple {
  1: required string simple
}

Compiling with 2.12, with -Xfatal-warnings and -Xlint set, the build will fail.

@chrisbenincasa chrisbenincasa changed the title Unused imports included in headers Unused imports included in headers break build Jun 2, 2017
@yufangong
Copy link
Contributor

Hi @chrisbenincasa , thanks for the issue.
I think this is because scrooge template includes all imports there, the import is unused by some services is being used by others. (I can be totally wrong tho)

Do you want to do some investigation on this issue to find a solution? Get more service ad-hoc generated code instead maybe. Patches are more than welcome!

@chrisbenincasa
Copy link
Contributor Author

@yufangong sorry for the delayed reply! I can take a look at what it would take to fix this up.

@yufangong
Copy link
Contributor

@chrisbenincasa sounds great! Thank you!

@DieMyst
Copy link

DieMyst commented Jan 22, 2018

+1

@henryxparker
Copy link

For others, a way to get around this problem is to add

Compile / scalacOptions += "-Wconf:cat=unused&src=src_managed/.*:s",
Compile / scalacOptions +="-Wconf:cat=deprecation&src=src_managed/.*:s"

to your build.sbt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

5 participants