Skip to content
This repository has been archived by the owner on Aug 5, 2024. It is now read-only.

aspects.bzl attempts to access non-existent struct field #262

Closed
bbarnes52 opened this issue Jun 29, 2022 · 3 comments
Closed

aspects.bzl attempts to access non-existent struct field #262

bbarnes52 opened this issue Jun 29, 2022 · 3 comments

Comments

@bbarnes52
Copy link

Experiencing the following error:

2022.06.28 18:22:34 ERROR (18:22:34) ^[[31m^[[1mERROR: ^[[0m/Users/brian.barnes/universe/common/lazy/BUILD:7:16: in //.bazelbsp:aspects.bzl%bsp_target_info_aspect aspect on generic_scala_worker rule //common/lazy:lazy-spark_3.0_2.12: ^[[0m
2022.06.28 18:22:34 ERROR Traceback (most recent call last):^[[0m
2022.06.28 18:22:34 ERROR       File "/Users/brian.barnes/universe/.bazelbsp/aspects.bzl", line 475, column 41, in _bsp_target_info_aspect_impl^[[0m
2022.06.28 18:22:34 ERROR               java_target_info = extract_java_info(target, ctx, output_groups)^[[0m
2022.06.28 18:22:34 ERROR       File "/Users/brian.barnes/universe/.bazelbsp/aspects.bzl", line 208, column 40, in extract_java_info^[[0m
2022.06.28 18:22:34 ERROR               java_outputs = provider.outputs.jars^[[0m
2022.06.28 18:22:34 ERROR Error: 'struct' value has no field or method 'jars'^[[0m
2022.06.28 18:22:34 ERROR Available attributes: class_jar, ijar, source_jars^[[0m

The relevant code snippet is reproduced below:

elif hasattr(provider, "outputs") and provider.outputs:
    java_outputs = provider.outputs.jars

Should this instead read:

elif hasattr(provider, "outputs") and provider.outputs and hasattr(provider.outputs, "jars") and provider.outputs.jars:
    java_outputs = provider.outputs.jars
@lukaszwawrzyk
Copy link
Contributor

What is your bazel version and what rules are you using for scala?

@bbarnes52
Copy link
Author

The scala rules are custom and the scala attribute doesn't implement JavaInfo. My apologies for the noise

@abrams27
Copy link
Member

abrams27 commented Jul 5, 2022

nevertheless, having safer aspects would be good - I'll fix it later

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants