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

Support filepaths with dots. #153

Open
lucasdicioccio opened this issue Nov 5, 2017 · 2 comments
Open

Support filepaths with dots. #153

lucasdicioccio opened this issue Nov 5, 2017 · 2 comments

Comments

@lucasdicioccio
Copy link
Contributor

Hi, again. On top of #152 I had to make another workaround for the project I was using: the project had a directory with a UNIX-hidden-directory such as .protodir/myfilename.proto . The current plugin will generate modules named Proto..protodir.MyFileName, which is invalid Haskell.

As for the other bug I filed, I wanted to discuss with you the best implementation choices before making a proper pull request. You can find my patches at:
master...lucasdicioccio:workarounds .

@judah
Copy link
Collaborator

judah commented Dec 3, 2017

Thank you for the report. I have mixed feelings about such a change, as well as the discoverability of such a feature. If the user doesn't put the right module name ahead of time in exposed-modules, then proto-lens won't generate code for that .proto file, and the user will need to know ahead of time to use the magic "Dot" replacement in the module name.

At the least, though, we should change the proto generation code to detect if any of the proto files have a . in their path and give a better error message.

In your project, would it have worked to pass the full path to .protodir as the root dir (for example: main = defaultMainGeneratingProtos ".protodir") so that .protodir/myfilename.proto would just become Proto.Myfilename? If so, that would be my preference for the level that we support. But if not, let us know and we can consider another approach.

@judah
Copy link
Collaborator

judah commented Dec 3, 2017

Another possibility would be to allow overriding the generated module name, similar to: https://github.com/google/protobuf/blob/master/src/google/protobuf/descriptor.proto#L324
which might solve a more general class of such problems. Though that would probably require implementing #27 to be able to use Haskell-specific custom options, similar to ScalaPbOptions

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