Skip to content

Commit

Permalink
Support Bazel rules_kotlin toolchain without legacy providers
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 626344394
  • Loading branch information
Googler authored and copybara-github committed Apr 19, 2024
1 parent 04f332e commit 6a28b7b
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions aspect/intellij_info_impl.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ DEPS = [
"test_app", # android_instrumentation_test
"instruments", # android_instrumentation_test
"tests", # From test_suite
"_toolchain", # From rules_kotlin
]

# Run-time dependency attributes, grouped by type.
Expand Down Expand Up @@ -996,11 +997,13 @@ def artifact_to_path(artifact):

def collect_kotlin_toolchain_info(target, 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"):
return False
kt = target.kt
if not hasattr(kt, "language_version"):
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

ide_info["kt_toolchain_ide_info"] = struct(
language_version = kt.language_version,
)
Expand Down

0 comments on commit 6a28b7b

Please sign in to comment.