Skip to content

Instantly share code, notes, and snippets.

@rflpazini
Created January 23, 2019 01:44
Show Gist options
  • Save rflpazini/a55aaeb18b63e9270fb0cbf536dce9ff to your computer and use it in GitHub Desktop.
Save rflpazini/a55aaeb18b63e9270fb0cbf536dce9ff to your computer and use it in GitHub Desktop.
Build gradle for apply git hooks with google java style guide formatter
plugins {
id 'com.github.sherter.google-java-format' version '0.8'
}
googleJavaFormat {
options style: 'GOOGLE'
}
task installGitHooks(type: Copy) {
into (rootProject.rootDir)
into (new File('.git/hooks')) {
from(rootProject.rootDir, 'scripts/')
include('pre-commit.sh')
rename { String fileName ->
fileName.replace("pre-commit.sh", "pre-commit")
}
fileMode 0777
}
into (new File('.git/hooks')) {
from(rootProject.rootDir, 'scripts/')
include('post-commit.sh')
rename { String fileName ->
fileName.replace("post-commit.sh", "post-commit")
}
fileMode 0777
}
}
build.dependsOn installGitHooks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment