Merge pull request #158 from TouchInstinct/git_hooks

Added android_hooks folder and gradle task to copy build scripts hooks to project hooks
This commit is contained in:
PilotOfSparrow 2020-01-28 13:04:52 +03:00 committed by GitHub
commit 842ca4aab8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 0 deletions

20
android_hooks/pre-push Executable file
View File

@ -0,0 +1,20 @@
#!/bin/sh
echo "Pre push static analysis"
output=$(./gradlew staticAnalysis --daemon 2>&1)
status=$?
if [ "$status" = 0 ] ; then
exit 0
else
build_date=$(date +'%Y-%m-%d_%T')
file_name="build_$build_date"
folder_name="./build_log/"
file_path="${folder_name}${file_name}"
mkdir -p "$folder_name"
echo "$output" >> "$file_path"
echo "Pre push static failed. Full log path: ${file_path}"
exit 1
fi

View File

@ -0,0 +1,7 @@
task installGitHooks(type: Copy) {
from new File(buildScriptsDir, 'android_hooks')
into { new File(rootProject.rootDir, '.git/hooks') }
fileMode 0777
}
tasks.getByPath(':app:preBuild').dependsOn installGitHooks