[Rake-devel] Changing task dependencies from another task

Jim Weirich jim at weirichhouse.org
Thu Oct 6 10:21:06 EDT 2005

Damphyr said:
> Well this is something I discussed with Stefan Lang (of Rant fame - I
> know, I'm shameless ;) ) on ruby-talk and he provided this:
> $ cat Rakefile
>      @print = lambda { |t| puts t.name }
>      task :A => :B, &@print
>      task :B do |t|
>          file :A => [:C, :D]
>          @print[t]
>      end
>      task :C, &@print
>      task :D, &@print
>      $ rake A
>      (in /home/stefan/tmp/rant-dyn-dep.t)
>      B
>      A
> The desired result would be
> B
> C
> D
> A

Stefan keeps me on my toes and makes sure I don't let rake rest on its
laurels :)

I actually saw the ruby-talk exchange and am investigating what it would
take to have rake do that.  Essentially, it would be a second pass over
the prerequisites to make sure that all of them were invoked.

However, I am trying to understand the kind of problem that needs this
kind of solution. I would like to see a simplified version of your
original problem, with just enough data files to cause the problem.  Just
a simple "cp" command for the transform would be enough.


-- Jim Weirich     jim at weirichhouse.org    http://onestepback.org
"Beware of bugs in the above code; I have only proved it correct,
not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)

More information about the Rake-devel mailing list