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

Commit 739c686

Browse files
author
Jeff Verkoeyen
committed
Merge branch 'develop' into stable
2 parents 7f2f509 + 07fcb3b commit 739c686

File tree

3 files changed

+34
-10
lines changed

3 files changed

+34
-10
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 2.1.0
2+
3+
* Added a `pre-build` configuration option.
4+
15
## 2.0.2
26

37
* Error line detection is now more flexible. Any output line with "error:" will be detected and

README.md

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -97,30 +97,40 @@ Now modify your `.arcconfig` file by adding the following configuration:
9797

9898
### Configuration options
9999

100+
#### Build configuration options
101+
102+
Any value provided to "build" will be passed along to xcodebuild as a flag.
103+
100104
"unit.xcode": {
101105
"build": { ... }
102106
}
103107

104-
Any value provided to "build" will be passed along to xcodebuild as a flag.
108+
#### Picking the coverage product
109+
110+
Provide the path to the product for which coverage should be calculated. If building a
111+
library/framework this might be the framework binary product.
105112

106113
"unit.xcode": {
107114
"coverage": {
108115
"product": " ... "
109116
}
110117
}
111118

112-
Provide the path to the product for which coverage should be
113-
calculated. If building a library/framework this might be the
114-
framework binary product.
119+
#### Pre-build commands
115120

116-
### Viewing coverage results in Phabricator
121+
Some projects require a pre-build script that runs before the xcodebuild command.
117122

118-
To view coverage results in Phabricator diff UI you must run
123+
"unit.xcode": {
124+
"pre-build": "execute this command before the build step"
125+
}
126+
127+
For example, CocoaPods projects may need to be re-generated.
119128

120-
arc diff --coverage
129+
"pre-build": "pod install --project-directory=path/ --no-repo-update"
130+
131+
### Viewing coverage results in Phabricator
121132

122-
Coverage will appear for affected source files in Side-by-Side
123-
mode as a colored bar.
133+
Coverage will appear for affected source files in Side-by-Side mode as a colored bar.
124134

125135
## License
126136

engine/XcodeUnitTestEngine.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ final class XcodeUnitTestEngine extends ArcanistUnitTestEngine {
2929
private $affectedTests;
3030
private $xcodebuild;
3131
private $coverage;
32+
private $preBuildCommand;
3233

3334
public function getEngineConfigurationName() {
3435
return 'xcode-test-engine';
@@ -95,6 +96,10 @@ protected function loadEnvironment() {
9596
} else {
9697
$this->xcodebuild["enableCodeCoverage"] = "NO";
9798
}
99+
100+
if (array_key_exists('pre-build', $config['unit.xcode'])) {
101+
$this->preBuildCommand = $config['unit.xcode']['pre-build'];
102+
}
98103
}
99104

100105
public function run() {
@@ -112,6 +117,11 @@ public function run() {
112117
$xcodeargs []= "-$key \"$value\"";
113118
}
114119

120+
if (!empty($this->preBuildCommand)) {
121+
$future = new ExecFuture($this->preBuildCommand);
122+
$future->resolvex();
123+
}
124+
115125
// Build and run unit tests
116126
$future = new ExecFuture('%C %C test',
117127
$this->xcodebuildBinary, implode(' ', $xcodeargs));
@@ -135,7 +145,7 @@ public function run() {
135145
if (!preg_match('/OBJROOT = (.+)/', $settings_stdout, $matches)) {
136146
throw new Exception('Unable to find OBJROOT configuration.');
137147
}
138-
148+
139149
$objroot = $matches[1];
140150
$covroot = $objroot."/CodeCoverage/".$this->xcodebuild['scheme'];
141151
$profdata = $covroot."/Coverage.profdata";

0 commit comments

Comments
 (0)