Skip to content
This repository was archived by the owner on Sep 7, 2022. It is now read-only.

Commit ff1af33

Browse files
author
Jeff Verkoeyen
committed
Toughen the path resolution of Coverage.profdata and the desired product.
Before this change we assumed that Coverage.profdata and the desired product would live in specific directories. After this change we'll search for both files each time the build initiaties. This resolves a bug affecting Xcode 7.3 and later due to changes in build paths from Xcode 7.2 to 7.3. Closes #2.
1 parent a6d8900 commit ff1af33

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

engine/XcodeUnitTestEngine.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -148,15 +148,18 @@ public function run() {
148148
if (!preg_match('/OBJROOT = (.+)/', $settings_stdout, $matches)) {
149149
throw new Exception('Unable to find OBJROOT configuration.');
150150
}
151-
152151
$objroot = $matches[1];
153-
$covroot = $objroot."/CodeCoverage/".$this->xcodebuild['scheme'];
154-
$profdata = $covroot."/Coverage.profdata";
155-
// TODO(featherless): Find a better way to identify which Product was built.
156-
$product = $covroot."/Products/Debug-iphonesimulator/".$this->coverage['product'];
152+
153+
$future = new ExecFuture("find %C -name Coverage.profdata", $objroot);
154+
list(, $coverage_stdout, ) = $future->resolve();
155+
$profdata_path = explode("\n", $coverage_stdout)[0];
156+
157+
$future = new ExecFuture("find %C | grep %C", $objroot, $this->coverage['product']);
158+
list(, $product_stdout, ) = $future->resolve();
159+
$product_path = explode("\n", $product_stdout)[0];
157160

158161
$future = new ExecFuture('%C show -use-color=false -instr-profile "%C" "%C"',
159-
$this->covBinary, $profdata, $product);
162+
$this->covBinary, $profdata_path, $product_path);
160163
$future->setCWD(Filesystem::resolvePath($this->getWorkingCopy()->getProjectRoot()));
161164

162165
try {

0 commit comments

Comments
 (0)