Skip to content

Commit d7cf3fd

Browse files
authored
Fix reference to java_infos in compile.bzl (#915)
* Fix reference to java_infos in compile.bzl `compile.bzl` was incorrectly referencing `java_info` instead of `java_infos` in cases where annotation processors were found, causing compilation to fail with an opaque error (#877). This fixes the reference. * Replace incorrect property access on list with list comprehension Fixing the typo resulted in the following error: ``` Traceback (most recent call last): File "/workdir/kotlin/internal/jvm/impl.bzl", line 219, column 36, in kt_jvm_library_impl _kt_jvm_produce_jar_actions(ctx, "kt_jvm_library") if ctx.attr.srcs or ctx.attr.resources else export_only_providers( File "/workdir/kotlin/internal/jvm/compile.bzl", line 493, column 50, in kt_jvm_produce_jar_actions outputs_struct = _run_kt_java_builder_actions( File "/workdir/kotlin/internal/jvm/compile.bzl", line 751, column 66, in _run_kt_java_builder_actions ap_class_jar = [jars.class_jar for jars in java_infos.outputs.jars][0], Error: 'list' value has no field or method 'outputs' ``` `java_infos` is a list and thus doesn't have an `outputs` field, but each `java_info` inside the list does. Thus replacing `java_infos.outputs.jars` with the list comprehension `[java_info.outputs.jars for java_info in java_infos]` gets us a list of `jars` objects that can be used in the outer list comprehension. * extract out inner list comprehension * flatten list of jars lists
1 parent bd1ad8e commit d7cf3fd

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

kotlin/internal/jvm/compile.bzl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -746,9 +746,10 @@ def _run_kt_java_builder_actions(
746746

747747
annotation_processing = None
748748
if annotation_processors:
749+
outputs_list = [java_info.outputs for java_info in java_infos]
749750
annotation_processing = _create_annotation_processing(
750751
annotation_processors = annotation_processors,
751-
ap_class_jar = [jars.class_jar for jars in java_info.outputs.jars][0],
752+
ap_class_jar = [jars.class_jar for outputs in outputs_list for jars in outputs.jars][0],
752753
ap_source_jar = ap_generated_src_jar,
753754
)
754755

0 commit comments

Comments
 (0)