Bazel 宏失败并显示 `name 'glob' is not defined`
Bazel macro fails with `name 'glob' is not defined`
我定义了一个 Bazel 宏。它看起来像这样:
def my_macro():
java_binary(
srcs = glob(["*.java"])
# ...
)
当我 运行 Bazel 时,它因错误而失败
ERROR: /home/.../macros.bzl:105:19: name 'glob' is not defined
是否可以在宏中使用 glob
?
glob
function is only available in BUILD.bazel files. In macro definitions in a .bzl
file, access it as native.glob
.
def my_macro():
java_binary(
srcs = native.glob(["*.java"])
# ...
)
参考文献:https://groups.google.com/forum/#!topic/bazel-discuss/sXa60DnjxiA
我定义了一个 Bazel 宏。它看起来像这样:
def my_macro():
java_binary(
srcs = glob(["*.java"])
# ...
)
当我 运行 Bazel 时,它因错误而失败
ERROR: /home/.../macros.bzl:105:19: name 'glob' is not defined
是否可以在宏中使用 glob
?
glob
function is only available in BUILD.bazel files. In macro definitions in a .bzl
file, access it as native.glob
.
def my_macro():
java_binary(
srcs = native.glob(["*.java"])
# ...
)
参考文献:https://groups.google.com/forum/#!topic/bazel-discuss/sXa60DnjxiA