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
Now, try this:
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.
Consider this
Rakefile:This
Rakefiledemonstrates 2 related issues.The implicit dependency
test.preis not built automaticallyIn a folder containing only this
Rakefile, try:This creates
test0.preandtest0.txt, but fails to createtest.preandtest.txt.However, the following sequence of commands works without issues:
Thus,
rakeknows how to buildtest.pre, but skips it unless asked explicitly.Note that despite skipping
test.pre,rakebuildstest0.preautomatically, 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.predoes not trigger rebuilding oftest.txtAssume that everything has been built with
Now, try this:
Nothing happens.
Now, try:
This triggers rebuilding.
Rake version
rakeversion:13.0.6.