Rule dependencies' behaviour is strange, possibly broken or poorly documented
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 38/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- ruby
- 领域
- build-system
调研方向
根据提供的 Rakefile 重现报告:先运行 rake、rake test.pre、rake test0.txt 和 rake test.txt,然后修改 test.pre 和 test0.pre 后再次运行。跟踪 Rake 的规则依赖解析和时间戳处理。完成标准是依赖行为得到修正或有明确文档说明,并且两个案例都有回归覆盖。
由索引模型根据 Issue 内容生成。
描述
Consider this Rakefile:
require 'rake/clean'
task default: :test
task test: 'test.txt'
file 'test.txt' => 'test0.txt'
rule '.txt' => '.pre' do |t|
sh 'cp', t.source, t.name
end
rule '.pre' do |t|
sh 'touch', t.name
end
CLEAN.include('*.pre')
CLOBBER.include('*.txt')
This Rakefile demonstrates 2 related issues.
The implicit dependency test.pre is not built automatically
In a folder containing only this Rakefile, try:
$ rake
touch test0.pre
cp test0.pre test0.txt
cp test.pre test.txt
cp: cannot stat 'test.pre': No such file or directory
rake aborted!
Command failed with status (1): [cp test.pre test.txt...]
[...]
This creates test0.pre and test0.txt, but fails to create test.pre and test.txt.
However, the following sequence of commands works without issues:
$ rake test.pre
touch test.pre
$ rake
touch test0.pre
cp test0.pre test0.txt
cp test.pre test.txt
Thus, rake knows how to build test.pre, but skips it unless asked explicitly.
Note that despite skipping test.pre, rake builds test0.pre automatically, while both are dependencies by the same rule.
In fact, starting from a folder containing only this Rakefile,
rake test0.txtworks,rake test.txtfails.
Updating test.pre does not trigger rebuilding of test.txt
Assume that everything has been built with
$ rake test.pre
$ rake
Now, try this:
$ touch test.pre
$ rake
Nothing happens.
Now, try:
$ touch test0.pre
$ rake
cp test0.pre test0.txt
cp test.pre test.txt
This triggers rebuilding.
Rake version
rake version: 13.0.6.
- 主要语言
- 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
-
难度 5/5 一周以上 新手友好度 25/100
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 75/100
TheOdinProject/curriculum#31417 · 2 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 70/100
-
难度 2/5 1-3 小时 新手友好度 70/100
-
难度 2/5 1-3 小时 新手友好度 65/100
glossarist/glossarist-ruby#238 ·
-
难度 2/5 1-3 小时 新手友好度 75/100
palladius/rails8-app-on-gcp#145 ·