Open cdmihai opened 8 years ago
A difficulty here is that Copy
currently only accepts a list of files (well, ITaskItem
, but it's assumed they're all files) as its input. A recursive option would require directory inputs.
Additionally, this would make it even more difficult to construct incrementality around a Copy
task. As is, you can define a list of items and a list of destinations outside a <Target>
, then use them as Inputs
and Outputs
for that target. That wouldn't work with a recursive copy, because we wouldn't be able to know what the outputs should be outside of the Copy task itself.
Incrementality might be cheaply provided by the SkipUnchangedFiles flag in this line: https://github.com/Microsoft/msbuild/blob/xplat/src/XMakeTasks/Copy.cs#L551
In case of a recursive copy the code that calls DoCopyIfNecessary would need to first compute the recursive sourceFile / destinationFile pairs and then let DoCopyIfNecessary copy them if necessary.
All this behaviour could be triggered by a RecursiveCopy task parameter. If the flag is false / not present, then the old Copy task behaviour would execute. This should take care of backwards compatibility.
Currently one has to use this idiom (http://blogs.msdn.com/b/msbuild/archive/2005/11/07/490068.aspx) to recursively copy. Without resorting to invoking robocopy or other platform specific commands.
The Copy task should have a
RecursiveCopy
parameter to enable this behaviour.