added pre-push hook

This commit is contained in:
alex 2020-01-28 12:39:51 +03:00
parent 6c1b2cb7a5
commit 4206cba099
1 changed files with 21 additions and 0 deletions

21
android_hooks/pre-push Executable file
View File

@ -0,0 +1,21 @@
#!/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