Skip to content

Commit

Permalink
Add a current_toolchain target to be referenced by kt_toolchain attri…
Browse files Browse the repository at this point in the history
…bute (#1239)
  • Loading branch information
jdai8 authored Dec 5, 2024
1 parent 87d5987 commit 0b7d242
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
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",
)

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

0 comments on commit 0b7d242

Please sign in to comment.