如果未生成目标,则失败

时间:2017-07-14 06:43:41

标签: scons

在使用相当一些自定义构建操作的SCons构建设置中,我有一个冗长的操作,由于目标名称拼写错误而反复重新触发。是否可以配置SCons,以便真正生成构建器(或所有构建器)的目标以防止此类情况发生?

例如,给定

target = Command('some_target_file',
                 'some_input',
                 'echo foo > wrong_target_file'
                 )
带有> scons --debug=explain

将始终显示

scons: building `some_target_file' because it doesn't exist
echo foo > wrong_target_file

没有失败。虽然我想以

的精神出错
Error: target 'some_target_file' was not generated

我可以使用类似

之类的东西来模拟所需的行为
dummy = Command('dummy', 'some_target_file', 'cat $SOURCE')                 
Default ([target, dummy])

导致

...
cat some_target_file
The system cannot find the file specified.
scons: *** [dummy] Error 1
scons: building terminated because of errors.

0 个答案:

没有答案