[Rake-devel] 'rule' ignored

Tassilo Philipp tphilipp at potion-studios.com
Tue Apr 28 23:40:36 EDT 2009


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