diff --git a/doc/release_notes/rake-10.0.0.rdoc b/doc/release_notes/rake-10.0.0.rdoc index 4cdebed28..ba0f4d585 100644 --- a/doc/release_notes/rake-10.0.0.rdoc +++ b/doc/release_notes/rake-10.0.0.rdoc @@ -66,6 +66,16 @@ there are a number of features missing: * The deprecated rake/gempackagetask.rb library has been removed. Gem supplies its own package task now. +There is one small behavioral change: + +* Non-file tasks now always report the current time as their time + stamp. This is different from the previous behavior where non-file + tasks reported current time only if there were no prerequisites, and + the max prerequisite timestamp otherwise. This lead to inconsistent + and surprising behavior when adding prerequisites to tasks that in + turn were prequisites to file tasks. The new behavior is more + consistent and predictable. + == Changes (from 0.9.3) Since Rake 10 includes the changes from the last version of Rake 9, diff --git a/lib/rake/task.rb b/lib/rake/task.rb index 4fc1fee51..d496fec31 100644 --- a/lib/rake/task.rb +++ b/lib/rake/task.rb @@ -237,7 +237,7 @@ def needed? # Timestamp for this task. Basic tasks return the current time for their # time stamp. Other tasks can be more sophisticated. def timestamp - prerequisite_tasks.collect { |pre| pre.timestamp }.max || Time.now + Time.now end # Add a description to the task. The description can consist of an option diff --git a/test/test_rake_file_task.rb b/test/test_rake_file_task.rb index f671d0aa4..c10970f09 100644 --- a/test/test_rake_file_task.rb +++ b/test/test_rake_file_task.rb @@ -59,7 +59,7 @@ def test_file_times_new_depend_on_regular_task_timestamps task(name => :phony) - assert ! t1.needed?, "unless the non-file task has a timestamp" + assert t1.needed?, "unless the non-file task has a timestamp" end def test_file_times_old_depends_on_new @@ -83,7 +83,7 @@ def test_file_depends_on_task_depend_on_file Task[:obj].invoke Task[NEWFILE].invoke - assert ! @runs.include?(NEWFILE) + assert @runs.include?(NEWFILE) end def test_existing_file_depends_on_non_existing_file diff --git a/test/test_rake_task.rb b/test/test_rake_task.rb index 836e930ee..ee731c1e1 100644 --- a/test/test_rake_task.rb +++ b/test/test_rake_task.rb @@ -238,7 +238,7 @@ def test_timestamp_returns_latest_prereq_timestamp def b.timestamp() Time.now + 10 end def c.timestamp() Time.now + 5 end - assert_in_delta now + 10, a.timestamp, 0.1, 'computer too slow?' + assert_in_delta now, a.timestamp, 0.1, 'computer too slow?' end def test_always_multitask