Skip to content

Commit 0b7d242

Browse files
authored
Add a current_toolchain target to be referenced by kt_toolchain attribute (#1239)
1 parent 87d5987 commit 0b7d242

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

kotlin/internal/jvm/jvm.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ _implicit_deps = {
148148
"_kt_toolchain": attr.label(
149149
doc = """The Kotlin toolchain. it's only purpose is to enable the Intellij
150150
to discover Kotlin language version""",
151-
default = Label("//kotlin/internal:default_toolchain_impl"),
151+
default = Label("//kotlin/internal:current_toolchain"),
152152
cfg = "target",
153153
),
154154
"_java_toolchain": attr.label(

kotlin/internal/toolchains.bzl

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,18 @@ def define_kt_toolchain(
342342
target_settings = target_settings or [],
343343
)
344344

345+
def _kt_toolchain_alias_impl(ctx):
346+
toolchain_info = ctx.toolchains[_TOOLCHAIN_TYPE]
347+
348+
return [
349+
toolchain_info,
350+
]
351+
352+
_kt_toolchain_alias = rule(
353+
implementation = _kt_toolchain_alias_impl,
354+
toolchains = [_TOOLCHAIN_TYPE],
355+
)
356+
345357
def kt_configure_toolchains():
346358
"""
347359
Defines the toolchain_type and default toolchain for kotlin compilation.
@@ -398,3 +410,8 @@ def kt_configure_toolchains():
398410
define_kt_toolchain(
399411
name = "default_toolchain",
400412
)
413+
414+
_kt_toolchain_alias(
415+
name = "current_toolchain",
416+
visibility = ["//visibility:public"],
417+
)

0 commit comments

Comments
 (0)