[GRADLE-2892] Delete task type should support deleting symlinks Created: 20/Sep/13  Updated: 02/Mar/16  Resolved: 02/Mar/16

Status: Resolved
Project: Gradle
Affects Version/s: 1.8-rc-2
Fix Version/s: 2.13-rc-1

Type: Improvement
Reporter: Benjamin Muschko Assignee: Pepper Lebeck-Jobe
Resolution: Fixed Votes: 10


 Description   

Requested on the Gradle forum:

Expose a configuration option for the Delete task that deletes symbolic links without actually deleting the files and directories they are pointing to. The functionality should behave similar to the Ant task.



 Comments   
Comment by Paul Pogonyshev [ 21/May/15 ]

This can easily lead to data loss when you create a symbolic link to an important file you cannot restore. On Unix-like systems `rm` doesn't follow symlinks by default, so one doesn't expect such symlinks to be a problem, but with Gradle they are.

Please raise priority of this issue.

Comment by Paul Pogonyshev [ 21/May/15 ]

Meanwhile, I added this to my 'grade.build':

clean.enabled = false
task (safeclean) << {
"rm --recursive --force ${buildDir}".execute ()
}

clean.finalizedBy safeclean

I first tried by overwriting the 'clean' task, but Gradle warns about this having been deprecated.

Comment by JF Bibeau [ 29/Jun/15 ]

+1 This definitely needs to be an option! With build systems like npm and bower coming into play with their "link" function for development, it took me a while to realize why gradle kept deleting my development files

Generated at Wed Jun 30 12:34:16 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.