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

Add a testcase to ensure that include paths are consistent #23064

Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import com.google.devtools.build.lib.analysis.util.BuildViewTestCase;
import com.google.devtools.build.lib.cmdline.Label;
import com.google.devtools.build.lib.cmdline.LabelSyntaxException;
import com.google.devtools.build.lib.cmdline.RepositoryName;
import com.google.devtools.build.lib.collect.nestedset.Depset;
import com.google.devtools.build.lib.packages.Provider;
import com.google.devtools.build.lib.packages.StarlarkInfo;
Expand Down Expand Up @@ -5877,6 +5878,33 @@ public void testStripIncludePrefix() throws Exception {
.contains("bin third_party/bar/_virtual_includes/starlark_lib_suffix/starlark_lib.h");
}

@Test
public void testStripIncludePrefixIncludePath() throws Exception {
createFilesForTestingCompilation(
scratch, "third_party/tools/build_defs/foo", "strip_include_prefix='v1'");
scratch.file(
"third_party/bar/BUILD",
"""
load("//third_party/tools/build_defs/foo:extension.bzl", "cc_starlark_library")

cc_starlark_library(
name = "starlark_lib",
srcs = ["starlark_lib.cc"],
private_hdrs = ["v1/private_starlark_lib.h"],
public_hdrs = ["v1/starlark_lib.h"],
)
""");
ConfiguredTarget target = getConfiguredTarget("//third_party/bar:starlark_lib");
assertThat(target).isNotNull();
CcInfo ccInfo = target.get(CcInfo.PROVIDER);

assertThat(ccInfo.getCcCompilationContext().getIncludeDirs())
.containsExactly(
getTargetConfiguration()
.getBinFragment(RepositoryName.MAIN)
.getRelative("third_party/bar/_virtual_includes/starlark_lib_suffix"));
}

@Test
public void testStripIncludePrefixAndIncludePrefix() throws Exception {
createFilesForTestingCompilation(
Expand Down
Loading