gradlebuild.gradlegithooksgradle-kotlin-dslkotlin-script

How to solve 'setter for fileMode: Int?' is deprecated. Deprecated in Java in build.gradle


I register a new gradle task in my build.gradle.kts to install git hooks every time I build.

tasks {
    register("installLocalPostCommitGitHook", Copy::class) {
        from(File(rootProject.rootDir, "scripts/post-commit"))
        into { File(rootProject.rootDir, ".git/hooks") }
        fileMode = 0b111101101
    }
}

When I run "Sync Project with Gradle Files" I get the warning

'setter for fileMode: Int?' is deprecated. Deprecated in Java

I need to set the file mode to make the file executable. How can I fix this?


Solution

  • You can use filePermissions block https://docs.gradle.org/current/javadoc/org/gradle/api/file/ConfigurableFilePermissions.html