File tree Expand file tree Collapse file tree 2 files changed +41
-0
lines changed Expand file tree Collapse file tree 2 files changed +41
-0
lines changed Original file line number Diff line number Diff line change @@ -176,6 +176,13 @@ javadoc {
176
176
options. addStringOption(' charSet' , ' UTF-8' )
177
177
}
178
178
179
+ task copyHooks (type : Copy ) {
180
+ from(" hooks" ) {
181
+ include " **"
182
+ }
183
+ into " .git/hooks"
184
+ }
185
+
179
186
task sourcesJar (type : Jar ) {
180
187
from sourceSets. main. allJava
181
188
archiveClassifier = ' sources'
@@ -304,3 +311,4 @@ jar {
304
311
}
305
312
}
306
313
check. dependsOn jacocoTestReport
314
+ verifyGoogleJavaFormat. dependsOn(copyHooks)
Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+ #
3
+ # An example hook script to verify what is about to be committed.
4
+ # Called by "git commit" with no arguments. The hook should
5
+ # exit with non-zero status after issuing an appropriate message if
6
+ # it wants to stop the commit.
7
+ #
8
+ # To enable this hook, rename this file to "pre-commit".
9
+
10
+ bash gradlew verifyGoogleJavaFormat
11
+ result=$?
12
+ printf " the verifyGoogleJavaFormat result code is $result "
13
+ if [[ " $result " = 0 ]] ; then
14
+ echo " \033[32m
15
+ ....
16
+ ....
17
+ verifyGoogleJavaFormat Pass!!
18
+ ....
19
+ ....
20
+ \033[0m"
21
+ exit 0
22
+ else
23
+ bash gradlew goJF
24
+ echo " \033[31m
25
+ ....
26
+ ....
27
+ verifyGoogleJavaFormat Failed!!
28
+ Code format has been automatically adjusted, please review the code and then git add. && git commit;
29
+ ....
30
+ ....
31
+ \033[0m"
32
+ exit 1
33
+ fi
You can’t perform that action at this time.
0 commit comments