diff --git a/src/main/starlark/builtins_bzl/common/cc/experimental_cc_shared_library.bzl b/src/main/starlark/builtins_bzl/common/cc/experimental_cc_shared_library.bzl index 47ded926fe599f..1f65828c4ea105 100644 --- a/src/main/starlark/builtins_bzl/common/cc/experimental_cc_shared_library.bzl +++ b/src/main/starlark/builtins_bzl/common/cc/experimental_cc_shared_library.bzl @@ -505,6 +505,8 @@ def _cc_shared_library_impl(ctx): if precompiled_dynamic_library.resolved_symlink_dynamic_library != None: precompiled_only_dynamic_libraries_runfiles.append(precompiled_dynamic_library.resolved_symlink_dynamic_library) + runfiles = runfiles.merge(ctx.runfiles(files = precompiled_only_dynamic_libraries_runfiles)) + for export in ctx.attr.roots: exports[str(export.label)] = True diff --git a/src/main/starlark/tests/builtins_bzl/cc/cc_shared_library/test_cc_shared_library/BUILD.builtin_test b/src/main/starlark/tests/builtins_bzl/cc/cc_shared_library/test_cc_shared_library/BUILD.builtin_test index b8e2e998404644..34e5515e7cc779 100644 --- a/src/main/starlark/tests/builtins_bzl/cc/cc_shared_library/test_cc_shared_library/BUILD.builtin_test +++ b/src/main/starlark/tests/builtins_bzl/cc/cc_shared_library/test_cc_shared_library/BUILD.builtin_test @@ -8,6 +8,12 @@ package( default_visibility = ["//src/main/starlark/tests/builtins_bzl/cc/cc_shared_library/test_cc_shared_library:__subpackages__"], ) +py_test( + name = "python_test", + srcs = ["python_test.py"], + data = ["foo_so"], +) + cc_test( name = "cc_test", srcs = ["main.cc"], @@ -371,7 +377,7 @@ debug_files_test( runfiles_test( name = "runfiles_test", - target_under_test = ":binary", + target_under_test = ":python_test", is_linux = select({ "//src/conditions:linux": True, "//conditions:default": False}), diff --git a/src/main/starlark/tests/builtins_bzl/cc/cc_shared_library/test_cc_shared_library/python_test.py b/src/main/starlark/tests/builtins_bzl/cc/cc_shared_library/test_cc_shared_library/python_test.py new file mode 100644 index 00000000000000..47501fac663cc4 --- /dev/null +++ b/src/main/starlark/tests/builtins_bzl/cc/cc_shared_library/test_cc_shared_library/python_test.py @@ -0,0 +1,13 @@ +# Copyright 2022 The Bazel Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. diff --git a/src/main/starlark/tests/builtins_bzl/cc/cc_shared_library/test_cc_shared_library/starlark_tests.bzl b/src/main/starlark/tests/builtins_bzl/cc/cc_shared_library/test_cc_shared_library/starlark_tests.bzl index e7362ef0e215ee..c86bb9fd72405c 100644 --- a/src/main/starlark/tests/builtins_bzl/cc/cc_shared_library/test_cc_shared_library/starlark_tests.bzl +++ b/src/main/starlark/tests/builtins_bzl/cc/cc_shared_library/test_cc_shared_library/starlark_tests.bzl @@ -157,8 +157,8 @@ def _runfiles_test_impl(ctx): for runfile in target_under_test[DefaultInfo].default_runfiles.files.to_list(): actual_files.append(runfile.basename) expected = [ - "libfoo_so.so", - "libbar_so.so", + "renamed_so_file_copy.so", + "libdirect_so_file.so", ] for expected_file in expected: asserts.true(env, expected_file in actual_files, expected_file + " not found in actual files:\n" + "\n".join(actual_files))