alphaHeavy / protobuf

An implementation of Google's Protocol Buffers in Haskell.
http://hackage.haskell.org/package/protobuf
BSD 3-Clause "New" or "Revised" License
96 stars 18 forks source link

Support multiple filenames #25

Closed charleslaw closed 8 years ago

charleslaw commented 8 years ago

Protobuf supports having multiple files use the same package, but this doesn't work with hprotoc - the output is package_name.hs.

The way the Python & C++ compilers work, they strip .proto from the filename & use that for the basename of the output file, as opposed to using the package name.

Python: https://github.com/google/protobuf/blob/master/src/google/protobuf/compiler/python/python_generator.cc#L88

C++: https://github.com/google/protobuf/blob/master/src/google/protobuf/compiler/cpp/cpp_generator.cc#L102

This might require setting a flag to keep backwards compatibility (--ignore-package-name).

These 2 files might make a good test:

a.proto:

package Test;
message A{
    required string name=1;
}

b.proto:

package Test;
import "a.proto";
message B{
    required A a=1;
}
charleslaw commented 8 years ago

wrong project