【发布时间】:2020-06-10 11:13:22
【问题描述】:
我目前正在尝试将一些构建文件从 Bazel 0.19 更新到 Bazel 3.2.0
我有这个文件夹结构
Projectfolder/
|-WORKSPACE
|-third_party/
|-openexr.BUILD
以前,我在 WORKSPACE 文件中定义了以下内容:
...
new_http_archive(
name = "openexr",
build_file = "third_party/openexr.BUILD",
strip_prefix = "openexr-2.2.0",
urls = ["https://github.com/openexr/openexr/archive/v2.2.0.zip"],
)
...
new_http_archive 和 http_archive 在 new bazel 中合并为一个,但我不确定现在正确的语法是什么。以下
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "openexr",
build_file = "@//third_party:openexr.BUILD",
strip_prefix = "openexr-2.2.0",
urls = ["https://github.com/openexr/openexr/archive/v2.2.0.zip"],
)
给我以下错误:
Unable to load package for //third_party:openexr.BUILD: BUILD file not found in any of the following directories. Add a BUILD file to a directory to mark it as a package.
我为 build_file 尝试的其他语法是:
build_file = "third_party/openexr.BUILD",
build_file = "third_party:openexr.BUILD",
build_file = //third_party/openexr.BUILD",
build_file = //third_party:openexr.BUILD",
但它们都给了我一些错误。
与最新 (3.2.0) Bazel 兼容的正确语法是什么?
//编辑:在 Windows 上执行此操作
【问题讨论】:
-
我发现了如何解决它,但我没有发布这个作为答案,因为我不明白它。如果我将一个空的 BUILD 文件放入我的第三方目录,我不会收到错误
标签: bazel bazel-rules