diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcCompilationContext.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcCompilationContext.java index db411a4160ff7f..242ed29f1e4bc0 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcCompilationContext.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcCompilationContext.java @@ -228,6 +228,17 @@ public Depset getStarlarkIncludeDirs() { .collect(ImmutableList.toImmutableList()))); } + @Override + public Depset getStarlarkExternalIncludeDirs() { + return Depset.of( + String.class, + NestedSetBuilder.wrap( + Order.STABLE_ORDER, + getExternalIncludeDirs().stream() + .map(PathFragment::getSafePathString) + .collect(ImmutableList.toImmutableList()))); + } + @Override public Depset getStarlarkQuoteIncludeDirs() { return Depset.of( diff --git a/src/main/java/com/google/devtools/build/lib/starlarkbuildapi/cpp/CcCompilationContextApi.java b/src/main/java/com/google/devtools/build/lib/starlarkbuildapi/cpp/CcCompilationContextApi.java index 93a866e216c37b..aeb12368c5fb4c 100644 --- a/src/main/java/com/google/devtools/build/lib/starlarkbuildapi/cpp/CcCompilationContextApi.java +++ b/src/main/java/com/google/devtools/build/lib/starlarkbuildapi/cpp/CcCompilationContextApi.java @@ -84,6 +84,14 @@ public interface CcCompilationContextApi extends Starlark structField = true) Depset getStarlarkIncludeDirs(); + @StarlarkMethod( + name = "external_includes", + doc = + "Returns the set of search paths (as strings) for external header files referenced by" + + " angle bracket. Usually passed with -isystem.", + structField = true) + Depset getStarlarkExternalIncludeDirs(); + @StarlarkMethod( name = "quote_includes", doc =