我试图建立一个静态库,其名称我只在处理一些文件后才得到。我有这样的事情:如何在我的Rakefile中声明这种依赖关系?
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
,但我觉得这是太丑陋了。有没有更好的方法来声明这种依赖关系?
我认为他们是等价的。所以,可能这是唯一的方法。 – Geo 2011-04-05 13:57:19
小心点,它们并不完全等效。 #execute将会总是执行任务,即使它已经被调用,而#invoke只会在它尚未被调用时才会执行它。另外,#execute不会执行先决条件,而#invoke会执行。 – 2013-04-01 18:40:15