private static Map<String, String> parseFile(FileDescriptorProto descriptor) {
        return descriptor.getSourceCodeInfo().getLocationList().stream()
                         .filter(l -> !l.getLeadingComments().isEmpty())
                         .map(l -> {
                             final String fullName = getFullName(descriptor, l.getPathList());
                             if (fullName != null) {
                                 return new SimpleImmutableEntry<>(fullName, l.getLeadingComments());
                             } else {
                                 return null;
                             }
                         })
                         .filter(Objects::nonNull)
                         .collect(toImmutableMap(Entry::getKey, Entry::getValue, (first, second) -> {
                             logger.warn("Multiple keys found while parsing proto comments," +
                                         " skipping entry \"{}\".", second);
                             return first;
                         }));
    }
A DocString extractor for gRPC proto compiled descriptors.

<p>To include docstrings in {@link DocService} pages, configure the protobuf compiler to generate
a descriptor set with source info and all imports included. Place the descriptor set in the classpath
location {@code META-INF/armeria/grpc} and ensure the file extension is one of '.bin', '.desc', '.dsc',
'.pb', and '.protobin'. The classpath location
can be changed by setting the {@code com.linecorp.armeria.grpc.descriptorDir} system property.

<p>For example, to generate a descriptor set in Gradle:
<pre>{@code
protobuf {
    generateProtoTasks {
        all().each { task ->
            task.generateDescriptorSet = true
            task.descriptorSetOptions.includeSourceInfo = true
            task.descriptorSetOptions.includeImports = true
            task.descriptorSetOptions.path =
                    "${buildDir}/resources/main/META-INF/armeria/grpc/service-name.dsc"
        }
    }
}
}</pre>
grpc/src/main/java/com/linecorp/armeria/internal/server/grpc/GrpcDocStringExtractor.java