Skip to content

Commit

Permalink
Merge pull request bazelbuild#18 from pbsf/legacy_continued
Browse files Browse the repository at this point in the history
Adds exports to kt_jvm_import to enable bazel-deps support.
  • Loading branch information
jongerrish authored Sep 6, 2019
2 parents ed68623 + a6bef9b commit ade2658
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
8 changes: 7 additions & 1 deletion kotlin/internal/jvm/impl.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
),
Expand All @@ -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),
),
Expand Down
8 changes: 8 additions & 0 deletions kotlin/internal/jvm/jvm.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit ade2658

Please sign in to comment.