Marking tasks as :phony fails to prevent rebuild
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 45/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 停滞
- 技术栈
- ruby
- 领域
- build-system
调研方向
从 lib/rake/phony.rb 开始,然后按照 issue 的建议阅读 FileTask#out_of_date? 和 Task#timestamp。使用 source.file 和 final.file 运行提供的复现步骤,并比较第一次和第二次 rake 运行。当 :phony 前置条件不再导致依赖它的 FileTask 在第二次运行时重新构建时,即表示完成。
由索引模型根据 Issue 内容生成。
描述
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
- 主要语言
- Ruby
- 星标
- 2.5k
- 派生
- 650
- 平均合并
- 6 分钟
- 30 天内合并 PR
- 3
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
ruby/rake 的其他 Issue
-
难度 3/5 1-2 天 新手友好度 68/100
-
难度 3/5 1-2 天 新手友好度 48/100
-
难度 5/5 一周以上 新手友好度 28/100
-
难度 1/5 1 小时以内 新手友好度 45/100
-
难度 4/5 3-5 天 新手友好度 38/100
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 75/100
palladius/rails8-app-on-gcp#145 ·
-
难度 2/5 1-3 小时 新手友好度 75/100
-
难度 2/5 1-3 小时 新手友好度 75/100
rubocop/rubocop-rspec#2236 ·
-
bug
难度 2/5 1-3 小时 新手友好度 70/100
riscv/riscv-unified-db#2624 · 1 个 reaction ·
-
难度 1/5 1 小时以内 新手友好度 88/100