src/sample/BUILD.bazel:
cc_binary(
name = "example",
srcs = ["main.cpp"],
deps = select({
"//:foo_0", ["mydeps"],
"//:foo_1", None,
}),
)
my_new_rule(
name = "mydeps",
src = glop("/**/*.dat"),
target_compatible_with = ["//:foo_0"],
)
我的规则/废话/身材
load("@rules_python/python:defs.bzl", "py_binary")
py_binary(
name = "gen",
srcs = ["test.py"],
main = ["test.py"],
visibility = ["//visibility:public"],
)
我的规则/blah/defs.bzl
def _my_new_rule_impl(ctx):
# some implementation...
ctx.actions.run(
mnemonic = "...",
executable = ctx.executable._gen
...
)
return ....
my_new_rule = rule(
implementation = _my_new_rule_impl,
attrs = {
"_gen": attr.label(
default = Label("//blah:gen"),
...
),
},
)
我尝试在两个平台上构建上述内容。一个平台有test.py
,另一个平台没有test.py
。
并且,具有test.py
的平台用//:foo_0
指定,另一个平台用//:foo_1
指定。
在上面的例子中,即使我将配置指定为启用//:foo_0
(并禁用//:foo_1
),Bazel似乎也会尝试查找test.py
是否存在。并且,操作(如build、cquery等)失败,如Not found test.py
。
我该怎么办
目前没有回答
相关问题 更多 >
编程相关推荐