Skip to content

Commit

Permalink
Scala source attachment pt1 (#4244)
Browse files Browse the repository at this point in the history
  • Loading branch information
liucijus authored Jan 11, 2023
1 parent d5e3efb commit 463b169
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions aspect/intellij_info_impl.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -150,13 +150,19 @@ def get_source_jars(output):
return [output.source_jar]
return []

def library_artifact(java_output):
def library_artifact(java_output, rule_kind = None):
"""Creates a LibraryArtifact representing a given java_output."""
if java_output == None or java_output.class_jar == None:
return None
src_jars = get_source_jars(java_output)

if rule_kind != None and rule_kind.startswith("scala"):
interface_jar = None
else:
interface_jar = artifact_location(java_output.ijar)

return struct_omit_none(
interface_jar = artifact_location(java_output.ijar),
interface_jar = interface_jar,
jar = artifact_location(java_output.class_jar),
source_jar = artifact_location(src_jars[0]) if src_jars else None,
source_jars = [artifact_location(f) for f in src_jars],
Expand Down Expand Up @@ -597,7 +603,7 @@ def collect_java_info(target, ctx, semantics, ide_info, ide_info_file, output_gr

ide_info_files = []
sources = sources_from_target(ctx)
jars = [library_artifact(output) for output in java_outputs]
jars = [library_artifact(output, ctx.rule.kind) for output in java_outputs]
class_jars = [output.class_jar for output in java_outputs if output and output.class_jar]
output_jars = [jar for output in java_outputs for jar in jars_from_output(output)]
resolve_files = output_jars
Expand Down

0 comments on commit 463b169

Please sign in to comment.