rules_proto icon indicating copy to clipboard operation
rules_proto copied to clipboard

Fully support strip_prefix

Open mpatou-openai opened this issue 10 months ago • 1 comments

In https://github.com/stackb/rules_proto/pull/352 additional support for python was implemented fixing issues with generated code from gazelle but other languages like C++ don't benefit from it.

As a result the proto_cc_library generated is wrong for instance it would generate

proto_cc_library(
    name = "sql_type_cc_library",
    srcs = ["rockset/internal/sql_type.pb.cc"],
    hdrs = ["rockset/internal/sql_type.pb.h"],
    strip_include_prefix = "/proto",
    visibility = ["//visibility:public"],
    deps = ["@com_google_protobuf//:protobuf"],
)

proto_compile(
    name = "sql_type_cpp_compile",
    output_mappings = [
        "sql_type.pb.cc=rockset/internal/sql_type.pb.cc",
        "sql_type.pb.h=rockset/internal/sql_type.pb.h",
    ],
    outputs = [
        "sql_type.pb.cc",
        "sql_type.pb.h",
    ],
    plugins = ["@build_stack_rules_proto//plugin/builtin:cpp"],
    proto = "sql_type_proto",
)

When srcs should be "sqlt_type.pb.cc".

Further more because of the improper handling of prefix stripping the dependencies for the proto_cc_library are missing.

mpatou-openai avatar Feb 09 '25 23:02 mpatou-openai

A potential fix could be something like: https://github.com/mpatou-openai/rules_proto/commit/f96a5d116a32e2e96bc3147ad66ac07b744a997c

mpatou-openai avatar Feb 09 '25 23:02 mpatou-openai

Closing due to age. If you still need help with this, will re-open!

pcj avatar Sep 16 '25 14:09 pcj