Rule dependencies' behaviour is strange, possibly broken or poorly documented

Đang mở
#626 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
38/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
ruby
Lĩnh vực
build-system

Hướng nghiên cứu

Tái hiện báo cáo từ Rakefile được cung cấp, trước tiên chạy rake, rake test.pre, rake test0.txtrake test.txt, sau đó lặp lại sau khi chạm vào test.pretest0.pre. Theo dõi quá trình Rake phân giải các phần phụ thuộc của rule và xử lý timestamp. Hoàn tất khi hành vi của phần phụ thuộc được sửa hoặc được ghi tài liệu rõ ràng, kèm theo phạm vi kiểm thử hồi quy cho cả hai trường hợp.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.txt works,
  • rake test.txt fails.

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.

Ngôn ngữ chính
Ruby
Star
2.5k
Fork
650
Merge trung bình
6 phút
Pull request đã merge (30 ngày)
3

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của ruby/rake

Tất cả issue của ruby/rake

Issue tương tự

Thêm issue về Ruby

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.