-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcoverage.sh
More file actions
executable file
·35 lines (25 loc) · 854 Bytes
/
coverage.sh
File metadata and controls
executable file
·35 lines (25 loc) · 854 Bytes
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
#!/bin/sh
set -e
BUILD_SETTINGS=build-settings.txt
# clean up
rm -rf .build
rm -rf Builds
rm -rf ThenKit.xcodeproj
# swift package
swift package generate-xcodeproj --enable-code-coverage -v
# Get build settings
xcodebuild -scheme ThenKit -showBuildSettings > ${BUILD_SETTINGS}
# build
xcodebuild -scheme ThenKit -enableCodeCoverage YES test
# | xcpretty
# Project Temp Root ends up with /Build/Intermediates/
PROJECT_TEMP_ROOT=$(grep -m1 PROJECT_TEMP_ROOT ${BUILD_SETTINGS} | cut -d= -f2 | xargs)
PROFDATA=$(find ${PROJECT_TEMP_ROOT} -name "Coverage.profdata")
BINARY=$(find ${PROJECT_TEMP_ROOT} -path "*ThenKit.framework/ThenKit")
echo "PROJECT_TEMP_ROOT = $PROJECT_TEMP_ROOT"
# echo "PROFDATA = $PROFDATA"
# echo "BINARY = $BINARY"
xcrun llvm-cov report \
-instr-profile ${PROFDATA} \
${BINARY}
rm $BUILD_SETTINGS