diff --git a/.gitignore b/.gitignore index 43e314d..9f7143c 100644 --- a/.gitignore +++ b/.gitignore @@ -91,5 +91,8 @@ iOSInjectionProject/ coverage.txt percentage.txt +coverage-ui.txt +percentage-ui.txt .DerivedData-macOS/ +.DerivedData-macOS-ui/ .DerivedData-iOS/ \ No newline at end of file diff --git a/Makefile b/Makefile index 74a3960..0e62ba0 100644 --- a/Makefile +++ b/Makefile @@ -27,6 +27,19 @@ test-macos: -destination platform="$(PLATFORM_MACOS)" \ -enableCodeCoverage YES +test-macos-ui: + xcodebuild clean \ + -project KnobDemo/KnobDemo.xcodeproj \ + -scheme KnobDemo_macOS \ + -derivedDataPath "$(PWD)/.DerivedData-macos-ui" \ + -destination platform="$(PLATFORM_MACOS)" + xcodebuild test \ + -project KnobDemo/KnobDemo.xcodeproj \ + -scheme KnobDemo_macOS \ + -derivedDataPath "$(PWD)/.DerivedData-macos-ui" \ + -destination platform="$(PLATFORM_MACOS)" \ + -enableCodeCoverage YES + test-linux: docker build -t swiftlang -f swiftlang.dockerfile . docker run \ @@ -45,6 +58,10 @@ coverage: test-macos $(COV) Knob-macOS $(PWD)/.DerivedData-macos/Logs/Test/*.xcresult > coverage.txt cat coverage.txt +coverage-ui: test-macos-ui + $(COV) Knob-macOS $(PWD)/.DerivedData-macos-ui/Logs/Test/*.xcresult > coverage-ui.txt + cat coverage-ui.txt + # Visit each line in coverage report that starts with a number, and add the coverage percentage # (skipping the one that involves the SwiftUI containers). Print the average at the end. AWK_CMD = 'END {print sum / count;} /^[1-9]/ { if ($$2 !~ /KnobView/) { sum+=$$4; count+=1; } }' @@ -53,6 +70,10 @@ percentage: coverage awk $(AWK_CMD) coverage.txt > percentage.txt cat percentage.txt +percentage-ui: coverage-ui + awk $(AWK_CMD) coverage-ui.txt > percentage-ui.txt + cat percentage-ui.txt + test: test-ios test-tvos percentage .PHONY: test test-ios test-macos test-tvos coverage percentage test-linux test-swift