diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/proto/CcProtoAspect.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/proto/CcProtoAspect.java index 1291c2f9fe8a2b..c98d9367288ba5 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/proto/CcProtoAspect.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/proto/CcProtoAspect.java @@ -177,7 +177,7 @@ private static class Impl { // Compute and register files generated by this proto library. Collection outputs = new ArrayList<>(); if (areSrcsBlacklisted()) { - registerBlacklistedSrcs(protoInfo, compilationHelper); + registerBlacklistedSrcs(protoInfo, protoConfiguration, compilationHelper); headerProvider = null; } else if (!protoInfo.getDirectProtoSources().isEmpty()) { Collection headers = @@ -417,7 +417,8 @@ private ImmutableSet getOutputFiles(Iterable 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 @@ -429,8 +430,9 @@ private void registerBlacklistedSrcs(ProtoInfo protoInfo, CcCompilationHelper he // proto library rules. ImmutableList.Builder 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: