[Rant] gen Task's "needed" should override dependencies?

Kevin Burge kevin.burge at systemware.com
Wed May 2 11:03:04 EDT 2007


I think I answered my own question:

"needed" is logically an "or" operation: if the task says it needs to be 
made, or any of it's dependencies need to be made, it needs to be made, 
and that's the way it should be.  I'm basically trying to make a task 
NOT a dependency in the "needed" clause, and that's not what "needed" is 
for.

Kevin Burge wrote:
> I just realized that the 'make' work around below doesn't work, 
> because the task made with "make", if it needs to be built, does not 
> cause "this" task to be rebuilt.  Here is the alternate:
>
> task :always do
>   puts "always"
> end
>
> gen Task, :sometimes do |t|
>   t.needed { *somecondition && rant.tasks['always'].needed? *}
>   t.act {
> *    make "always"
> *    puts 'sometimes'
>   }
> end
>
> task :default => %w(sometimes) do
>   puts 'default'
> end
>
> Granted, in this example, "always" will always be needed.... I'm 
> thinking of the scenario of when the dependent task might not always 
> need to be made (like in my code).
>

http://www.systemware.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/make-cafe/attachments/20070502/d4b35a0d/attachment.html 


More information about the make-cafe mailing list