mirror of
https://gitee.com/devlive-community/datacap.git
synced 2024-12-04 13:09:02 +08:00
54 lines
1.6 KiB
Bash
54 lines
1.6 KiB
Bash
#!/bin/sh
|
|
|
|
isCompile=0
|
|
folders='core,plugin,client,lib,driver,executor'
|
|
|
|
printf "Code verification before submission starting\n"
|
|
|
|
job_before_echo_basic() {
|
|
printf "\n\tJob before echo basic \n"
|
|
printf "============================================\n"
|
|
printf "Runtime time | %s\n" $(date)
|
|
printf "============================================\n\n"
|
|
}
|
|
|
|
job_check_modify_files() {
|
|
for file in $(git diff --name-only --cached | xargs ls); do
|
|
folder=$(echo "$file" | cut -d '/' -f1)
|
|
extension=$(echo "$file" | cut -d . -f2)
|
|
# shellcheck disable=SC2046
|
|
# shellcheck disable=SC2005
|
|
exists=$(echo "$folders" | grep "$folder")
|
|
if [[ "$exists" != "" && "$extension" == "java" ]]; then
|
|
isCompile=1
|
|
break
|
|
else
|
|
isCompile=0
|
|
fi
|
|
done
|
|
}
|
|
|
|
job_check() {
|
|
if [ "$isCompile" -ne 1 ]; then
|
|
printf "\nCode verification before submission successful\n\n"
|
|
exit 0
|
|
else
|
|
if command -v jenv version > /dev/null; then
|
|
jenv exec ./mvnw clean compile -T 1C checkstyle:checkstyle findbugs:findbugs -Dskip.yarn -DskipTests=true -Dgpg.skip
|
|
else
|
|
./mvnw clean compile -T 1C checkstyle:checkstyle findbugs:findbugs -Dskip.yarn -DskipTests=true -Dgpg.skip
|
|
fi
|
|
# shellcheck disable=SC2181
|
|
if [ $? -ne 0 ]; then
|
|
printf "\nCode verification before submission failed\n\n"
|
|
exit 1
|
|
else
|
|
printf "\nCode verification before submission successful\n\n"
|
|
fi
|
|
fi
|
|
}
|
|
|
|
job_before_echo_basic
|
|
job_check_modify_files
|
|
job_check
|