Bazel:在多个http_archive BUILD文件之间共享宏

问题描述 投票:0回答:1

我的项目取决于一些我必须自己做好准备的外部库。因此,我的WORKSPACE

http_archive(
    name = "external_lib_component1",
    build_file = "//third_party:external_lib_component1.BUILD",
    sha256 = "xxx",
    urls = ["https://example.org/external_lib_component1.tar.gz"],
)

http_archive(
    name = "external_lib_component2",
    build_file = "//third_party:external_lib_component2.BUILD",
    sha256 = "yyy",
    urls = ["https://example.org/external_lib_component2.tar.gz"],
)

...

上面的两个条目相似,并且external_lib_component{1, 2}.BUILD共享许多代码。在它们之间共享代码(宏)的最佳方法是什么?

仅将shared_macros.bzl文件放入third_party/将不起作用,因为它不会被复制到建立时的存档位置(仅复制build_file。)>

我的项目取决于一些我必须自己做好准备的外部库。因此,我的工作空间:http_archive(name =“ external_lib_component1”,build_file =“ // third_party:...

bazel
1个回答
0
投票

如果您将bzl这样的./third_party/shared_macros.bzl文件放入您提到的树中,则为您。

© www.soinside.com 2019 - 2024. All rights reserved.