Skip to content

Commit

Permalink
Install GJF hook using a gradle task, rather than a gradlew hack. (#298)
Browse files Browse the repository at this point in the history
Fixes #297
  • Loading branch information
lazaroclapp committed Apr 5, 2019
1 parent 774aee6 commit 8f06f38
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 13 deletions.
14 changes: 14 additions & 0 deletions build.gradle
Expand Up @@ -38,6 +38,7 @@ subprojects { project ->
errorproneJavac deps.build.errorProneJavac
}
project.tasks.withType(JavaCompile) {
dependsOn(installGitHooks)
options.compilerArgs += [
"-Xlint:unchecked",
"-Xlint:rawtypes",
Expand Down Expand Up @@ -71,3 +72,16 @@ subprojects { project ->
googleJavaFormat {
toolVersion = "1.6"
}

////////////////////////////////////////////////////////////////////////
//
// Google Java Format pre-commit hook installation
//

tasks.register('installGitHooks', Copy) {
from(file('config/hooks/pre-commit-stub')) {
rename 'pre-commit-stub', 'pre-commit'
}
into file('.git/hooks')
fileMode 0777
}
10 changes: 0 additions & 10 deletions config/hooks/install-pre-commit

This file was deleted.

3 changes: 0 additions & 3 deletions gradlew
@@ -1,8 +1,5 @@
#!/usr/bin/env sh

# added manually
./config/hooks/install-pre-commit

##############################################################################
##
## Gradle start up script for UN*X
Expand Down

0 comments on commit 8f06f38

Please sign in to comment.