我有一个只能为 Linux 构建的目标(在这种情况下,因为它依赖于仅在 Linux 上可用的系统调用,并且不想尝试使这个跨平台)。我如何在我的BUILD文件中表达这一点?
我可以从Platforms 文档中看到存在一个 Linux 平台定义 as @bazel_tools//platforms:linux,但我不清楚如何利用它来限制目标。尝试在compatible_with结果中指定它会导致如下错误:
(13:27:09) ERROR: /foo/BUILD:4:1: in compatible_with attribute of go_library rule //foo:go_default_library: constraint_value rule '@bazel_tools//platforms:linux' is misplaced here (expected environment). Since this rule was created by the macro 'go_library_macro', the error might have been caused by the macro implementation in /foo/BUILD:4:1
Run Code Online (Sandbox Code Playgroud)
所以我有几个相关的问题:
compatible_with. 什么是一个environment,我如何提供一个?(我一直在努力寻找有关此的文档)rules_go也可能尚未更新。如果平台无法实现,是否有“旧方法”来代替?bazel test //:all在不同(非 Linux)平台上运行命令时不会导致构建错误- 即。我希望它只是排除这些,或其他东西。这可能吗?谢谢你的帮助
| 归档时间: |
|
| 查看次数: |
1112 次 |
| 最近记录: |