Skip to content

Commit

Permalink
cc_proto_library: Honor --cc_proto_library_header_suffixes for WKPs
Browse files Browse the repository at this point in the history
Closes bazelbuild#11121.

PiperOrigin-RevId: 315661721
  • Loading branch information
Yannic authored and Copybara-Service committed Jun 10, 2020
1 parent 54cdd58 commit a7bb50e
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ private static class Impl {
// Compute and register files generated by this proto library.
Collection<Artifact> outputs = new ArrayList<>();
if (areSrcsBlacklisted()) {
registerBlacklistedSrcs(protoInfo, compilationHelper);
registerBlacklistedSrcs(protoInfo, protoConfiguration, compilationHelper);
headerProvider = null;
} else if (!protoInfo.getDirectProtoSources().isEmpty()) {
Collection<Artifact> headers =
Expand Down Expand Up @@ -417,7 +417,8 @@ private ImmutableSet<Artifact> getOutputFiles(Iterable<String> suffixes) {
return result.build();
}

private void registerBlacklistedSrcs(ProtoInfo protoInfo, CcCompilationHelper helper) {
private static void registerBlacklistedSrcs(
ProtoInfo protoInfo, ProtoConfiguration protoConfiguration, CcCompilationHelper helper) {
// Hack: This is a proto_library for descriptor.proto or similar.
//
// The headers of those libraries are precomputed . They are also explicitly part of normal
Expand All @@ -429,8 +430,9 @@ private void registerBlacklistedSrcs(ProtoInfo protoInfo, CcCompilationHelper he
// proto library rules.
ImmutableList.Builder<PathFragment> headers = new ImmutableList.Builder<>();
for (Artifact source : protoInfo.getDirectProtoSources()) {
headers.add(FileSystemUtils.replaceExtension(source.getRootRelativePath(), ".pb.h"));
headers.add(FileSystemUtils.replaceExtension(source.getRootRelativePath(), ".proto.h"));
for (String suffix : protoConfiguration.ccProtoLibraryHeaderSuffixes()) {
headers.add(FileSystemUtils.replaceExtension(source.getRootRelativePath(), suffix));
}
}
// We add the header to the proto_library's module map as additional (textual) header for
// two reasons:
Expand Down

0 comments on commit a7bb50e

Please sign in to comment.