Is there a better way of running this dynamically generateddependency?

G

George Opritescu

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top