Skip to content

Commit

Permalink
Migrate to new code coverage provider
Browse files Browse the repository at this point in the history
This fixes an incompatible change detailed here: bazelbuild/bazel#7347

This relies on bazel 0.23.0

Closes #145.

RELNOTES: None.
PiperOrigin-RevId: 235755436
  • Loading branch information
keith authored and allevato committed Feb 26, 2019
1 parent e30246c commit 8fbb7c5
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 33 deletions.
34 changes: 16 additions & 18 deletions swift/internal/swift_binary_test.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -282,28 +282,26 @@ def _swift_test_impl(ctx):
{"TEST_BINARIES_FOR_LLVM_COV": binary.short_path},
)

# TODO(b/79527231): Replace `instrumented_files` with a declared provider when it is available.
return struct(
instrumented_files = struct(
return providers + [
DefaultInfo(
executable = executable,
files = depset(direct = [executable] + additional_test_outputs),
runfiles = ctx.runfiles(
collect_data = True,
collect_default = True,
files = ctx.files.data + additional_test_outputs,
transitive_files = ctx.attr._apple_coverage_support.files,
),
),
coverage_common.instrumented_files_info(
ctx,
dependency_attributes = ["deps"],
extensions = ["swift"],
source_attributes = ["srcs"],
),
providers = providers + [
DefaultInfo(
executable = executable,
files = depset(direct = [executable] + additional_test_outputs),
runfiles = ctx.runfiles(
collect_data = True,
collect_default = True,
files = ctx.files.data + additional_test_outputs,
transitive_files = ctx.attr._apple_coverage_support.files,
),
),
testing.ExecutionInfo(toolchain.execution_requirements),
testing.TestEnvironment(test_environment),
],
)
testing.ExecutionInfo(toolchain.execution_requirements),
testing.TestEnvironment(test_environment),
]

swift_binary = rule(
attrs = dicts.add(
Expand Down
28 changes: 13 additions & 15 deletions swift/internal/swift_library.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -73,25 +73,23 @@ def _swift_library_impl(ctx):
if compile_results.output_header:
direct_output_files.append(compile_results.output_header)

# TODO(b/79527231): Replace `instrumented_files` with a declared provider when it is available.
return struct(
instrumented_files = struct(
return compile_results.providers + [
DefaultInfo(
files = depset(direct = direct_output_files),
runfiles = ctx.runfiles(
collect_data = True,
collect_default = True,
files = ctx.files.data,
),
),
coverage_common.instrumented_files_info(
ctx,
dependency_attributes = ["deps"],
extensions = ["swift"],
source_attributes = ["srcs"],
),
providers = compile_results.providers + [
DefaultInfo(
files = depset(direct = direct_output_files),
runfiles = ctx.runfiles(
collect_data = True,
collect_default = True,
files = ctx.files.data,
),
),
OutputGroupInfo(**compile_results.output_groups),
],
)
OutputGroupInfo(**compile_results.output_groups),
]

swift_library = rule(
attrs = swift_common.library_rule_attrs(additional_deps_aspects = [
Expand Down

0 comments on commit 8fbb7c5

Please sign in to comment.