Skip to content

Commit

Permalink
Simplify return statement
Browse files Browse the repository at this point in the history
  • Loading branch information
borkaehw committed Jan 31, 2020
1 parent ed79ac4 commit aa25b5e
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions scala/private/phases/phase_coverage.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@ load(
_coverage_replacements_provider = "coverage_replacements_provider",
)

_empty_coverage_struct = struct(
replacements = {},
providers_dict = {},
)

def phase_coverage_library(ctx, p):
args = struct(
srcjars = p.collect_srcjars,
Expand All @@ -34,14 +29,12 @@ def _phase_coverage(ctx, p, srcjars):
if len(ctx.files.srcs) + len(srcjars.to_list()) == 0 or \
not ctx.configuration.coverage_enabled or \
not hasattr(ctx.attr, "_code_coverage_instrumentation_worker"):
coverage = _empty_coverage_struct
return struct(
replacements = {},
external_providers = {},
)
else:
coverage = _jacoco_offline_instrument(ctx, ctx.outputs.jar)

return struct(
replacements = coverage.replacements,
external_providers = coverage.providers_dict,
)
return _jacoco_offline_instrument(ctx, ctx.outputs.jar)

def _jacoco_offline_instrument(ctx, input_jar):
output_jar = ctx.actions.declare_file(
Expand Down Expand Up @@ -77,7 +70,7 @@ def _jacoco_offline_instrument(ctx, input_jar):
)
return struct(
replacements = replacements,
providers_dict = {
external_providers = {
"_CoverageReplacements": provider,
"InstrumentedFilesInfo": instrumented_files_provider,
},
Expand Down

0 comments on commit aa25b5e

Please sign in to comment.