Skip to content

Enhanced support of .proto imports. #12

@Enfernuz

Description

@Enfernuz
  1. The imports of .proto-definitions which are not in the same directory as the current .proto-file are not supported in the current version.
    For example, .proto-imports like import 'myproject/foo/bar/baz.proto'; translate into local myproject/foo/bar/baz_pb = ....
    Also, message and enum types from imported .proto-definitions were not properly referenced in the module which does the import. For example, if xyz.proto has import 'myproject/foo/bar/baz.proto'; and myproject/foo/bar/baz.proto declares package baz.types; and if some message from xyz.proto has a reference to, say, message MyMsg from myproject/foo/bar/baz.proto (as baz.types.MyMsg) then the descriptor of MyMsg in xyz.proto is referenced as module.MYPROJECT/FOO/BAR/BAZ_PB_MYMSG which is not valid Lua code.

  2. Also, there's a typo in the protoc-gen-lua Python script which prevents the use of imports altogether:

for i in includes:
lua('local %s_pb = require \'%s_pb\')\n' % (i, i))

which gives invalid Lua code like local myProto_pb = require 'myProto_pb')

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions