我正在用tup构建一个项目,并希望将当前提交的SHA包含到二进制文件中。问题是tup无法识别.git目录中的依赖项,并且在git HEAD更改时不会重建版本文件。
有问题的Tupfile包含:
: |> git rev-parse HEAD > %o |> version-file
问题如下:
% tup
[...]
[ tup ] [0.068s] Executing Commands...
1) [0.026s] git rev-parse HEAD > version-file
[ ] 100%
% git commit --allow-empty -m "Some commit"
[master b9a0874] Some commit
% tup
[ tup ] [0.000s] Scanning filesystem...
[ tup ] [0.001s] Reading in new environment variables...
[ tup ] [0.001s] No Tupfiles to parse.
[ tup ] [0.001s] No files to delete.
[ tup ] [0.001s] No commands to execute.
[ tup ] [0.001s] Updated.
将.git中的任何文件添加为依赖项会导致:
tup error: You specified a path '.git/refs/heads/*' that contains a hidden filename (since it begins with a '.' character). Tup ignores these files - please remove references to it from the Tupfile.
当前Git提交发生变化时如何进行tup rebuild版本文件?
答案 0 :(得分:0)
您是否看过run ./script args
功能?您可以在Tupfile中有一个规则run generate_git_rule.sh
,然后在该Shell脚本中,首先使用所需的git版本更新文件,然后将其指定为实际规则的输入。