Skip to content

Commit 28eb976

Browse files
committed
SE-0501: Update proposal base on review
Update the SE-0501 proposal based on feedback from the review
1 parent 85fb937 commit 28eb976

File tree

1 file changed

+62
-19
lines changed

1 file changed

+62
-19
lines changed

proposals/0501-swiftpm-html-coverage-report.md

Lines changed: 62 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Review Manager: [David Cummings](https://github.com/daveyc123)
66
* Status: **Active Review (December 7 - December 22, 2025)**
77
* Implementation: [swiftlang/swift-package-manager#9076](https://github.com/swiftlang/swift-package-manager/pull/9076)
8-
* Review:
8+
* Review:
99
* [Pitch](https://forums.swift.org/t/pitch-adding-html-coverage-support/82358)
1010
* [Review](https://forums.swift.org/t/se-0501-html-coverage-report/83601/1)
1111

@@ -70,6 +70,30 @@ make use of LLVM's tools and construct the proper command line arguments to the
7070

7171
The proposted command line changes are as follows:
7272

73+
### Consolidate coverage option to use same argument "style"
74+
75+
Prior to this feature, there are 2 coverage options
76+
77+
```
78+
--show-codecov-path, --show-code-coverage-path, --show-coverage-path
79+
Print the path of the exported code coverage JSON
80+
--enable-code-coverage/--disable-code-coverage
81+
Enable code coverage. (default:
82+
--disable-code-coverage)
83+
```
84+
85+
There are 3 wayt to show the coverage path. This proposal recommends modify all
86+
coverage command line option to be a single, more useful option
87+
88+
```
89+
--show-coverage-path
90+
Print the path of the exported code coverage JSON
91+
--enable-coverage/--disable-coverage
92+
Enable code coverage. (default:
93+
--disable-coverage)
94+
```
95+
96+
This requires gracefully phasing out the previous option in favour of the new one.
7397

7498
### Format Selection
7599

@@ -81,7 +105,7 @@ specified.
81105
The command line option will be similar to:
82106

83107
```sh
84-
--codecov-format, --code-coverage-format, --coverage-format <format>
108+
--coverage-format <format>
85109
Format of the code coverage output. Can be specified multiple times. (default: json)
86110
json - Produces a JSON coverage report.
87111
html - Produces an HTML report produced by llvm-cov.
@@ -93,8 +117,9 @@ The command line option will be similar to:
93117
`llvm-cov show` has several report configurability options. In order to
94118
prevent a "command line arguments" explosion to `swift test`, the configuration
95119
options will be read from a response file. The optional response file will be
96-
located in `<repo>/.swiftpm/configuration/coverage.html.report.args.txt`. The
97-
response file will be supported.
120+
located in `<repo>/.swiftpm/configuration/coverage.html.report.args.txt`, which
121+
is the same location used by other SwiftPM features, such as registration and
122+
mirros configuration files. The response file will be supported.
98123

99124
The user can include `--format=text`, or a variation thereof, in the response
100125
file. In order to ensure SwiftPM will always generate an HTML report, SwiftPM
@@ -116,15 +141,14 @@ assumption that the CI system will have a copy of the repository in the "sandbox
116141
location, allowing this system to upload the HTML report.
117142

118143
```
119-
--show-codecov-path [mode], --show-code-coverage-path [mode], --show-coverage-path [mode]
144+
--show-coverage-path [mode]
120145
Print the path of the exported code coverage files. The mode specifies how to
121146
display the paths of the selected code coverage file formats. (default: text)
122147
json - Display the output in JSON format.
123148
text - Display the output as plain text.
124-
--show-codecov-path-mode, --show-code-coverage-path-mode, --show-coverage-path-mode <show-codecov-path-mode>
125-
--enable-codecov, --enable-code-coverage, --enable-coverage/--disable-codecov, --disable-code-coverage, --disable-coverage
149+
--enable-coverage/--disable-coverage
126150
Enable code coverage. (default: --disable-codecov)
127-
--codecov-format, --code-coverage-format, --coverage-format <format>
151+
--coverage-format <format>
128152
Format of the code coverage output. Can be specified multiple times. (values: json, html; default: Produces a JSON coverage report.)
129153
```
130154

@@ -191,17 +215,36 @@ No impact is expected.
191215

192216
## Alternatives considered
193217

194-
- In addition to the response file, the coverage report generation can support
195-
a command line argument similar to `-Xlinker`, `-Xcc` and others, which will
196-
pass the arguments to `llvm-cov show` and override the values in the response
197-
file. This has _not_ been implemented in the [PR].
198218

199-
- Instead of having a `--show-codecov-path` as a tri-state, we could preserve
200-
`--show-codecov-path` original behaviour and add an additional command line
201-
argument to indicate the output mode. The comand line argument would be
202-
`--show-codecov-path-mode <mode>`, where `<mode>` is either `text` or `json`.
203-
This was not favours as `--show-codecov-path-mode` would have a dependency on
204-
`--show-codecov-path` argument, and may lead to some confusion.
219+
### Using `-Xcov`-style argument
220+
221+
In addition to the response file, the coverage report generation can support
222+
a command line argument similar to `-Xlinker`, `-Xcc` and others, which will
223+
pass the arguments to `llvm-cov show` and override the values in the response
224+
file.
225+
226+
Once benefit of having a response file in the repository is the ability of
227+
generating a repeatable HTML report. In addition, since `llvm-cov` has many
228+
subcommands, we would need careful considering on how to handle the case where
229+
we demand JSON and HTML report, but the associated `llvm-cov` subcommand does
230+
not support all the `-Xcov` arguments provided via the `swift test` command line
231+
option.
232+
233+
The intent is that when demand an HTML coverage report, the same HTML report is
234+
produced for all users. Granted, this does not prevent a user from modifying the
235+
response file arguments and create a "temporary HTML" report, but the repository
236+
will be the source of truth for these HTML report command options.
237+
238+
As a result, it was decided to only support a response file, where said response
239+
file is in a given location relative to the repository root.
240+
241+
Support for `-Xcov` (or similar) is to be made in a subsequent proposal.
205242

243+
### `--show-coverage-path` alternative
206244

207-
[PR]: https://github.com/swiftlang/swift-package-manager/pull/9076
245+
Instead of having a `--show-coverage-path` as a tri-state, we could preserve
246+
`--show-coverage-path` original behaviour and add an additional command line
247+
argument to indicate the output mode. The comand line argument would be
248+
`--show-coverage-path-mode <mode>`, where `<mode>` is either `text` or `json`.
249+
This was not favoured as `--show-coverage-path-mode` would have a dependency on
250+
`--show-coverage-path` argument, and may lead to some confusion.

0 commit comments

Comments
 (0)