Skip to content

Navigation Menu

Sign up

How to actually interpret needed? #434

Closed

Description

Given the following task dependency graph:

a -> b -> c

What happens if a and c are needed, but b isn't (based on the needed? method)?

Well, a and c will be executed.

But maybe it would have been more efficient to run only a.

So I suppose it all depends on what does actually needed? means for a Task and Rake.

I made a silly experiment where c is not executed in this case, and the test suit pass all the test, so I'm wondering if this case was overlooked or it is actually a design decision. Which in any case, a test case should be added.

Here is a simple Rakefile to test the idea:

desc 'Do A'
task a: [:b] do
 sh 'echo Do A'
end
desc 'Do B'
task b: [:c] do
 sh 'echo Do B'
end
def (Rake::Task[:b]).needed?
 false
end
desc 'Do C'
task :c do
 sh 'echo Do C'
end

Activity

  1. locked and limited conversation to collaborators on Jun 21, 2022
  2. converted this issue into a discussion #435 on Jun 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      AltStyle によって変換されたページ (->オリジナル) /