简体   繁体   English

向Makefile.am添加自定义命令行以使构建失败

[英]Add a custom command line to Makefile.am in order to fail the build

I have some linux command line which when its output is not empty I need to fail the build. 我有一些linux命令行,当它的输出不为空时,我需要使构建失败。 We perform builds via makefiles that are constructed with AutoMake. 我们通过使用AutoMake构建的makefile执行构建。 There are many nested Makefile.am. 有很多嵌套的Makefile.am。 I tried to add this check to several makefile.am in different ways but couldn't succeed, mostly it is not accepted by the syntax or just doesn't work. 我试图以不同的方式将此检查添加到几个makefile.am中,但未能成功,通常是语法不接受或不起作用。 If I just put this command line after label of make-install and shows an error in the output but doesn't fail the build, this is as far as I got. 如果我只是将此命令行放在make-install的标签之后,并在输出中显示错误,但没有使构建失败,则这是我所知。 Would appreciate some snippet that works. 希望能有一些有用的代码片段。 Thanks 谢谢

We ended up putting this check in the Jenkins build script which is easier. 我们最终将此检查放在了Jenkins构建脚本中,这更加容易。

Another cool solution I used was to create GIT hooks in the pre commit stage for all the clients that can commit (we use GIT as the repository) and check the command there. 我使用的另一个很酷的解决方案是在预提交阶段为所有可以提交的客户端创建GIT挂钩(我们使用GIT作为存储库)并在此处检查命令。 This way no one can commit unless this check works perfectly. 除非这项检查工作完美,否则没有人可以提交。 I modified this example to create such hook: http://codeinthehole.com/writing/tips-for-using-a-git-pre-commit-hook/ Note that symbolic link did not work for me so I used hard link which worked perfectly. 我修改了此示例以创建此类钩子: http : //codeinthehole.com/writing/tips-for-using-a-git-pre-commit-hook/请注意,符号链接对我不起作用,因此我使用了硬链接工作完美。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM