-
Notifications
You must be signed in to change notification settings - Fork 9
/
cov.sh
executable file
·45 lines (37 loc) · 982 Bytes
/
cov.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
#!/bin/sh -l
PATH=$PATH
BIN_PATH="$(swift build --show-bin-path)"
XCTEST_PATH="$(find ${BIN_PATH} -name '*.xctest')"
COV_BIN=$XCTEST_PATH
INSTR_PROFILE=.build/debug/codecov/default.profdata
IGNORE_FILENAME_REGEX=".build|Tests"
FORMAT="lcov"
OUTPUT_FILE=.build/debug/codecov/lcov.info
while :; do
case $1 in
-f|--format) FORMAT=$2
shift
;;
-o|--output) OUTPUT_FILE=$2
shift
;;
*) break
esac
shift
done
if [[ "$OSTYPE" == "darwin"* ]]; then
f="$(basename $XCTEST_PATH .xctest)"
COV_BIN="${COV_BIN}/Contents/MacOS/$f"
PATH="/usr/local/opt/llvm/bin:$PATH"
fi
mkdir -p "$(dirname "$OUTPUT_FILE")"
llvm-cov report \
"${COV_BIN}" \
-instr-profile=$INSTR_PROFILE \
-ignore-filename-regex=$IGNORE_FILENAME_REGEX \
-use-color
llvm-cov export \
"${COV_BIN}" \
-instr-profile=$INSTR_PROFILE \
-ignore-filename-regex=$IGNORE_FILENAME_REGEX \
-format=$FORMAT > $OUTPUT_FILE