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

Unnecessary long filename for InternalFields_xxx files #73

Closed
andresch opened this issue Jan 7, 2016 · 5 comments
Closed

Unnecessary long filename for InternalFields_xxx files #73

andresch opened this issue Jan 7, 2016 · 5 comments

Comments

@andresch
Copy link

andresch commented Jan 7, 2016

I did run (on windows) into the issue of too long file names which caused the compiler to fail writing the InternalFields_xxx.scala document.

While it is primarily Windows to blame for the last century 256 path length limitation, scalaPB seems to generate filenames that are unnecessarily long: xxx contains the full path (from the protobuf root), but since the files are stored in the scala-package directory, using the .proto-filename alone should be sufficient. In my case this would have prevented the error from happening as my protobuf files reside in a quite deep file-hierarchy.

I could workaround the problem by changing my package-structure (shorter names), so no show stopper.

More important than this fix would be a good error message that indicates what went wrong. It took me quite some time to figure out what's going on.

Nevertheless: Thanks a lot for providing and supporting scalaPB!

@thesamet
Copy link
Contributor

thesamet commented Jan 7, 2016

Could you try in your sbt config

scalacOptions ++= Seq("-Xmax-classfile-name", "100")

or some small enough number?

@thesamet
Copy link
Contributor

thesamet commented Jan 7, 2016

What's the exact error you are getting? Agree that the full path isn't necessary and it could easily be fixed.

@andresch
Copy link
Author

andresch commented Jan 8, 2016

the error message I received (from scalaPB, not the scala compiler) is just

{scala-package-path}/InternalFields_{packedProtoFilePath}.scala: No such file or directory

@andresch
Copy link
Author

andresch commented Jan 8, 2016

I tested the suggested scalacOption but it didn't have any impact -- would have been a surprise to me, as the error happens in scalaPB (or eventually in protoc), not in the scala compiler

@thesamet
Copy link
Contributor

thesamet commented Jan 8, 2016

Got it, you're right. We had in the past a similar issue that caused the generated class files to be too long when the protos are nested.

I pushed a fix and 0.4.21 will appear shortly.

@thesamet thesamet closed this as completed Jan 8, 2016
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

2 participants