AbstractCopyTask has @SkipWhenEmpty on it’s getSource call, so the Copy task gets registered a sourceFile. Then SkipEmptySourceFilesTaskExecuter will check for inputs.hasSourceFiles and inputs.sourceFiles. The first is true and then the inputs.sourceFiles is resolved (it’s a FileCollection) and it turns up empty, which then causes the task to be skipped. So, the problem is the FileCollection that AbstractCopyTask provides isn’t including all the CopySpecs. Trying to debug the resolving of a FileCollection is proving to be difficult.
I believe CopyActionImpl.getAllSource() is only looking one level deep from the root spec, and hence second level deep specs are not being considered as part of the allSource FileTree. Or CopySpecImpl$WrapperCopy isn’t contributing sources from it’s wrapped spec. It’s mostly like CopySpecImpl.getSource() needs to contribute sourcePaths from its child. This is most likely since I can see CopySpecImpl.with(CopySpec…) doesn’t add anything to sourcePaths, like CopySpecImpl.from does, and hence there’s no other way for a “with”'d copy spec to be included in getSource(). I’m not sure which it is, but I’m sure I’m close. If this makes sense, can a defect be created?