我正在使用 scons 2.5.1。我想创建一个带有更改目标名称的发射器的构建器,例如:
def modify_targets(target, source, env):
target[0] = 'new_target'
return target, source
bld = Builder(action = 'echo $TARGETS - $SOURCES',
suffix = ".out",
src_suffix = '.input',
emitter = modify_targets)
env = Environment(BUILDERS = {'Foo' : bld})
env.Foo('file')
依赖关系树如下所示:
$ scons -Q --tree=all,status
echo new_target - file.input
new_target - file.input
E = exists
R = exists in repository only
b = implicit builder
B = explicit builder
S = side effect
P = precious
A = always build
C = current
N = no clean
H = no cache
[E b ]+-.
[E C ] +-SConstruct
[E C ] +-file.input
[ ] +-file.out
[ B ] +-new_target
[E C ] +-file.input
[E C ] +-/bin/echo
有这个隐含file.out
的应该被发射器移除。当我需要创建对目录的依赖项时(例如,目录是源),这会导致问题。Scons 然后抱怨Implicit dependency 'somedir/file.out' not found, needed by target 'xyz'
。这个文件永远不会存在。如何强制 Builder 不创建隐式依赖项?
更新:似乎 Builder 首先创建了一个SCons.Node.FS.Entry
然后保留在缓存中的某个位置,即使它被发射器从目标列表中删除。