cc_proto_library: Honor --cc_proto_library_header_suffixes for WKPs
Closes
@@ -177,7 +177,7 @@ public abstract class CcProtoAspect extends NativeAspectClass implements Configu
// 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 =
@@ -417,7 +417,8 @@ public abstract class CcProtoAspect extends NativeAspectClass implements Configu
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 @@ public abstract class CcProtoAspect extends NativeAspectClass implements Configu
// 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:
