Skip to content

[xpcf_grpc_gen] Behavior differs for same types according to whether or not --file argument is used #25

@jim-bcom

Description

@jim-bcom

HOW TO REPRODUCE

  • Generate SolARFrameworkGRPCRemote with script, i.e. in a mode where the SolARFramework compilation database is generated. Command should be
xpcf_grpc_gen \
   --module_uuid <...> \
   --name SolARFramework \
   --project_version <...> \
   --repository SolARBuild@github \
   --url https://github.com/SolarFramework/SolARFramework/releases/download \
   --database_dir <path to compilation db dir> \
   --std c++1z \
   --remove_comments_in_macro \
   --generator protobuf\
   --interfaces_folder ../SolARFramework/interfaces/ \
   --output gen
  • Compare with génération after parsing of single file IARDevice.h
xpcf_grpc_gen \
   --module_uuid <...> \
   --name SolARFramework \
   --project_version <...> \
   --repository SolARBuild@github \
   --url https://github.com/SolarFramework/SolARFramework/releases/download \
   --database_dir <path to compilation db dir> \
   --database_file <path to compilation db dir>/compile_commands.json \
   --file ../SolARFramework/interfaces/api/input/devices/IARDevice.h \
   --std c++1z --remove_comments_in_macro \
   --generator protobuf \
   --interfaces_folder ../SolARFramework/interfaces/ \
   --output gen

EXPECTED BEHAVIOR

  • both commands generate a proto, and then gRPC service/clients for IARDevice

OBSERVED BEHAVIOR

  • Only the generation from the complete database produces a result. When invoking xpcf_grpc_gen with a single file, no proto is generated and thus no gRPC clients/servers.

Attached to this issue, you'll find the complete log of the --file version as well as the matching section in the complete database version log.

Here's the diff:

1c1
< AST for '/home/jmhenaff/dev/SolAR/core/SolARFramework/interfaces/api/input/devices/IARDevice.h':
---
> AST for '../SolARFramework/interfaces/api/input/devices/IARDevice.h':
31,45d30
< parseMethods::Base name=org::bcom::xpcf::IComponentIntrospect
<  ==> parsing member function start ()
< => constness [ not const ]
<  => type [ SolAR::FrameworkReturnCode ]
<  => type kind [  ]
<  => derefed type [ Enum type ]
< SolAR::FrameworkReturnCode
<  ==> Method declaration start()
<  ==> parsing member function stop ()
< => constness [ not const ]
<  => type [ SolAR::FrameworkReturnCode ]
<  => type kind [  ]
<  => derefed type [ Enum type ]
< SolAR::FrameworkReturnCode
<  ==> Method declaration stop()
83d67
< Entity Transform3Df is a type alias
102c86
<  => derefed type [ Enum type ]
---
>  => derefed type [ User defined type ]
119a104
> Found user defined type = SolAR::api::input::devices::IARDevice
157c142,147
< : `static constexpr char const* const DESCRIPTION="SolAR::IARDevice interface";`
\ No newline at end of file
---
> : `static constexpr char const* const DESCRIPTION="SolAR::IARDevice interface";`
> Searching protobuf compiler (protoc) from path: 
> ===> /home/jmhenaff/.conan/data/protobuf/3.21.9/_/_/package/774d45d697ce6041148f1cc945854892effde458/bin/
> Using protobuf compiler (protoc) from path: 
> ===> /home/jmhenaff/.conan/data/protobuf/3.21.9/_/_/package/774d45d697ce6041148f1cc945854892effde458/bin/
> m_protoNameFilesPathMap.size()=0

NOTES
Also other part of code are generated differently, for instance:

return static_cast<SolAR::FrameworkReturnCode>(respOut.xpcfgrpcreturnvalue());

With the DB, becomes, with only one file:

return xpcf::deserialize<SolAR::FrameworkReturnCode>(respOut.xpcfgrpcreturnvalue());

IARDeviceParse-db.txt
IARDeviceParse-file.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions