Skip to content

Fix module import statements and nested type fields in protoc-gen-d. #33

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

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

ShigekiKarita
Copy link

Protoc on this file: https://github.com/tensorflow/tensorflow/blob/master/tensorflow/core/protobuf/debug_event.proto
generates broken code like this

// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: tensorflow/core/protobuf/debug_event.proto

module tensorflow.debug_event;

import google.protobuf;
import tensorflow.core.framework.tensor;
import tensorflow.core.protobuf.graph_debug_info;

...

struct StackFrameWithId
{
    @Proto(1) string id = protoDefaultValue!string;
    @Proto(2) FileLineCol fileLineCol = protoDefaultValue!FileLineCol;
}

There are two kinds of errors.

1 import module name is not equal to generated files

For example, this line is invalid:

import tensorflow.core.protobuf.graph_debug_info;

It should be import tensorflow.graph_debug_info because it is generated as {package}/{proto basename}.d.

2 nested type field declaration omits its outer class

This line contains an invalid type name:

    @Proto(2) FileLineCol fileLineCol = protoDefaultValue!FileLineCol;

The FileLineCol must be GraphDebugInfo.FileLineCol because the message is nested
https://github.com/tensorflow/tensorflow/blob/161381e3379c9c5bb47acd994838850efde7a385/tensorflow/core/protobuf/graph_debug_info.proto#L11-L13

@dcarp
Copy link
Owner

dcarp commented Jun 15, 2021

Thank you for the contribution!
Could you add some unit-tests to document and verify the use-case?

@ShigekiKarita
Copy link
Author

OK. I added a proto intest, and testing script for travis. However, travis did not detect the change.

@ShigekiKarita
Copy link
Author

image
Oh travis-ci.org ended yesterday. Can you migrate this repo to travis-ci.com or something else?

@ShigekiKarita
Copy link
Author

FYI I confirmed that travis-ci.com worked on my side https://travis-ci.com/github/ShigekiKarita/protobuf-d/jobs/514841261#L1096

@ShigekiKarita
Copy link
Author

Thanks for the review comments. I believe everything is done.

@ShigekiKarita ShigekiKarita force-pushed the fix-module branch 2 times, most recently from 55dc8a1 to c7c29b5 Compare June 17, 2021 06:28
@ShigekiKarita
Copy link
Author

Hi @dcarp, I just noticed that you replaced Travis with GitHub action recently. And I merged the master branch. Can you approve running the workflows?

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

Successfully merging this pull request may close these issues.

2 participants