Skip to content

Commit c90a028

Browse files
Include all abi jars from the associates array (#1409)
1 parent 89fd270 commit c90a028

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

kotlin/internal/jvm/associates.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def _get_associates(ctx, toolchains, associates):
7676
for a in associates:
7777
jar_bundle = _collect_associates(ctx = ctx, toolchains = toolchains, associate = a)
7878
jars.append(jar_bundle.jars)
79-
abi_jar_set = jar_bundle.abi_jars_set
79+
abi_jar_set = _sets.add_all(abi_jar_set, jar_bundle.abi_jars_set)
8080
module_names.append(a[_KtJvmInfo].module_name)
8181
java_infos.append(_java_info(a))
8282
module_names = list(_sets.copy_of(module_names))

src/test/starlark/internal/jvm/jvm_deps_tests.bzl

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,25 @@ def _setup(env, target):
1414
compile_jar = _file(env.ctx.attr.associate_abi_jar),
1515
output_jar = _file(env.ctx.attr.associate_jar),
1616
)
17+
associate_deps_java_info2 = JavaInfo(
18+
compile_jar = _file(env.ctx.attr.associate_abi_jar2),
19+
output_jar = _file(env.ctx.attr.associate_jar2),
20+
)
1721

22+
# More than 1 associate should be allowed if they resolve to the same module
1823
associate_deps = [
1924
{
2025
JavaInfo: associate_deps_java_info,
2126
_KtJvmInfo: _KtJvmInfo(
2227
module_name = "associate_name",
2328
),
2429
},
30+
{
31+
JavaInfo: associate_deps_java_info2,
32+
_KtJvmInfo: _KtJvmInfo(
33+
module_name = "associate_name",
34+
),
35+
},
2536
]
2637

2738
direct_deps = [
@@ -84,7 +95,9 @@ def _strict_abi_test_impl(env, target):
8495

8596
# but FULL FAT associate jars and not the ABI associate jar
8697
classpath.contains(_file(env.ctx.attr.associate_jar).short_path)
98+
classpath.contains(_file(env.ctx.attr.associate_jar2).short_path)
8799
classpath.not_contains(_file(env.ctx.attr.associate_abi_jar).short_path)
100+
classpath.not_contains(_file(env.ctx.attr.associate_abi_jar2).short_path)
88101

89102
def _fat_abi_test_impl(env, target):
90103
arrangment = _setup(env, target)
@@ -116,7 +129,9 @@ def _fat_abi_test_impl(env, target):
116129

117130
# but ABI associate jars and not the FULL FAT associate jar
118131
classpath.contains(_file(env.ctx.attr.associate_abi_jar).short_path)
132+
classpath.contains(_file(env.ctx.attr.associate_abi_jar2).short_path)
119133
classpath.not_contains(_file(env.ctx.attr.associate_jar).short_path)
134+
classpath.not_contains(_file(env.ctx.attr.associate_jar2).short_path)
120135

121136
def _transitive_from_exports_test_impl(env, target):
122137
arrangment_dict = _structs.to_dict(_setup(env, target))
@@ -240,14 +255,18 @@ def _abi_test(name, impl):
240255
target = name + "_subject",
241256
attr_values = {
242257
"associate_abi_jar": util.empty_file(name + "associate_abi.jar"),
258+
"associate_abi_jar2": util.empty_file(name + "associate_abi2.jar"),
243259
"associate_jar": util.empty_file(name + "associate.jar"),
260+
"associate_jar2": util.empty_file(name + "associate2.jar"),
244261
"direct_dep_abi_jar": util.empty_file(name + "direct_dep_abi.jar"),
245262
"direct_dep_jar": util.empty_file(name + "direct_dep.jar"),
246263
"jvm_jar": util.empty_file(name + "jvm.jar"),
247264
},
248265
attrs = {
249266
"associate_abi_jar": attr.label(allow_files = True),
267+
"associate_abi_jar2": attr.label(allow_files = True),
250268
"associate_jar": attr.label(allow_files = True),
269+
"associate_jar2": attr.label(allow_files = True),
251270
"direct_dep_abi_jar": attr.label(allow_files = True),
252271
"direct_dep_jar": attr.label(allow_files = True),
253272
"jvm_jar": attr.label(allow_files = True),

0 commit comments

Comments
 (0)