Skip to content

Commit

Permalink
fix: Kotlin toolchain detection (#7122)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomasz Pasternak authored Dec 5, 2024
1 parent 6716706 commit 3c8ace5
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions aspect/intellij_info_impl.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -1117,11 +1117,15 @@ def collect_java_toolchain_info(target, ide_info, ide_info_file, output_groups):
def artifact_to_path(artifact):
return artifact.root_execution_path_fragment + "/" + artifact.relative_path

def collect_kotlin_toolchain_info(target, ide_info, ide_info_file, output_groups):
def collect_kotlin_toolchain_info(target, ctx, ide_info, ide_info_file, output_groups):
"""Updates kotlin_toolchain-relevant output groups, returns false if not a kotlin_toolchain target."""
if not hasattr(target, "kt"):
if ctx.rule.kind == "_kt_toolchain" and platform_common.ToolchainInfo in target:
kt = target[platform_common.ToolchainInfo]
elif hasattr(target, "kt") and hasattr(target.kt, "language_version"):
kt = target.kt # Legacy struct provider mechanism
else:
return False
kt = target.kt

if not hasattr(kt, "language_version"):
return False
ide_info["kt_toolchain_ide_info"] = struct(
Expand Down Expand Up @@ -1293,7 +1297,7 @@ def intellij_info_aspect_impl(target, ctx, semantics):
handled = collect_java_info(target, ctx, semantics, ide_info, ide_info_file, output_groups) or handled
handled = collect_java_toolchain_info(target, ide_info, ide_info_file, output_groups) or handled
handled = collect_android_info(target, ctx, semantics, ide_info, ide_info_file, output_groups) or handled
handled = collect_kotlin_toolchain_info(target, ide_info, ide_info_file, output_groups) or handled
handled = collect_kotlin_toolchain_info(target, ctx, ide_info, ide_info_file, output_groups) or handled

# Any extra ide info
if hasattr(semantics, "extra_ide_info"):
Expand Down

0 comments on commit 3c8ace5

Please sign in to comment.