Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion kotlin/internal/jvm/jvm.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ _implicit_deps = {
"_kt_toolchain": attr.label(
doc = """The Kotlin toolchain. it's only purpose is to enable the Intellij
to discover Kotlin language version""",
default = Label("//kotlin/internal:default_toolchain_impl"),
default = Label("//kotlin/internal:current_toolchain"),
cfg = "target",
),
"_java_toolchain": attr.label(
Expand Down
17 changes: 17 additions & 0 deletions kotlin/internal/toolchains.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,18 @@ def define_kt_toolchain(
target_settings = target_settings or [],
)

def _kt_toolchain_alias_impl(ctx):
toolchain_info = ctx.toolchains[_TOOLCHAIN_TYPE]

return [
toolchain_info,
]

_kt_toolchain_alias = rule(
implementation = _kt_toolchain_alias_impl,
toolchains = [_TOOLCHAIN_TYPE],
)

def kt_configure_toolchains():
"""
Defines the toolchain_type and default toolchain for kotlin compilation.
Expand Down Expand Up @@ -398,3 +410,8 @@ def kt_configure_toolchains():
define_kt_toolchain(
name = "default_toolchain",
)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is both neat and horrible.

_kt_toolchain_alias(
name = "current_toolchain",
visibility = ["//visibility:public"],
)