1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
# This package contains sources for language-specific runfiles libraries.
#
# Do not depend on these rules. Depend on the ones in @bazel_tools//tools/runfiles instead, that way
# your binary won't require the Bazel source tree to work correctly.
package(default_visibility = ["//visibility:private"])
filegroup(
name = "srcs",
srcs = glob(
["**"],
exclude = [".*"], # .swp files and such
) + [
"//src/tools/runfiles/java/com/google/devtools/build/runfiles:srcs",
],
visibility = ["//src:__pkg__"],
)
filegroup(
name = "embedded_tools",
srcs = [
"BUILD.tools",
"runfiles.cc",
"runfiles.h",
"runfiles.py",
"//src/tools/runfiles/java/com/google/devtools/build/runfiles:embedded_tools",
],
visibility = ["//src:__pkg__"],
)
py_library(
name = "py-runfiles",
srcs = ["runfiles.py"],
)
py_test(
name = "py-runfiles-test",
srcs = ["runfiles_test.py"],
main = "runfiles_test.py",
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"],
)
sh_test(
name = "runfiles_sh_test",
srcs = select({
"//src/conditions:windows": ["runfiles_windows_test.sh"],
"//conditions:default": ["runfiles_posix_test.sh"],
}),
deps = [":runfiles_sh_lib"],
)
test_suite(
name = "windows_tests",
tags = [
"-no_windows",
"-slow",
],
)
test_suite(
name = "all_windows_tests",
tests = [
":windows_tests",
"//src/tools/runfiles/java/com/google/devtools/build/runfiles:all_windows_tests",
],
visibility = ["//src:__pkg__"],
)
|