Marking tasks as :phony fails to prevent rebuild
Nobody has claimed this yet.
- #203 by @juank-pa — closed without merging
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 45/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Stale
- Tech stack
- ruby
- Domain
- build-system
Research direction
Start with lib/rake/phony.rb, then read FileTask#out_of_date? and Task#timestamp as the issue suggests. Run the provided reproduction with source.file and final.file, comparing the first and second rake runs. Done means a :phony prerequisite no longer causes the dependent FileTask to rebuild on the second run.
Written by the indexing model from the issue text.
Description
The :phony task fails to prevent rebuild of FileTasks dependent on non-file tasks.
lib/rake/phony.rb
# Defines a :phony task that you can use as a dependency. This allows
# file-based tasks to use non-file-based tasks as prerequisites
# without forcing them to rebuild.
#
# See FileTask#out_of_date? and Task#timestamp for more info.
require 'rake'
task :phony
Rake::Task[:phony].tap do |task|
def task.timestamp # :nodoc:
Time.at 0
end
end
Code reproducing bug
require 'rake/phony'
task :default => 'final.file'
file 'final.file' => ['source.file', :intermediate] do |f|
touch f.name
end
# Marked as phony, so should not force FileTask to rebuild
task :intermediate => [:phony] do |t|
puts "#{t.name} task"
end
Bug demo
$ touch source.file # Create the source file
$ rake # Run Rake to build 'final.file'
intermediate task
touch final.file
$ rake # Rake should NOT rebuild, but does. <<<<<<<<
intermediate task
touch final.file
Mentioned here
- Dominant language
- Ruby
- Stars
- 2.5k
- Forks
- 649
- Avg merge
- 4m
- Merged PRs (30d)
- 5
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from ruby/rake
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
rake -P output is ambiguous with prereq namespacesPossibly taken @leoarnold claimed this 110 days ago. Open
Difficulty 3/5 1-2 days Newbie friendliness 68/100
-
Difficulty 3/5 1-2 days Newbie friendliness 48/100
-
Difficulty 5/5 Over a week Newbie friendliness 28/100
-
FileList#<< bypasses exclusions while FileList#include respects themPossibly taken @hsbt claimed this 124 days ago. Open
Difficulty 1/5 Under an hour Newbie friendliness 45/100
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 75/100
cline/mcp-marketplace#3886 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
jetrockets/recorder#61 ·
-
PROJECT: website-redesign
Difficulty 1/5 Under an hour Newbie friendliness 72/100
thewca/worldcubeassociation.org#16617 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day