Git Product home page Git Product logo

Comments (4)

pcj avatar pcj commented on July 27, 2024

Due to sandboxing, just declaring imports = ["external/com_github_google_protobuf/src/"] may not be enough. You can confirm if this is the problem by building with --spawn_strategy=standalone.

In that case, you will also need to tell bazel that the any.proto file needs to be available in the sandbox when the rule is executed. You can do this with the includes attribute, naming the :well_known_protos filegroup that has any.proto in it:

cc_proto_library(
    name = "b_proto_cc",
    protos = [ "a/b.proto", ],
    imports = [
        "external/com_github_google_protobuf/src/",
    ],
    includes = [
        "@com_github_google_protobuf//:well_known_protos",
    ],
    deps = [
        "@com_github_google_protobuf//:cc_wkt_protos",
    ],
)

In a future version of rules_protobuf I think it should be preferable to auto-detect the presence of :cc_wkt_protos (or similar) and just add in the import and include statements implicitly.

If this resolves the problem go ahead and close out the issue. If not, can you post the contents of a/b.proto?

from rules_protobuf.

seungryulchoisc avatar seungryulchoisc commented on July 27, 2024

I added includes lines, but it didn't work either.

I am using CC and Go, so I prefer pubref but I can try cc_proto_library in google/protobuf in this case. Thanks anyways.

from rules_protobuf.

pcj avatar pcj commented on July 27, 2024

OK, but I am interested in not leaving it unsolved. Any chance you can post your proto file? If you have a repo that repoduces it even better.

from rules_protobuf.

seungryulchoisc avatar seungryulchoisc commented on July 27, 2024

Thanks for your help. One way that I found is adding ../../. If you know a better solution, please let me know. Here are my files.

home/WORKSPACE has

git_repository(
    name = "org_pubref_rules_protobuf",
    remote = "https://github.com/pubref/rules_protobuf.git",
    tag = "v0.7.1",
)   

load("@org_pubref_rules_protobuf//cpp:rules.bzl", "cpp_proto_repositories")
cpp_proto_repositories()

new_local_repository(
    name = "c",
    build_file = "BUILD.c",
    path = __workspace_dir__ + "/c/proto",
)

home/BUILD.c has

cc_proto_library(
    name = "b_proto_cc",
    protos = [ "a/b.proto", ],
    imports = [
        "../../external/com_github_google_protobuf/src/",
    ],  
    deps = [
        "@com_github_google_protobuf//:cc_wkt_protos",
    ],
)

home/c/proto/a/b.proto has

syntax = "proto3";
import "google/protobuf/any.proto";
  
message d {
  repeated google.protobuf.Any e = 1;
}

from rules_protobuf.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.