You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
FileCopyDetails are correct irrespective of the order in which rename{} and eachFile{} are called.
Current Behavior
FileCopyDetails are incorrect if eachFile{} is called before rename{}
Context
We need to print a report of what all files are copied by a copy task with information such as final name of the file at destination, source file path etc. Currently if we call eachFile{} to achieve this, the 'getName()' method returns the name of the file before it is renamed by a rename{} closure which is called after eachFile{}. See example below.
Steps to Reproduce (for bugs)
task A (type: Copy) {
from 'abc.txt'
into buildDir
eachFile { fileCopyDetails ->
println "Copying ${fileCopyDetails.getName()} from ${fileCopyDetails.getSourceName()}"}
}
A.configure {
rename 'xyz.txt'
}
// Prints
Copying abc.txt from abc.txt
Your Environment
Windows 7
The text was updated successfully, but these errors were encountered:
This issue has been automatically marked as stale because it has not had recent activity. Given the limited bandwidth of the team, it will be automatically closed if no further activity occurs. If you're interested in how we try to keep the backlog in a healthy state, please read our blog post on how we refine our backlog. If you feel this is something you could contribute, please have a look at our Contributor Guide. Thank you for your contribution.
This issue has been automatically closed due to inactivity. If you can reproduce this on a recent version of Gradle or if you have a good use case for this feature, please feel free to reopen the issue with steps to reproduce, a quick explanation of your use case or a high-quality pull request.
Related forum post: https://discuss.gradle.org/t/how-to-access-final-name-of-a-file-specified-in-a-rename-closure-inside-eachfile-method/23673
Expected Behavior
FileCopyDetails are correct irrespective of the order in which rename{} and eachFile{} are called.
Current Behavior
FileCopyDetails are incorrect if eachFile{} is called before rename{}
Context
We need to print a report of what all files are copied by a copy task with information such as final name of the file at destination, source file path etc. Currently if we call eachFile{} to achieve this, the 'getName()' method returns the name of the file before it is renamed by a rename{} closure which is called after eachFile{}. See example below.
Steps to Reproduce (for bugs)
task A (type: Copy) {
from 'abc.txt'
into buildDir
eachFile { fileCopyDetails ->
println "Copying ${fileCopyDetails.getName()} from ${fileCopyDetails.getSourceName()}"}
}
A.configure {
rename 'xyz.txt'
}
// Prints
Copying abc.txt from abc.txt
Your Environment
Windows 7
The text was updated successfully, but these errors were encountered: