Skip to content

Commit 8be413e

Browse files
authored
Add instrumented files info to swift_binary and swift_compiler_plugin (#1512)
When using a `macos_unit_test` target whose test sources depend on a `swift_compiler_plugin` or `swift_binary` target, its sources are missing from the coverage manifest `COVERAGE_MANIFEST` env var that's passed to lcov. This change mirrors what the other targets do to add coverage instrumentation info so that they are available in the resulting coverage file.
1 parent d296e13 commit 8be413e

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

swift/swift_binary.bzl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,12 @@ def _swift_binary_impl(ctx):
204204
files = ctx.files.data,
205205
),
206206
),
207+
coverage_common.instrumented_files_info(
208+
ctx,
209+
dependency_attributes = ["deps"],
210+
extensions = ["swift"],
211+
source_attributes = ["srcs"],
212+
),
207213
OutputGroupInfo(**output_groups),
208214
SwiftInfo(
209215
modules = [

swift/swift_compiler_plugin.bzl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,12 @@ def _swift_compiler_plugin_impl(ctx):
199199
OutputGroupInfo(
200200
**supplemental_compilation_output_groups(supplemental_outputs)
201201
),
202+
coverage_common.instrumented_files_info(
203+
ctx,
204+
dependency_attributes = ["deps"],
205+
extensions = ["swift"],
206+
source_attributes = ["srcs"],
207+
),
202208
SwiftBinaryInfo(
203209
cc_info = CcInfo(
204210
compilation_context = module_context.clang.compilation_context,

0 commit comments

Comments
 (0)