[Rake-devel] 'rule' ignored (bump)

Tassilo Philipp tphilipp at potion-studios.com
Fri Jun 19 06:08:19 EDT 2009


I'm sorry to bump my initial question - usually I don't like bumping requests, but I'm still confused about the behaviour mentioned in my original mail, and I would definitely like to hear some opinions about this. I'm happy to come up with a patch if the current behaviour is not the expected one, but in order to do so I need to know if it is correct the way it is, or, what behaviour to expect from the sample rakefile below...

Anyhow, here's my initial mail:


I have an issue with a rule in one of my rakefiles and don't really know what behaviour a rake user expects rake to do in that case. I'm working with 0.8.4.

I have boiled it down to the following rakefile (which doesn't make too much sense, but well, it's doing fine to illustrate the problem):


file 'other.x'
file 'bla.o' => ['other.x']

rule '.o' => [ proc { |tn| puts 'proc executed!'; tn+'.c' } ] do |t|
  puts 'writing .o file'
  File.open(t.to_s, 'w') {|f| }

task :default => [ "bla.o" ]


Let's assume we have a bla.o.c file (just create one for this test, content is unimportant), then, when invoking rake, the advanced rule's proc gets evaluated, and the rule's body called, and we end up with a bla.o file.
When invoking rake a second time, not even the rule's proc gets evaluated anymore. However, from what I wanted to do, it should be evaluated - e.g. in order to update bla.o when the timestamp of bla.o.c has changed.
In the example above, bla.o only gets created when it doesn't exist beforehand.

I tried to trace this down in rake.rb, but I didn't find the exact reason, yet.
Anyway, I'm not sure which one of these two possibilities (never create bla.o, or always create/update it) is the expected rake behaviour... so what do you think?


More information about the Rake-devel mailing list