-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathcoveralls.sh
executable file
·56 lines (45 loc) · 1.07 KB
/
coveralls.sh
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
50
51
52
53
54
55
56
#!/bin/bash
trim()
{
trimmed=$1
trimmed=${trimmed%% }
trimmed=${trimmed## }
echo $trimmed
}
# declare BUILT_PRODUCTS_DIR CURRENT_ARCH OBJECT_FILE_DIR_normal SRCROOT OBJROOT
declare -r xctoolVars=$(xctool -showBuildSettings | egrep '(BUILT_PRODUCTS_DIR)|(CURRENT_ARCH)|(OBJECT_FILE_DIR_normal)|(SRCROOT)|(OBJROOT)' | egrep -v 'Pods')
while read line; do
declare key=$(echo "${line}" | cut -d "=" -f1)
declare value=$(echo "${line}" | cut -d "=" -f2)
printf -v "`trim ${key}`" "`trim ${value}`" # https://sites.google.com/a/tatsuo.jp/programming/Home/bash/hentai-bunpou-saisoku-masuta
done < <( echo "${xctoolVars}" )
declare -r gcov_dir="${OBJECT_FILE_DIR_normal}/${CURRENT_ARCH}/"
## ======
generateGcov()
{
# doesn't set output dir to gcov...
cd "${gcov_dir}"
for file in ${gcov_dir}/*.gcda
do
gcov-4.2 "${file}" -o "${gcov_dir}"
done
cd -
}
copyGcovToProjectDir()
{
cp -r "${gcov_dir}" gcov
}
removeGcov(){
rm -r gcov
}
main()
{
# generate + copy
generateGcov
copyGcovToProjectDir
# post
coveralls ${@+"$@"}
# clean up
removeGcov
}
main ${@+"$@"}