From a6bef9bee07d8fe278a9e520245dbde825a90ec2 Mon Sep 17 00:00:00 2001 From: Jonathan Gerrish Date: Fri, 6 Sep 2019 14:21:10 +0000 Subject: [PATCH] Add exports to kt_jvm_import --- kotlin/internal/jvm/impl.bzl | 8 +++++++- kotlin/internal/jvm/jvm.bzl | 8 ++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/kotlin/internal/jvm/impl.bzl b/kotlin/internal/jvm/impl.bzl index 38ec7997b..ae94cc3f7 100644 --- a/kotlin/internal/jvm/impl.bzl +++ b/kotlin/internal/jvm/impl.bzl @@ -20,6 +20,11 @@ load( _KtJvmInfo = "KtJvmInfo", ) +load( + "//kotlin/internal/utils:utils.bzl", + _utils = "utils", +) + def _make_providers(ctx, providers, transitive_files = depset(order = "default")): return struct( kt = providers.kt, @@ -116,7 +121,7 @@ def kt_jvm_import_impl(ctx): source_jar = source_jars[0] kt_info = _KtJvmInfo( - module_name = "", + module_name = _utils.derive_module_name(ctx), outputs = struct( jars = artifacts, ), @@ -129,6 +134,7 @@ def kt_jvm_import_impl(ctx): output_jar = jars[0], source_jars = [source_jar] if bool(source_jar) else [], runtime_deps = [dep[JavaInfo] for dep in ctx.attr.runtime_deps if JavaInfo in dep], + exports = [d[JavaInfo] for d in getattr(ctx.attr, "exports", [])], use_ijar = False, neverlink = getattr(ctx.attr, "neverlink", False), ), diff --git a/kotlin/internal/jvm/jvm.bzl b/kotlin/internal/jvm/jvm.bzl index 19e1327c5..aa542ba5c 100644 --- a/kotlin/internal/jvm/jvm.bzl +++ b/kotlin/internal/jvm/jvm.bzl @@ -339,6 +339,14 @@ kt_jvm_import = rule( mandatory = False, providers = [JavaInfo], ), + "exports": attr.label_list( + doc = """Exported libraries. + + Deps listed here will be made available to other rules, as if the parents explicitly depended on + these deps. This is not true for regular (non-exported) deps.""", + default = [], + providers = [JavaInfo], + ), "neverlink": attr.bool( doc = """If true only use this library for compilation and not at runtime.""", default = False,