diff options
author | Harsh Shandilya <me@msfjarvis.dev> | 2021-10-08 10:38:09 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-08 10:38:09 +0530 |
commit | c7fdd913c599805a92c29a7d1ddd57140e182b6e (patch) | |
tree | 05287fb53feeae9ce6a36a17be57ddd0f43f7c93 /buildSrc/src/main/java/BaseProjectConfig.kt | |
parent | 62d78dd52a4d2949dcef805bfb0c1c1eef65d623 (diff) |
Add `installGitHooks` task for pre-push Git hooks (#1516)
* build: add a pre-push task and Gradle task to install it
* Document `installGitHooks` in contributing.md
Diffstat (limited to 'buildSrc/src/main/java/BaseProjectConfig.kt')
-rw-r--r-- | buildSrc/src/main/java/BaseProjectConfig.kt | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/buildSrc/src/main/java/BaseProjectConfig.kt b/buildSrc/src/main/java/BaseProjectConfig.kt index 06648ae0..2c6f8fdc 100644 --- a/buildSrc/src/main/java/BaseProjectConfig.kt +++ b/buildSrc/src/main/java/BaseProjectConfig.kt @@ -11,6 +11,7 @@ import org.gradle.api.tasks.testing.Test import org.gradle.api.tasks.testing.logging.TestLogEvent import org.gradle.api.tasks.wrapper.Wrapper import org.gradle.kotlin.dsl.maven +import org.gradle.kotlin.dsl.register import org.gradle.kotlin.dsl.repositories import org.gradle.kotlin.dsl.withType import org.gradle.language.nativeplatform.internal.BuildType @@ -26,6 +27,11 @@ internal fun Project.configureForRootProject() { distributionSha256Sum = "f581709a9c35e9cb92e16f585d2c4bc99b2b1a5f85d2badbd3dc6bff59e1e6dd" } configureBinaryCompatibilityValidator() + tasks.register<GitHooks>("installGitHooks") { + val projectDirectory = layout.projectDirectory + hookScript.set(projectDirectory.file("scripts/pre-push-hook.sh").asFile.readText()) + hookOutput.set(projectDirectory.file(".git/hooks/pre-push").asFile) + } } /** Configure all projects including the root project */ |