Steve Appling wrote:
When using an ant.copy(from, to) it seems that Gradle is eager
evaluating it. Therefor it will throw an error message if the file I
want to copy is not yet available. This seems to be a general problem
with ant tasks. If I want to copy something from or into the libsDir,
ant will complain that the directory is not available (which is true
at evaluation time). Therefor I would have to add an mkdir(dir:
libsDir) before each of these tasks(copy, jar, etc.). Maybe I am
missing something?
I don't think gradle is doing anything eager here. Are you sure that
you are using ant inside the task definition and not when configuring
a task? In other words:
task mycopy {
ant.copy // this is executed at configuration time
}
task mycopy << {
ant.copy // this is executed when the task is executed
}
Note the all important (and confusing) "<<"
You are right. Using "<<" it works like expected. Thanks for the tip.
> What version are you working with? Trunk?
Gradle 0.8-20090914062747+0400
If you want to rename the file, however, it isn't as easy. The
copySpec was designed originally to handle groups of files and
renaming was only done through rules.
I don't really like overloading 'into' to mean either a directory or a
file. How about using 'to' instead of 'into' for single files. Like:
copy {
from 'dir/file1.txt'
to 'dir/file2.txt'
}
This would have to throw an exception if the source wasn't a single
file or you used one of the renaming specs. I think I could do this
fairly easily.
This sounds like a good idea. It would really make some tasks much easier.
Thomas
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email