Skip to content

Commit 6ae9041

Browse files
committed
Migrate to new code coverage provider
This fixes an incompatible change detailed here: bazelbuild/bazel#7347 This relies on bazel 0.23.0
1 parent d020ed9 commit 6ae9041

File tree

3 files changed

+44
-42
lines changed

3 files changed

+44
-42
lines changed

apple/internal/ios_rules.bzl

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -153,22 +153,23 @@ def _ios_application_impl(ctx):
153153

154154
processor_result = processor.process(ctx, processor_partials)
155155

156-
return struct(
156+
return [
157157
# TODO(b/121155041): Should we do the same for ios_framework and ios_extension?
158-
instrumented_files = struct(dependency_attributes = ["binary"]),
159-
providers = [
160-
DefaultInfo(
161-
files = processor_result.output_files,
162-
runfiles = ctx.runfiles(
163-
files = run_actions.start_simulator(ctx),
164-
),
158+
DefaultInfo(
159+
files = processor_result.output_files,
160+
runfiles = ctx.runfiles(
161+
files = run_actions.start_simulator(ctx),
165162
),
166-
IosApplicationBundleInfo(),
167-
# Propagate the binary provider so that this target can be used as bundle_loader in test
168-
# rules.
169-
binary_target[apple_common.AppleExecutableBinary],
170-
] + processor_result.providers,
171-
)
163+
),
164+
coverage_common.instrumented_files_info(
165+
ctx,
166+
dependency_attributes = ["binary"],
167+
),
168+
IosApplicationBundleInfo(),
169+
# Propagate the binary provider so that this target can be used as bundle_loader in test
170+
# rules.
171+
binary_target[apple_common.AppleExecutableBinary],
172+
] + processor_result.providers
172173

173174
def _ios_framework_impl(ctx):
174175
"""Experimental implementation of ios_framework."""

apple/internal/testing/apple_test_bundle_support.bzl

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -117,14 +117,15 @@ def _apple_test_bundle_impl(ctx, extra_providers = []):
117117
if x != outputs.archive(ctx)
118118
]
119119

120-
return struct(
121-
instrumented_files = struct(dependency_attributes = ["deps", "test_host"]),
122-
providers = processor_result.providers + extra_providers + [
123-
# TODO(kaipi): Remove this provider when apple_*_test is merged with the bundle and binary
124-
# rules.
125-
AppleExtraOutputsInfo(files = depset(filtered_outputs)),
126-
],
127-
)
120+
return processor_result.providers + extra_providers + [
121+
coverage_common.instrumented_files_info(
122+
ctx,
123+
dependency_attributes = ["deps", "test_host"],
124+
),
125+
# TODO(kaipi): Remove this provider when apple_*_test is merged with the bundle and binary
126+
# rules.
127+
AppleExtraOutputsInfo(files = depset(filtered_outputs)),
128+
]
128129

129130
def _assemble_test_targets(
130131
name,

apple/internal/testing/apple_test_rules.bzl

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -477,26 +477,26 @@ def _apple_test_impl(ctx, test_type):
477477
ctx.attr.test_bundle[apple_common.AppleDebugOutputs],
478478
)
479479

480-
return struct(
481-
# TODO(b/79527231): Migrate to new style providers.
482-
instrumented_files = struct(dependency_attributes = ["test_bundle"]),
483-
providers = [
484-
ctx.attr.test_bundle[AppleBundleInfo],
485-
ctx.attr.test_bundle[AppleTestInfo],
486-
testing.ExecutionInfo(execution_requirements),
487-
testing.TestEnvironment(test_environment),
488-
DefaultInfo(
489-
executable = executable,
490-
files = outputs,
491-
runfiles = ctx.runfiles(
492-
files = direct_runfiles,
493-
transitive_files = depset(transitive = transitive_runfiles),
494-
)
495-
.merge(ctx.attr.runner.default_runfiles)
496-
.merge(ctx.attr.runner.data_runfiles),
497-
),
498-
] + extra_providers,
499-
)
480+
return [
481+
coverage_common.instrumented_files_info(
482+
ctx,
483+
dependency_attributes = ["test_bundle"],
484+
),
485+
ctx.attr.test_bundle[AppleBundleInfo],
486+
ctx.attr.test_bundle[AppleTestInfo],
487+
testing.ExecutionInfo(execution_requirements),
488+
testing.TestEnvironment(test_environment),
489+
DefaultInfo(
490+
executable = executable,
491+
files = outputs,
492+
runfiles = ctx.runfiles(
493+
files = direct_runfiles,
494+
transitive_files = depset(transitive = transitive_runfiles),
495+
)
496+
.merge(ctx.attr.runner.default_runfiles)
497+
.merge(ctx.attr.runner.data_runfiles),
498+
),
499+
] + extra_providers
500500

501501
def _apple_unit_test_impl(ctx):
502502
"""Implementation for the apple_unit_test rule."""

0 commit comments

Comments
 (0)