From 155c55900fe173ce7755915ad3cfd14730bc1d43 Mon Sep 17 00:00:00 2001 From: Yong Tang Date: Mon, 7 Jan 2019 09:55:55 -0800 Subject: [PATCH] Add repository name to build_defs.bzl (#5104) In flatbuffers, build_defs.bzl has been updated to have the bazel rule `flatbuffer_cc_library` defined. Therefore, it should be possible to build another application and using `flatbuffer_cc_library` directly (by `load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library")`) However, when I tried to do the above, I saw the following errors in bazel: ``` ERROR: /root/.cache/bazel/_bazel_root/c27e9809996ce9a9c0ed8dd79ef0897b/external/arrow/BUILD.bazel:12:1: in deps attribute of cc_library rule @arrow//:arrow_format: target '@arrow//:runtime_cc' does not exist. Since this rule was created by the macro 'flatbuffer_cc_library', the error might have been caused by the macro implementation in /root/.cache/bazel/_bazel_root/c27e9809996ce9a9c0ed8dd79ef0897b/external/com_github_google_flatbuffers/build_defs.bzl:216:16 ``` The reason for the bazel error was that `//:runtime_cc` and `//:flatc` does not have the repo name prefixed. By prefix `` the above bazel build error could be resolved. This fix should help other programs to use flatbuffers directly through bazel. Signed-off-by: Yong Tang --- build_defs.bzl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build_defs.bzl b/build_defs.bzl index 707371ff1..c55ab5180 100644 --- a/build_defs.bzl +++ b/build_defs.bzl @@ -1,7 +1,7 @@ # Description: # BUILD rules for generating flatbuffer files in various languages. -flatc_path = "//:flatc" +flatc_path = "@com_github_google_flatbuffers//:flatc" DEFAULT_INCLUDE_PATHS = [ "./", @@ -214,7 +214,7 @@ def flatbuffer_cc_library( "-parse_headers", ], deps = [ - "//:runtime_cc", + "@com_github_google_flatbuffers//:runtime_cc", ], includes = [], linkstatic = 1,