Skip to content

Commit

Permalink
Fix aspects not picking up merge_{cc,java}_infos
Browse files Browse the repository at this point in the history
The rules_jvm_external `java_export` aspect did not pick up dependencies
of `java_jni_library`.
  • Loading branch information
fmeum committed Oct 12, 2022
1 parent c4e3441 commit e472e7a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
16 changes: 8 additions & 8 deletions jni/internal/common.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,18 @@ def _merge_default_infos(ctx, infos):

def _merge_cc_infos_impl(ctx):
return [
_merge_default_infos(ctx, [lib[DefaultInfo] for lib in ctx.attr.libs]),
cc_common.merge_cc_infos(direct_cc_infos = [lib[CcInfo] for lib in ctx.attr.libs]),
_merge_default_infos(ctx, [dep[DefaultInfo] for dep in ctx.attr.deps]),
cc_common.merge_cc_infos(direct_cc_infos = [dep[CcInfo] for dep in ctx.attr.deps]),
coverage_common.instrumented_files_info(
ctx,
dependency_attributes = ["libs"],
dependency_attributes = ["deps"],
),
]

merge_cc_infos = rule(
implementation = _merge_cc_infos_impl,
attrs = {
"libs": attr.label_list(
"deps": attr.label_list(
providers = [CcInfo],
),
},
Expand All @@ -44,18 +44,18 @@ merge_cc_infos = rule(

def _merge_java_infos_impl(ctx):
return [
_merge_default_infos(ctx, [lib[DefaultInfo] for lib in ctx.attr.libs]),
java_common.merge([lib[JavaInfo] for lib in ctx.attr.libs]),
_merge_default_infos(ctx, [dep[DefaultInfo] for dep in ctx.attr.deps]),
java_common.merge([dep[JavaInfo] for dep in ctx.attr.deps]),
coverage_common.instrumented_files_info(
ctx,
dependency_attributes = ["libs"],
dependency_attributes = ["deps"],
),
]

merge_java_infos = rule(
implementation = _merge_java_infos_impl,
attrs = {
"libs": attr.label_list(
"deps": attr.label_list(
providers = [JavaInfo],
),
},
Expand Down
2 changes: 1 addition & 1 deletion jni/internal/java_jni_library.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def java_jni_library(

merge_java_infos(
name = name,
libs = [
deps = [
":" + original_name,
] + native_libs,
tags = tags,
Expand Down
8 changes: 4 additions & 4 deletions jni/tools/libjvm_stub/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@ load("//jni/internal:common.bzl", "make_root_relative", "merge_cc_infos")

merge_cc_infos(
name = "libjvm_stub_with_jni",
libs = [
visibility = ["//jni:__pkg__"],
deps = [
":libjvm_stub",
"//jni",
],
visibility = ["//jni:__pkg__"],
)

merge_cc_infos(
name = "libjvm_stub_release_with_jni",
libs = [
visibility = ["//jni:__pkg__"],
deps = [
":libjvm_stub_release",
"//jni",
],
visibility = ["//jni:__pkg__"],
)

cc_library(
Expand Down

0 comments on commit e472e7a

Please sign in to comment.