From kevin.burge at systemware.com Wed May 2 10:03:35 2007 From: kevin.burge at systemware.com (Kevin Burge) Date: Wed, 02 May 2007 09:03:35 -0500 Subject: [Rant] gen Task's "needed" should override dependencies? Message-ID: <20070502140240.F363F5240ABA@rubyforge.org> I've found myself in the following situation more than once. Maybe it's just me. Give the following Rantfile: task :always do puts "always" end gen Task, :never => %w(always) do |t| t.needed { false } t.act { puts 'never' } end task :default => %w(never) do puts 'default' end Would you think that the task "never" should be made or not? You'd think that "default" would only be made, since "never" is never needed... but because "always" is listed as a dependency of never, and always always needs to be made, never is made also, overriding needed being false. Of course, in my code, what I meant it to say was: "task never is only sometimes needed (like on this OS), and when it IS needed, it depends on these other tasks" The work around is this: task :always do puts "always" end gen Task, :never do |t| t.needed { false } t.act { * make "always" * puts 'never' } end task :default => %w(never) do puts 'default' end Am I the only one that sees this as a violation of POLS? Thanks for the consideration, Kevin ps: if the test case doesn't make sense, change the name to the never task, to "sometimes", and replace "needed { false }" with "needed { some_condition }". http://www.systemware.com/ -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/make-cafe/attachments/20070502/2535484d/attachment.html From kevin.burge at systemware.com Wed May 2 10:48:08 2007 From: kevin.burge at systemware.com (Kevin Burge) Date: Wed, 02 May 2007 09:48:08 -0500 Subject: [Rant] gen Task's "needed" should override dependencies? In-Reply-To: <46389A37.80309@systemware.com> References: <46389A37.80309@systemware.com> Message-ID: <20070502144711.AAC97524096F@rubyforge.org> 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). Kevin Burge wrote: > I've found myself in the following situation more than once. Maybe > it's just me. > > Give the following Rantfile: > > task :always do > puts "always" > end > > gen Task, :never => %w(always) do |t| > t.needed { false } > t.act { > puts 'never' > } > end > > task :default => %w(never) do > puts 'default' > end > > Would you think that the task "never" should be made or not? You'd > think that "default" would only be made, since "never" is never > needed... but because "always" is listed as a dependency of never, and > always always needs to be made, never is made also, overriding needed > being false. > > Of course, in my code, what I meant it to say was: > > "task never is only sometimes needed (like on this OS), and when it IS > needed, it depends on these other tasks" > > The work around is this: > > task :always do > puts "always" > end > > gen Task, :never do |t| > t.needed { false } > t.act { > * make "always" > * puts 'never' > } > end > > task :default => %w(never) do > puts 'default' > end > > Am I the only one that sees this as a violation of POLS? > > Thanks for the consideration, > > Kevin > ps: if the test case doesn't make sense, change the name to the never > task, to "sometimes", and replace "needed { false }" with "needed { > some_condition }". > http://www.systemware.com/ -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/make-cafe/attachments/20070502/b95be8fe/attachment.html From kevin.burge at systemware.com Wed May 2 11:03:04 2007 From: kevin.burge at systemware.com (Kevin Burge) Date: Wed, 02 May 2007 10:03:04 -0500 Subject: [Rant] gen Task's "needed" should override dependencies? In-Reply-To: <20070502144711.AAC97524096F@rubyforge.org> References: <46389A37.80309@systemware.com> <20070502144711.AAC97524096F@rubyforge.org> Message-ID: <20070502150209.16957524096F@rubyforge.org> 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