Skip to content

Navigation Menu

Sign up

Is it possible to specify multiple targets from a single source? #436

Unanswered
Stealthmate asked this question in Q&A
Discussion options

Basically I have a binary foo that generates 1.bar, 2.bar and 3.bar. So I wrote a rule

rule(/[1-3]\.bar/ => [ 'foo' ] do |t|
 sh "foo"
end

But if I rake something that needs all 3 outputs, foo gets executed 3 times. My problem is that foo is kind of slow, so executing it 3 times is annoying. Is there a way to make rake only run it once? If not, would it be possible to implement it?

I think the relevante Make concept is Grouped Targets.

You must be logged in to vote

Replies: 1 comment

Comment options

I think that if the action is defined for foo instead for the rule, then it will be ran once.

task :foo do |t|
 sh "foo"
end
rule(/[1-3]\.bar/ => [ 'foo' ]
You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
Converted from issue

This discussion was converted from issue #373 on June 21, 2022 22:18.

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