Hi guys, *Background:* I'm currently building/prototyping a modified version of the protoc java-compiler. I need to change some things from the standard-implementation for my usecase, but want to keep most of it. To avoid starting from scratch I copied the java-generation-code to my own project and started to modify it. I'm a java-dev, so C++ proves to be quite the challenge, but I'm learning a lot and am nearly finished with what I wanted to do. However now I'm stuck and need your help.
Here is a quick overview of the relevant folders in my project ( https://github.com/leohilbert/protoc-gen-java-leo ): - *include-folder*: "h-files" that I copied over (otherwise no classes from the protoc-libraries were found) - *java-folder*: for my java-library. Also contains my test-proto-files for now (java/src/test/proto). - *src/google/protobuf/compiler/java_leo*: copied and modifed java-generation code from the official repo - *src/javaleo/proto*: the generated c++ code for my custom FieldOption (java/src/test/proto/options.proto) btw: if you have any feedback on my setup, it's greatly appreciated! I'm a C++ noob and trying to understand everything as I go. :) *Now to my actual problem:* If you navigate to src/google/protobuf/compiler/java_leo/java_field.cc <https://github.com/leohilbert/protoc-gen-java-leo/blob/master/src/google/protobuf/compiler/java_leo/java_field.cc> in line 64 you can see that I'm trying to read the value from my custom-field option by calling string test = field->options().GetExtension(javaleo::proto::javatype); This is *always *empty. Although I imported and used this exact custom FieldOption <https://github.com/leohilbert/protoc-gen-java-leo/blob/master/java/src/test/proto/options.proto> in my addressbook.proto <https://github.com/leohilbert/protoc-gen-java-leo/blob/master/java/src/test/proto/addressbook.proto> . The C++-Class for the option.proto is also generated and add in the CMakeList (src/javaleo/proto). "javaleo::proto::javatype" *does* compile, so at least it seems to be in the executable somewhere. What makes me suspicious is that I did not register this custom-extension anywhere in my code. I'm thinking of something like "ExtensionRegistry.registerExtension(javaleo::proto::javatype);" to add to the beginning of my plugin (main.cpp). Otherwise how should protoc know how this field should be interpreted. Am I on the right track here, or did I understand this whole system wrong. I debugged this a lot already and am running out of ideas. Searching for a solution online is also really tricky, because not a lot of people have compiled there own protoc-compiler.. But maybe I'm looking in the wrong direction. I hope my issue is somewhat clear, it's hard describing it when knowing so little about c++ and how protoc works internally.. ^^ TLDR: I need to get the value of my custom-option during code-generation, but my field-option is always ignored. Help :c -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/protobuf/8135f496-9ec3-4e0d-bff2-dd37d85792bc%40googlegroups.com.
