You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you use the plugin, but disable the installGitHooks task, the hooks still get executed, for example the following build.gradle would still (try to) install the git hooks:
plugins {
id "com.gtramontina.ghooks.gradle" version "1.1.0"
}
installGitHooks.onlyIf { false }
project.pluginManager.apply(GHooks::class.java)
val result =GradleRunner.create()
.withArguments("installGitHooks")
.withProjectDir(project.rootDir)
.withPluginClasspath()
.build()
result.output shouldMatch ".*something went wrong.*".toRegexGI()
result.output shouldMatch ".*that this is a git repository.*".toRegexGI()
This also currently means that the build succeeds if creating the symlink fails - since the installGitHooks tasks does nothing, it can't fail (and Gradle seems to ignore exceptions that happened during task configuration).
For example, running gradle assemble on this project shows no installGitHooks task is ever called:
11:37:11: Executing task 'assemble'...
Starting Gradle Daemon...
Gradle Daemon started in 1 s 370 ms
Something went wrong while installing your Git hooks.
Please make sure you have `git` installed and that this is a Git repository.
Once these conditions are satisfied, this plugin will ensure the hooks get installed.
java.util.concurrent.CompletionException: java.io.FileNotFoundException: File does not exist: ...\IdeaProjects\ghooks.gradle\.git\hooks
at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:314)
at java.base/java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:319)
at java.base/java.util.concurrent.CompletableFuture$UniAccept.tryFire(CompletableFuture.java:718)
at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:506)
at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1705)
at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.exec(CompletableFuture.java:1692)
at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)
Caused by: java.io.FileNotFoundException: File does not exist: ...\IdeaProjects\ghooks.gradle\.git\hooks
at org.apache.commons.io.FileUtils.forceDelete(FileUtils.java:2396)
at com.gtramontina.ghooks.GHooks.deleteIfExists(GHooks.kt:65)
at com.gtramontina.ghooks.GHooks.symLinkTo(GHooks.kt:58)
at com.gtramontina.ghooks.GHooks.access$symLinkTo(GHooks.kt:13)
at com.gtramontina.ghooks.GHooks$apply$1$4.accept(GHooks.kt:51)
at com.gtramontina.ghooks.GHooks$apply$1$4.accept(GHooks.kt:13)
at java.base/java.util.concurrent.CompletableFuture$UniAccept.tryFire(CompletableFuture.java:714)
... 8 more
> Task :compileKotlin UP-TO-DATE
> Task :compileJava NO-SOURCE
> Task :pluginDescriptors UP-TO-DATE
> Task :processResources UP-TO-DATE
> Task :classes UP-TO-DATE
> Task :inspectClassesForKotlinIC UP-TO-DATE
> Task :jar UP-TO-DATE
> Task :publishPluginJar UP-TO-DATE
> Task :javadoc NO-SOURCE
> Task :publishPluginJavaDocsJar UP-TO-DATE
> Task :assemble UP-TO-DATE
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.6.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD SUCCESSFUL in 5s
7 actionable tasks: 7 up-to-date
11:37:19: Task execution finished 'assemble'.
The text was updated successfully, but these errors were encountered:
Hi,
If you use the plugin, but disable the installGitHooks task, the hooks still get executed, for example the following build.gradle would still (try to) install the git hooks:
This seems to be mostly related to https://github.com/gtramontina/ghooks.gradle/blob/master/src/main/kotlin/com/gtramontina/ghooks/GHooks.kt#L38 not having any
doLast
or similar action blocks.It also seems like the tests (e.g. https://github.com/gtramontina/ghooks.gradle/blob/master/src/test/kotlin/com/gtramontina/ghooks/Standard%20Scenarios.kt#L40) don't actually trigger a Gradle build, but just load the project. Without being able to fully test it, this should probably look something like:
This also currently means that the build succeeds if creating the symlink fails - since the
installGitHooks
tasks does nothing, it can't fail (and Gradle seems to ignore exceptions that happened during task configuration).For example, running
gradle assemble
on this project shows no installGitHooks task is ever called:The text was updated successfully, but these errors were encountered: