-
Notifications
You must be signed in to change notification settings - Fork 622
Open
Description
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.txtThus, 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
$ rakeNow, try this:
$ touch test.pre
$ rakeNothing happens.
Now, try:
$ touch test0.pre
$ rake
cp test0.pre test0.txt
cp test.pre test.txtThis triggers rebuilding.
Rake version
rake version: 13.0.6.
Metadata
Metadata
Assignees
Labels
No labels