Re: [protobuf] Proto File not found while running protoc

2023-02-24 Thread ritesh singh
I think it's not working with absolute path. If my imports are like this import "com/google/samples/apps/nowinandroid/data/dark_theme_config.proto"; import "com/google/samples/apps/nowinandroid/data/theme_brand.proto"; it wont work. But if it's relative it works import "theme_brand.proto";

Re: [protobuf] Proto File not found while running protoc

2023-02-24 Thread ritesh singh
This is resolved. Thanks. On Saturday, February 25, 2023 at 2:35:02 AM UTC+5:30 Adam Cozzette wrote: > Probably the cleanest solution would be to cd to the directory containing > com/ and run protoc from there: protoc -I . --include_imports > --descriptor_set_out=/dev/stdout >

Re: [protobuf] Protocol message tag had invalid wire type.

2023-02-24 Thread ritesh singh
Ahh yes, thanks a lot. I was using wrong JsonFormat com.android.tools.idea.protobuf.util.JsonFormat On Saturday, February 25, 2023 at 3:47:43 AM UTC+5:30 Adam Cozzette wrote: > Once you have the DynamicMessage, you can use the JsonFormat API the same > way you would use it with ordinary

Re: [protobuf] Protocol message tag had invalid wire type.

2023-02-24 Thread 'Adam Cozzette' via Protocol Buffers
Once you have the DynamicMessage, you can use the JsonFormat API the same way you would use it with ordinary messages. On Fri, Feb 24, 2023 at 1:52 PM ritesh singh wrote: > Thanks, any leads on generating json at run time using dynamicMessage. Any > existing api util if you can point me to. > >

Re: [protobuf] Protocol message tag had invalid wire type.

2023-02-24 Thread ritesh singh
Thanks, any leads on generating json at run time using dynamicMessage. Any existing api util if you can point me to. On Saturday, February 25, 2023 at 2:44:14 AM UTC+5:30 Adam Cozzette wrote: > I think DynamicMessage is the right approach since you need to work with > proto files that are only

Re: [protobuf] Proto File not found while running protoc

2023-02-24 Thread ritesh singh
Thanks Adam. This how my code looks like * fun decodeProto(protoFile: VirtualFile) { try { val fileDescriptorSet = generateFileDescriptorSet(protoFile) val fileDescriptor: Descriptors.FileDescriptor = parseFileDescriptorSet(fileDescriptorSet) val

Re: [protobuf] Protocol message tag had invalid wire type.

2023-02-24 Thread 'Adam Cozzette' via Protocol Buffers
I think DynamicMessage is the right approach since you need to work with proto files that are only known at run time. This will also allow you to generate JSON. On Fri, Feb 24, 2023 at 11:19 AM ritesh singh wrote: > > Or if there's a better different approach instead of relying on >

Re: [protobuf] Proto File not found while running protoc

2023-02-24 Thread 'Adam Cozzette' via Protocol Buffers
Probably the cleanest solution would be to cd to the directory containing com/ and run protoc from there: protoc -I . --include_imports --descriptor_set_out=/dev/stdout com/google/samples/apps/nowinandroid/data/user_preferences.proto On Fri, Feb 24, 2023 at 11:11 AM ritesh singh wrote: > If i

Re: [protobuf] Protocol message tag had invalid wire type.

2023-02-24 Thread ritesh singh
Or if there's a better different approach instead of relying on FileDescriptorSet and DynamicMessage - considering i have access to only .pb (generate by proto-lite) or .proto file. On Saturday, February 25, 2023 at 12:46:44 AM UTC+5:30 ritesh singh wrote: > Thanks Adam, so basically i am

Re: [protobuf] Protocol message tag had invalid wire type.

2023-02-24 Thread ritesh singh
Thanks Adam, so basically i am writing an Intellij plugin for Android Studio. The plugin will just take the .pb file and .proto file, run the protoc compiler, generate FileDescriptorSet for proto and create a DynamicMessage using generated fileDescriptorSet and .pb. I was wondering if there a

Re: [protobuf] Proto File not found while running protoc

2023-02-24 Thread ritesh singh
If i remove imports, it works fine. On Saturday, February 25, 2023 at 12:41:13 AM UTC+5:30 ritesh singh wrote: > It looks like this > > syntax = "proto3"; > > import "com/google/samples/apps/nowinandroid/data/dark_theme_config.proto" > ; > import

Re: [protobuf] Proto File not found while running protoc

2023-02-24 Thread ritesh singh
It looks like this syntax = "proto3"; import "com/google/samples/apps/nowinandroid/data/dark_theme_config.proto"; import "com/google/samples/apps/nowinandroid/data/theme_brand.proto"; option java_package = "com.google.samples.apps.nowinandroid.core.datastore"; option java_multiple_files = true;

Re: [protobuf] Proto File not found while running protoc

2023-02-24 Thread 'Adam Cozzette' via Protocol Buffers
What do the import lines in user_preferences.proto look like? In your case the import paths should point to files relative to the current directory. On Fri, Feb 24, 2023 at 9:40 AM ritesh singh wrote: > I have 3 proto files in the current directory. > > user_preferences.proto imports other

Re: [protobuf] Protocol message tag had invalid wire type.

2023-02-24 Thread 'Adam Cozzette' via Protocol Buffers
A serialized protocol buffer doesn't include any type information, so before you can parse one you have to know in advance which type you're expecting. If you want to be prepared to accept either A or B, then a good solution is to put both types inside a oneof in a parent message, and then just

[protobuf] Better plugin support for cmake builds

2023-02-24 Thread Li He
Hi protobuf community members, I had an idea about some improvements for the protobuf cmake file . It was discussed over a recent merge request

[protobuf] Re: protoc can't import proto file in the same directory

2023-02-24 Thread ritesh singh
Hi Vetch, Were you able to fix it? On Monday, August 8, 2022 at 7:10:04 AM UTC+5:30 Vetch wrote: > I copied all the files in https://github.com/helium/proto/tree/master/src > to my local machine, when i try to generate code for my golang project, > protoc throw some error. > > protoc

[protobuf] Proto File not found while running protoc

2023-02-24 Thread ritesh singh
I have 3 proto files in the current directory. user_preferences.proto imports other protos and all are available in the same directory. But, if i try to run this command, it throws an error. - *Imported file not found.* *protoc --include_imports --descriptor_set_out=/dev/stdout