小编mat*_*wiz的帖子

如果我不知道 zip 的内容,如何正确解压缩 bazel 中的文件?

我要定义一个规则来解压缩给定的 zip 文件。但是,例如,我不知道 zip 的内容,因此我无法outs在 genrule 中指定。这似乎是一个常见问题,谷歌搜索让我找到了遇到类似情况的人,但我还没有看到如何解决这个问题的具体例子。

我想要这样的东西:

genrule(
  name="unzip",
  src="file.zip",
  outs=glob(["**"]), # except you're not allowed to use glob here
  cmd = "unzip $(location file)",
)
Run Code Online (Sandbox Code Playgroud)

bazel

6
推荐指数
1
解决办法
1561
查看次数

标签 统计

bazel ×1