【发布时间】:2011-07-25 09:21:09
【问题描述】:
我正在尝试构建一个静态库,我只有在处理一些文件后才能获得它的名称。我有这样的事情:
task :lib,:config do |t,args|
# ... do some processing here, get a string representing the
# fullpath of the lib. Imaging libname contains a.lib
file libname => object_files
end
但是,当然,因为我不知道任务运行时依赖项的名称,所以应该构建 a.lib 的代码不会被执行。我试着这样做:
task :lib,:config do |t,args|
# ... do some processing here, get a string representing the
# fullpath of the lib. Imaging libname contains a.lib
file libname => object_files
task :lib => [libname]
end
将此添加为依赖项,但它不起作用。我现在有这样的,它的工作原理:
task :lib,:config do |t,args|
# ... do some processing here, get a string representing the
# fullpath of the lib. Imaging libname contains a.lib
file libname => object_files
Rake.application[libname].invoke
end
但我觉得它太丑了。有没有更好的方法来声明这种依赖关系?
【问题讨论】: