SCons 忽略功能不起作用
SCons Ignore function not working
我在每个文件编译后生成了一些日志文件。
我通过使用附加到我用来编译该文件的构建器的发射器让 SCons 知道这些文件。
不幸的是,因为我在每次构建后删除空日志文件,SCons 会重新编译源文件,因为日志文件丢失了。
我想使用 SCons 忽略功能忽略这些 'side effect' 文件。
在我的发射器中,我正在做这样的事情:
def compiler_emitter(target, source, env):
target.append(env.File(source[0].name.split('.')[0] + env['ERRSUFFIX']))
env.Ignore(source[0], target[1])
return target, source
请注意,我总是只将一个文件传递给我的构建器。
在我的例子中,忽略功能不起作用。
在 'SCons way' 中解决此问题的最佳方法是什么?
尝试使用 env.SideEffect() 而不是忽略:
SideEffect(side_effect, target) , env.SideEffect(side_effect, target)
Declares side_effect as a side effect of building target. Both
side_effect and target can be a list, a file name, or a node. A side
effect is a target file that is created or updated as a side effect of
building other targets. For example, a Windows PDB file is created as
a side effect of building the .obj files for a static library, and
various log files are created updated as side effects of various TeX
commands. If a target is a side effect of multiple build commands,
scons will ensure that only one set of commands is executed at a time.
Consequently, you only need to use this method for side-effect targets
that are built as a result of multiple build commands.
Because multiple build commands may update the same side effect file,
by default the side_effect target is not automatically removed when
the target is removed by the -c option. (Note, however, that the
side_effect might be removed as part of cleaning the directory in
which it lives.) If you want to make sure the side_effect is cleaned
whenever a specific target is cleaned, you must specify this
explicitly with the Clean or env.Clean function.
我在每个文件编译后生成了一些日志文件。
我通过使用附加到我用来编译该文件的构建器的发射器让 SCons 知道这些文件。
不幸的是,因为我在每次构建后删除空日志文件,SCons 会重新编译源文件,因为日志文件丢失了。
我想使用 SCons 忽略功能忽略这些 'side effect' 文件。
在我的发射器中,我正在做这样的事情:
def compiler_emitter(target, source, env):
target.append(env.File(source[0].name.split('.')[0] + env['ERRSUFFIX']))
env.Ignore(source[0], target[1])
return target, source
请注意,我总是只将一个文件传递给我的构建器。
在我的例子中,忽略功能不起作用。
在 'SCons way' 中解决此问题的最佳方法是什么?
尝试使用 env.SideEffect() 而不是忽略:
SideEffect(side_effect, target) , env.SideEffect(side_effect, target)
Declares side_effect as a side effect of building target. Both side_effect and target can be a list, a file name, or a node. A side effect is a target file that is created or updated as a side effect of building other targets. For example, a Windows PDB file is created as a side effect of building the .obj files for a static library, and various log files are created updated as side effects of various TeX commands. If a target is a side effect of multiple build commands, scons will ensure that only one set of commands is executed at a time. Consequently, you only need to use this method for side-effect targets that are built as a result of multiple build commands.
Because multiple build commands may update the same side effect file, by default the side_effect target is not automatically removed when the target is removed by the -c option. (Note, however, that the side_effect might be removed as part of cleaning the directory in which it lives.) If you want to make sure the side_effect is cleaned whenever a specific target is cleaned, you must specify this explicitly with the Clean or env.Clean function.