Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Collect debug info context from implementation deps #19725

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/main/starlark/builtins_bzl/common/cc/cc_library.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,10 @@ def _cc_library_impl(ctx):
data_runfiles = data_runfiles,
))

debug_context = cc_helper.merge_cc_debug_contexts(compilation_outputs, cc_helper.get_providers(ctx.attr.deps, CcInfo))
debug_context = cc_helper.merge_cc_debug_contexts(
compilation_outputs,
cc_helper.get_providers(ctx.attr.deps + ctx.attr.implementation_deps, CcInfo),
)
cc_info = CcInfo(
compilation_context = compilation_context,
linking_context = linking_context,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2000,6 +2000,59 @@ public void testImplementationDepsLinkingContextIsPropagated() throws Exception
.contains("bin foo/libimplementation_dep.a");
}

@Test
public void testImplementationDepsDebugContextIsPropagated() throws Exception {
useConfiguration(
"--experimental_cc_implementation_deps", "--fission=yes", "--features=per_object_debug_info");
scratch.file(
"foo/BUILD",
"cc_binary(",
" name = 'bin',",
" srcs = ['bin.cc'],",
" deps = ['lib'],",
")",
"cc_library(",
" name = 'lib',",
" srcs = ['lib.cc'],",
" deps = ['public_dep'],",
")",
"cc_library(",
" name = 'public_dep',",
" srcs = ['public_dep.cc'],",
" hdrs = ['public_dep.h'],",
" implementation_deps = ['implementation_dep'],",
" deps = ['interface_dep'],",
")",
"cc_library(",
" name = 'interface_dep',",
" srcs = ['interface_dep.cc'],",
" hdrs = ['interface_dep.h'],",
")",
"cc_library(",
" name = 'implementation_dep',",
" srcs = ['implementation_dep.cc'],",
" hdrs = ['implementation_dep.h'],",
")");

ConfiguredTarget lib = getConfiguredTarget("//foo:lib");
assertThat(
lib.get(CcInfo.PROVIDER)
.getCcDebugInfoContext()
.getTransitiveDwoFiles()
.toList()
.stream()
.map(Artifact::getFilename))
.contains("public_dep.dwo");
assertThat(
lib.get(CcInfo.PROVIDER)
.getCcDebugInfoContext()
.getTransitiveDwoFiles()
.toList()
.stream()
.map(Artifact::getFilename))
.contains("implementation_dep.dwo");
}

@Test
public void testImplementationDepsRunfilesArePropagated() throws Exception {
useConfiguration("--experimental_cc_implementation_deps");
Expand Down