Skip to content

Commit

Permalink
Propagate --experimental_cc_implementation_deps to host config
Browse files Browse the repository at this point in the history
RELNOTES: n/a
PiperOrigin-RevId: 407089786
  • Loading branch information
Googler authored and Copybara-Service committed Nov 2, 2021
1 parent 2986222 commit 0c1d09e
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
Expand Up @@ -1142,6 +1142,7 @@ public FragmentOptions getHost() {
host.experimentalLinkStaticLibrariesOnce = experimentalLinkStaticLibrariesOnce;
host.experimentalEnableTargetExportCheck = experimentalEnableTargetExportCheck;
host.experimentalCcSharedLibraryDebug = experimentalCcSharedLibraryDebug;
host.experimentalCcImplementationDeps = experimentalCcImplementationDeps;

host.coptList = coptListBuilder.addAll(hostCoptList).build();
host.cxxoptList = cxxoptListBuilder.addAll(hostCxxoptList).build();
Expand Down
Expand Up @@ -1991,6 +1991,37 @@ public void testImplementationDepsLinkingContextIsPropagated() throws Exception
.contains("bin foo/libimplementation_dep.a");
}

@Test
public void testImplementationDepsConfigurationHostSucceeds() throws Exception {
useConfiguration("--experimental_cc_implementation_deps");
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'],",
")",
"cc_library(",
" name = 'implementation_dep',",
" srcs = ['implementation_dep.cc'],",
" hdrs = ['implementation_dep.h'],",
")");

getHostConfiguredTarget("//foo:bin");
assertDoesNotContainEvent("requires --experimental_cc_implementation_deps");
}

@Test
public void testImplementationDepsFailsWithoutFlag() throws Exception {
scratch.file(
Expand Down

0 comments on commit 0c1d09e

Please sign in to comment.