aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/tools/runfiles/BUILD
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/runfiles/BUILD')
-rw-r--r--src/tools/runfiles/BUILD31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/tools/runfiles/BUILD b/src/tools/runfiles/BUILD
index 5ac490d1e2..d3545fd3e7 100644
--- a/src/tools/runfiles/BUILD
+++ b/src/tools/runfiles/BUILD
@@ -20,6 +20,8 @@ filegroup(
name = "embedded_tools",
srcs = [
"BUILD.tools",
+ "runfiles.cc",
+ "runfiles.h",
"runfiles.py",
"//src/tools/runfiles/java/com/google/devtools/build/runfiles:embedded_tools",
],
@@ -38,6 +40,35 @@ py_test(
deps = [":py-runfiles"],
)
+cc_library(
+ name = "cc-runfiles",
+ srcs = ["runfiles.cc"],
+ hdrs = ["runfiles.h"],
+ # This library is available to clients under
+ # @bazel_tools//tools/runfiles:cc-runfiles, with the same source files.
+ # The include statement in runfiles.cc that includes runfiles.h must work
+ # both here in the //src/tools/runfiles package, and in the
+ # @bazel_tools//tools/runfiles package.
+ # runfiles.cc includes "tools/runfiles/runfiles.h" so we need to tell the
+ # compiler to prepend "src" to it so the include path is valid.
+ # Alternatively we could omit this "copts" attribute here and add some
+ # include path manipulating attributes to
+ # @bazel_tools//tools/runfiles:cc-runfiles instead -- that would work too,
+ # but I (laszlocsomor@) find this solution (i.e. the "copts" attribute on
+ # this rule) to be simpler.
+ copts = ["-Isrc"],
+)
+
+cc_test(
+ name = "cc-runfiles-test",
+ srcs = ["runfiles_test.cc"],
+ deps = [
+ ":cc-runfiles",
+ "//src/main/cpp/util:file",
+ "//third_party:gtest",
+ ],
+)
+
sh_library(
name = "runfiles_sh_lib",
srcs = ["runfiles.sh"],