// Fixing a bug where libraries are copied into target directory with read-only permission
tasks.withType(InstallExecutable).configureEach {
doFirst {
File d = it.getInstallDirectory().getLocationOnly().map(dir -> dir.dir("lib")).get().getAsFile()
it.libs.each { lib ->
File f = new File(d, lib.name)
if (f.exists()) {
f.writable = true
}
}
}
}
Expected Behavior
Incremental builds should complete
Current Behavior
Consecutive build operations fails saying that one of my dependent libraries that was read-only (.so file checked out as read-only from Perforce).
Context
Slows me down, I have to continuously add "clean" target for every run of my target
Steps to Reproduce (for bugs)
The following code could benefit from adding a 755 file modification on Unix platforms. https://github.com/gradle/gradle/blob/4e8aa8adfaffe18bdf7b4583d4b7e920e4ecbfae/subprojects/platform-native/src/main/java/org/gradle/nativeplatform/tasks/InstallExecutable.java#L260-L265
I've worked around the problem as follows: