Skip to content

Commit 0c1d09e

Browse files
Googlercopybara-github
Googler
authored andcommitted
Propagate --experimental_cc_implementation_deps to host config
RELNOTES: n/a PiperOrigin-RevId: 407089786
1 parent 2986222 commit 0c1d09e

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

src/main/java/com/google/devtools/build/lib/rules/cpp/CppOptions.java

+1
Original file line numberDiff line numberDiff line change
@@ -1142,6 +1142,7 @@ public FragmentOptions getHost() {
11421142
host.experimentalLinkStaticLibrariesOnce = experimentalLinkStaticLibrariesOnce;
11431143
host.experimentalEnableTargetExportCheck = experimentalEnableTargetExportCheck;
11441144
host.experimentalCcSharedLibraryDebug = experimentalCcSharedLibraryDebug;
1145+
host.experimentalCcImplementationDeps = experimentalCcImplementationDeps;
11451146

11461147
host.coptList = coptListBuilder.addAll(hostCoptList).build();
11471148
host.cxxoptList = cxxoptListBuilder.addAll(hostCxxoptList).build();

src/test/java/com/google/devtools/build/lib/rules/cpp/CcLibraryConfiguredTargetTest.java

+31
Original file line numberDiff line numberDiff line change
@@ -1991,6 +1991,37 @@ public void testImplementationDepsLinkingContextIsPropagated() throws Exception
19911991
.contains("bin foo/libimplementation_dep.a");
19921992
}
19931993

1994+
@Test
1995+
public void testImplementationDepsConfigurationHostSucceeds() throws Exception {
1996+
useConfiguration("--experimental_cc_implementation_deps");
1997+
scratch.file(
1998+
"foo/BUILD",
1999+
"cc_binary(",
2000+
" name = 'bin',",
2001+
" srcs = ['bin.cc'],",
2002+
" deps = ['lib'],",
2003+
")",
2004+
"cc_library(",
2005+
" name = 'lib',",
2006+
" srcs = ['lib.cc'],",
2007+
" deps = ['public_dep'],",
2008+
")",
2009+
"cc_library(",
2010+
" name = 'public_dep',",
2011+
" srcs = ['public_dep.cc'],",
2012+
" hdrs = ['public_dep.h'],",
2013+
" implementation_deps = ['implementation_dep'],",
2014+
")",
2015+
"cc_library(",
2016+
" name = 'implementation_dep',",
2017+
" srcs = ['implementation_dep.cc'],",
2018+
" hdrs = ['implementation_dep.h'],",
2019+
")");
2020+
2021+
getHostConfiguredTarget("//foo:bin");
2022+
assertDoesNotContainEvent("requires --experimental_cc_implementation_deps");
2023+
}
2024+
19942025
@Test
19952026
public void testImplementationDepsFailsWithoutFlag() throws Exception {
19962027
scratch.file(

0 commit comments

Comments
 (0)