Is "clean.followSymlinks" supposed to work yet?


(shorn) #1

It’s currently marked as incubating, so I’m not sure if that means it’s supposed to work yet.
Maybe it only works properly on Linux at the moment?

Versions: Windows 8, Gradle 3.3, Java 8

A tool I’m using as part of my build (Terraform) makes a symbolic link from my buildDir into my source code.
When I use the Gradle clean task to clean up the project, it’s deleting the source files.

If I recreate the source and re-build, then delete the link manually (press “delete” in Windows explorer) - the source doesn’t get deleted.

I’ve tried this in my build file:

clean {
 followSymlinks false
}

But it doesn’t seem to make the clean task not delete my source files.

My current workaround:

task unlinkTerraformOnWindows(type:Exec) {
  commandLine 'cmd', '/c', 'rmdir', '/q', '/s', file("$buildDir/.terraform")
  enabled Os.isFamily(Os.FAMILY_WINDOWS) &&
    file("$buildDir/.terraform").exists()
}
clean {
  dependsOn unlinkTerraformOnWindows
}