diff --git a/scala/private/phases/phase_final.bzl b/scala/private/phases/phase_final.bzl index 565cccb5c..c01544e8f 100644 --- a/scala/private/phases/phase_final.bzl +++ b/scala/private/phases/phase_final.bzl @@ -4,32 +4,26 @@ # DOCUMENT THIS # def phase_binary_final(ctx, p): - return struct( + defaultInfo = DefaultInfo( executable = p.declare_executable, - coverage = p.compile.coverage, files = depset([p.declare_executable, ctx.outputs.jar]), - instrumented_files = p.compile.coverage.instrumented_files, - providers = [p.compile.merged_provider, p.collect_jars.jars2labels] + p.compile.coverage.providers, runfiles = p.runfiles.runfiles, - transitive_rjars = p.compile.rjars, #calling rules need this for the classpath in the launcher ) + return [defaultInfo, p.compile.merged_provider, p.collect_jars.jars2labels] + p.compile.coverage.providers def phase_library_final(ctx, p): - return struct( + defaultInfo = DefaultInfo( files = depset([ctx.outputs.jar] + p.compile.full_jars), # Here is the default output - instrumented_files = p.compile.coverage.instrumented_files, - jars_to_labels = p.collect_jars.jars2labels, - providers = [p.compile.merged_provider, p.collect_jars.jars2labels] + p.compile.coverage.providers, runfiles = p.runfiles.runfiles, ) + return [defaultInfo, p.compile.merged_provider, p.collect_jars.jars2labels] + p.compile.coverage.providers def phase_scalatest_final(ctx, p): coverage_runfiles = p.coverage_runfiles.coverage_runfiles coverage_runfiles.extend(p.write_executable) - return struct( + defaultInfo = DefaultInfo( executable = p.declare_executable, files = depset([p.declare_executable, ctx.outputs.jar]), - instrumented_files = p.compile.coverage.instrumented_files, - providers = [p.compile.merged_provider, p.collect_jars.jars2labels] + p.compile.coverage.providers, runfiles = ctx.runfiles(coverage_runfiles, transitive_files = p.runfiles.runfiles.files), ) + return [defaultInfo, p.compile.merged_provider, p.collect_jars.jars2labels] + p.compile.coverage.providers diff --git a/scala/private/rule_impls.bzl b/scala/private/rule_impls.bzl index a67ed814f..b5f0411b8 100644 --- a/scala/private/rule_impls.bzl +++ b/scala/private/rule_impls.bzl @@ -40,7 +40,7 @@ _scala_extension = ".scala" _srcjar_extension = ".srcjar" _empty_coverage_struct = struct( - instrumented_files = struct(), + instrumented_files = None, providers = [], replacements = {}, ) @@ -871,14 +871,14 @@ def _jacoco_offline_instrument(ctx, input_jar): provider = _coverage_replacements_provider.create( replacements = replacements, ) - + instrumented_files_provider = coverage_common.instrumented_files_info( + ctx, + source_attributes = ["srcs"], + dependency_attributes = _coverage_replacements_provider.dependency_attributes, + extensions = ["scala", "java"], + ) return struct( - instrumented_files = struct( - dependency_attributes = _coverage_replacements_provider.dependency_attributes, - extensions = ["scala", "java"], - source_attributes = ["srcs"], - ), - providers = [provider], + providers = [provider, instrumented_files_provider], replacements = replacements, ) diff --git a/scala/scala_import.bzl b/scala/scala_import.bzl index 37fab530a..e0d889be6 100644 --- a/scala/scala_import.bzl +++ b/scala/scala_import.bzl @@ -32,18 +32,13 @@ def _scala_import_impl(ctx): # TODO(#8867): Migrate away from the placeholder jar hack when #8867 is fixed. current_target_providers = [_new_java_info(ctx, ctx.file._placeholder_jar)] - return struct( - scala = struct( - outputs = struct(jars = intellij_metadata), + return [ + java_common.merge(current_target_providers), + DefaultInfo( + files = current_jars, ), - providers = [ - java_common.merge(current_target_providers), - DefaultInfo( - files = current_jars, - ), - JarsToLabelsInfo(jars_to_labels = jars2labels), - ], - ) + JarsToLabelsInfo(jars_to_labels = jars2labels), + ] def _new_java_info(ctx, jar): return JavaInfo(