Is there a better way of running this dynamically generated dependency?

Hi guys!

I asked this in stackoverflow too, but I didn’t receive any answers, so
I thought of trying here.

I’m trying to build a static lib, whose name I only get after I process
some files. I have something like this:

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

But, of course, since I don’t know the name of the dependency when the
task gets ran, the code that should build a.lib doesn’t get executed. I
tried to do like this:

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

To add this as a dependency, but it doesn’t work. I have it like this
now, and it works:

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

but I feel it’s too ugly. Is there a better way to declare this
dependency?