Skip to content

Commit

Permalink
Make the includes parameter in cc_common.compile() accept a nested se…
Browse files Browse the repository at this point in the history
…t. This is

in addition to the type list which it already accepts

RELNOTES:none
PiperOrigin-RevId: 484260263
Change-Id: I22146662f99fc2da797b650baf10d01b785a18d8
  • Loading branch information
oquenchil authored and copybara-github committed Oct 27, 2022
1 parent 1935539 commit c8d6c11
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public Tuple compile(
Sequence<?> privateHeaders, // <Artifact> expected
Object textualHeaders,
Object additionalExportedHeaders,
Sequence<?> includes, // <String> expected
Object starlarkIncludes,
Object looseIncludes,
Sequence<?> quoteIncludes, // <String> expected
Sequence<?> systemIncludes, // <String> expected
Expand Down Expand Up @@ -130,7 +130,7 @@ public Tuple compile(
privateHeaders,
textualHeaders,
additionalExportedHeaders,
includes,
starlarkIncludes,
looseIncludes,
quoteIncludes,
systemIncludes,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2004,7 +2004,7 @@ protected Tuple compile(
Sequence<?> privateHeadersUnchecked, // <Artifact> expected
Object textualHeadersStarlarkObject,
Object additionalExportedHeadersObject,
Sequence<?> includes, // <String> expected
Object starlarkIncludes,
Object starlarkLooseIncludes,
Sequence<?> quoteIncludes, // <String> expected
Sequence<?> systemIncludes, // <String> expected
Expand Down Expand Up @@ -2152,15 +2152,17 @@ protected Tuple compile(
helper.addPublicHeaders(publicHeaders).addPrivateHeaders(privateHeaders).addSources(sources);
}

List<String> includes =
starlarkIncludes instanceof Depset
? Depset.cast(starlarkIncludes, String.class, "includes").toList()
: Sequence.cast(starlarkIncludes, String.class, "includes");
helper
.addCcCompilationContexts(
Sequence.cast(
ccCompilationContexts, CcCompilationContext.class, "compilation_contexts"))
.addImplementationDepsCcCompilationContexts(implementationContexts)
.addIncludeDirs(
Sequence.cast(includes, String.class, "includes").stream()
.map(PathFragment::create)
.collect(ImmutableList.toImmutableList()))
includes.stream().map(PathFragment::create).collect(ImmutableList.toImmutableList()))
.addQuoteIncludeDirs(
Sequence.cast(quoteIncludes, String.class, "quote_includes").stream()
.map(PathFragment::create)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,8 @@ public interface BazelCcModuleApi<
+ "Usually passed with -I. Propagated to dependents transitively.",
positional = false,
named = true,
defaultValue = "[]"),
defaultValue = "[]",
allowedTypes = {@ParamType(type = Sequence.class), @ParamType(type = Depset.class)}),
@Param(
name = "loose_includes",
documented = false,
Expand Down Expand Up @@ -369,7 +370,7 @@ Tuple compile(
Sequence<?> privateHeaders, // <FileT> or Tuple<FileT,Label> expected
Object textualHeaders,
Object additionalExportedHeaders,
Sequence<?> includes, // <String> expected
Object starlarkIncludes,
Object starlarkLooseIncludes,
Sequence<?> quoteIncludes, // <String> expected
Sequence<?> systemIncludes, // <String> expected
Expand Down

0 comments on commit c8d6c11

Please sign in to comment.