Git Product home page Git Product logo

rules_proto's People

Contributors

bitshifter10 avatar pcj avatar vmax avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

rules_proto's Issues

node_grpc_compile fails without further error message

I've followed the instructions in README.md but node_grpc_compile simply fails without any detailed error message. The error simply says "<Filename>_grpc_pb.js" was not created, for 2 out of 4 of my files, and I can't get more error message even when using --verbose_failures.

I've isolated the issue on a branch on my repo for you to reproduce it:
https://github.com/haikalpribadi/grakn/tree/bazel-init-pubref-rules-proto

Once you clone the repo, run bazel build //protocol:client-node-proto to reproduce the problem.

com_github_uber_prototool not included in WORKSPACE

There are some external deps referencing https://github.com/uber/prototool that are not found in the workspace:

":darwin": ["@com_github_uber_prototool_darwin//file"],
"//conditions:default": ["@com_github_uber_prototool_linux//file"],

error message:

$ bazel build //...
Starting local Bazel server and connecting to it...
..................
INFO: SHA256 (https://github.com/google/protobuf/archive/48cb18e5c419ddd23d9badcfe4e9df7bde1979b2.tar.gz) = f5a35e17fb07f3b13517264cd17a089636fcbb2912f9df7bef7414058969a8d2
ERROR: /Users/ricky/vsco/rules_proto/BUILD.bazel:2:1: no such package '@com_github_uber_prototool_darwin//file': The repository could not be resolved and referenced by '//:prototool'
ERROR: Analysis of target '//:prototool' failed; build aborted: no such package '@com_github_uber_prototool_darwin//file': The repository could not be resolved
INFO: Elapsed time: 26.527s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (38 packages loaded)
    currently loading: @io_bazel_rules_go//proto

Using proto_source_root in proto_library breaks <lang>_grpc_[compile|library]

Say I have 2 proto files sitting in //some-package/

  • //some-package/A.proto which imports B.proto (without some-package as prefix)
  • //some-package/B.proto

Then I compile the proto_library in //some-package/BUILD`, like the following:

proto_library(
    name = "a-proto",
    srcs = ["a-proto"]
    proto_source_root = "some-package"
)
proto_library(
    name = "b-proto",
    srcs = ["b-proto"]
    proto_source_root = "some-package"
)

The above works well because proto_source_root, which allows us to not have to import one proto file into another using the full path relative from WORKSPACE.

Then I do <lang>_grpc_compile, let's say for java_grpc_compile:

load("@org_pubref_rules_proto//java:compile.bzl", "java_grpc_compile")
java_grpc_compile(
    name = "java-proto",
    deps = [":a-proto"],
)

And here it breaks. java_grpc_compile fails to compile with error:

B.proto: file not found.
some-package/A.proto: Import "B.proto" was not found or had errors.

So basically, A.proto cannot find B.proto. However, when I replace the import statement in A.proto with import some-package/B.proto and remove usage of proto_source_root in proto_library everything works, but we really don't want to do this for many reasons.

Does anyone know what could be the cause and how to work around this?

Bazel can't find rules_proto//java package when running java_grpc_library

Hi @pcj,

I'm trying to use java_grpc_library and hitting my head against the wall. :/

In //dependencies/compilers/dependencies.bzl I have:

def grpc_dependencies():
    ...
    native.git_repository(
        name = "org_pubref_rules_proto",
        remote = "https://github.com/pubref/rules_proto",
        commit = "27da2e7af9e4a1c43c584be2f05be8a301a642b6",
    )

In WORKSPACE I loaded:

load("//dependencies/compilers:dependencies.bzl", "grpc_dependencies")
grpc_dependencies()

load("@org_pubref_rules_proto//java:deps.bzl", "java_grpc_compile")
java_grpc_compile()

Then in the //protocol/BUILD I do:

load("@org_pubref_rules_proto//java:library.bzl", "java_grpc_library")
java_grpc_library(
    name = "client-java-proto",
    deps = [
        "//protocol/session:session-proto",
        "//protocol/keyspace:keyspace-proto",
    ],
    visibility = [
        "//server:__subpackages__",
        "//client-java:__subpackages__",
    ]
)

Then when i run bazel build //protocol:client-java-proto i get this error:

ERROR: /Users/haikalpribadi/Workspace/repos/graknlabs/grakn/protocol/BUILD:20:1: no such package 'java': BUILD file not found on package path and referenced by '//protocol:client-java-proto'

Do you know what I'm missing here? Bazel can't seem to find the java package in rules_proto which is clearly sitting there at the root!

I've pushed it up to my repo, it's on bazel-init-java-grpc-library-fails. https://github.com/haikalpribadi/grakn/tree/bazel-init-java-grp-library-fails

Can you help figure out what's going on?

Missing dependencies in installation instructions

Hi,

In the README.md it simply says that we need to add {lang}:deps.bzl to our WORKSPACE file. For example:

git_repository(
    name = "org_pubref_rules_proto",
    remote = "https://github.com/pubref/rules_proto",
    commit = "27da2e7af9e4a1c43c584be2f05be8a301a642b6",
)
load("@org_pubref_rules_proto//java:deps.bzl", "java_grpc_compile")
java_grpc_compile()

However, trying to run java_grpc_compile after this leads to an error:

ERROR: /Users/haikalpribadi/Workspace/repos/graknlabs/grakn/protocol/BUILD:20:1: every rule of type proto_compile implicitly depends upon the target '@com_google_protobuf//:protoc', but this target could not be found because of: no such package '@com_google_protobuf//'

So then I added @com_google_protobuf as a dependency:

http_archive(
    name = "com_google_protobuf",
    sha256 = "0a4c6d0678eb2f063df332cff1a41647ef692c067b5cfb19e51bca778e79d9e0",
    strip_prefix = "protobuf-3.6.1",
    urls = ["https://github.com/protocolbuffers/protobuf/releases/download/v3.6.1/protobuf-all-3.6.1.zip"],
)

Now I get a different error:

ERROR: /private/var/tmp/_bazel_haikalpribadi/3cdeaa1301f056ec7b4e7ee46bda5c79/external/com_github_grpc_grpc/BUILD:2039:1: no such target '//external:protobuf_headers': target 'protobuf_headers' not declared in package 'external' defined by /Users/haikalpribadi/Workspace/repos/graknlabs/grakn/WORKSPACE and referenced by '@com_github_grpc_grpc//:grpc++_config_proto'
ERROR: /private/var/tmp/_bazel_haikalpribadi/3cdeaa1301f056ec7b4e7ee46bda5c79/external/com_github_grpc_grpc/BUILD:388:1: no such target '//external:protobuf_clib': target 'protobuf_clib' not declared in package 'external' defined by /Users/haikalpribadi/Workspace/repos/graknlabs/grakn/WORKSPACE and referenced by '@com_github_grpc_grpc//:grpc_plugin_support'

So I suspected that I'm missing @com_github_grpc_grpc, so I added:

git_repository(
    name = "com_github_grpc_grpc",
    remote = "https://github.com/grpc/grpc",
    tag = "v1.15.1"
)

However, it still gives the error as shown above, so I checked in your WORKSPACE file and saw that you had the following two lines to load grpc_deps.bzl, and I copied them into my WORKSPACE file.

load("@com_github_grpc_grpc//bazel:grpc_deps.bzl", com_github_grpc_grpc_bazel_grpc_deps = "grpc_deps")
com_github_grpc_grpc_bazel_grpc_deps()

Now everything works fine, and the proto files compile. However, I'm worried that I'm doing something wrong/unnecessary above, as you did not put them in your documentation. Thus, my questions are:

  1. Is the above code needed in my WORKSPACE? Because I thought {lang}:deps.bzl was going to take care of it. But if it is needed, ...
    a. Why is it needed? If not, then ...
    b. Is there a simpler approach which I should have taken?

Sandbox-copied protos are not used in compilation

python_grpc_compile fails to compile generated .proto file (it's copied into sandbox, but not used in compilation)

Example can be found here: vmax/org_pubref_rules_proto_bug_sample

ghost:rules_proto_example vmax$ bazel build //:routeguide_gen_grpc
INFO: Analysed target //:routeguide_gen_grpc (0 packages loaded).
INFO: Found 1 target...
ERROR: /Users/vmax/work/GraknLabs/rules_proto_example/BUILD:35:1: error executing shell command: 'bazel-out/host/bin/external/com_google_protobuf/protoc --descriptor_set_out=bazel-out/darwin-fastbuild/genfiles/routeguide_gen_grpc/descriptor.source.bin --proto_path=bazel-out/darwin-fastbuild/gen...' failed (Exit 1)
bazel-out/darwin-fastbuild/genfiles/routeguide_gen.proto: No such file or directory
Target //:routeguide_gen_grpc failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 0,235s, Critical Path: 0,05s
INFO: 0 processes.
FAILED: Build did NOT complete successfully

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.