forked from jxnu-liguobin/cs-summary-reflection
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild_before_commit.sh
More file actions
49 lines (46 loc) · 1.29 KB
/
build_before_commit.sh
File metadata and controls
49 lines (46 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/bash
# set -v
# if donnot have all environments, format only your module which edit
enable_language=("java","rust","scala","python","c++","kotlin","ruby")
root_path=`pwd`
# auto compile java and scala
gradle -q spotlessApply
gradle build
for sub_module in $(ls $root_path)
do
module_name=(${sub_module//-/ })
arr_length=${#module_name[*]}
if [[ -d $sub_module ]] && [[ "$arr_length" -eq 2 ]] ;then
echo "sub module [ $sub_module ]"
if [[ $arr_length -eq 2 ]];then
lang=${module_name[0]}
project=${module_name[0]}
is_enable=`echo "${enable_language[@]}" | grep -wq "$lang" && echo "Yes" || echo "No"`
if [[ "$is_enable" = "No" ]];then
echo "############ [ not enable $lang language in this project ]"
break
fi
# compile rust and fmt code, remove unused
case "$lang" in
"rust")
echo "################# [ compile $sub_module ]"
`cd $sub_module;cargo build >/dev/null 2>&1;cargo fmt --all >/dev/null 2>&1;cd .. `;;
# fmt python
"python")
echo "############ [ TODO ]";;
"c++")
echo "############ [ TODO ]";;
"ruby")
echo "############ [ TODO ]";;
*)
echo "| exclude $sub_module";;
esac
for cdir in $(ls $sub_module)
do
echo " | file ############ [ $cdir ]"
done
fi
fi
done
# count
bash countByAuthors.sh