I am writing my own Gradle plugin. In my task I have a CopySpecInternal. I use the follow code to visit the CopySpec. But I lost the information from the “rename”. How must I visit CopySpecInternal that I receive the target file names? The copyTo is only sample. I will add the files to a container.
CopySpecInternal rootSpec = ...;
rootSpec.buildRootResolver().getAllSource().visit( new FileVisitor() {
@Override
public void visitFile( FileVisitDetails details ) {
// copyTo is a sample
details.copyTo( details.getRelativePath().getFile( target ) );
}
@Override
public void visitDir( FileVisitDetails arg0 ) {
//ignore
}
} );