sh_binary和sh_test中数据的重新排列文件夹结构?
假设我有这样的源文件:
.
├── config.json
└── test.sh
我想使用这些文件创建sh_test
。
但是,当测试运行时,test.sh
期望config.json
处于不同的位置:
.
├── configs
│ └── prod.json # config.json
└── test.sh
我不想重新安排我的源代码以满足> test.sh
,我也不想添加一堆文件复制/移动到test.sh
的开始。
是否可以告诉Bazel如何以任意方式安排test.sh
的文件?
理想的语法就是这样:
sh_test(
name = "test",
srcs = [ "test.sh" ],
data = {
"configs/prod.json": "config.json",
},
)
Suppose I have source-files like this:
.
├── config.json
└── test.sh
I want to create an sh_test
using these files.
However, when the test runs, test.sh
expects config.json
to be in a different place:
.
├── configs
│ └── prod.json # config.json
└── test.sh
I do not want to rearrange my source-code to satisfy test.sh
and I also don't want to add a bunch of file copying/moving to the start of test.sh
.
Is it possible to tell Bazel how to arrange the files for test.sh
in an arbitrary way?
Ideal syntax would be like this:
sh_test(
name = "test",
srcs = [ "test.sh" ],
data = {
"configs/prod.json": "config.json",
},
)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用
genrule
:或者,您可以编写与问题中的语法匹配的宏:
Use a
genrule
:Alternatively, you could write a macro that matches the syntax in your question: