use of com.facebook.buck.rules.coercer.PatternMatchedCollection in project buck by facebook.
the class CxxDescriptionEnhancer method parseOnlyPlatformHeaders.
static ImmutableMap<String, SourcePath> parseOnlyPlatformHeaders(BuildTarget buildTarget, BuildRuleResolver resolver, SourcePathRuleFinder ruleFinder, SourcePathResolver sourcePathResolver, CxxPlatform cxxPlatform, String headersParameterName, SourceList headers, String platformHeadersParameterName, PatternMatchedCollection<SourceList> platformHeaders) throws NoSuchBuildTargetException {
ImmutableMap.Builder<String, SourcePath> parsed = ImmutableMap.builder();
java.util.function.Function<SourcePath, SourcePath> fixup = path -> {
try {
return CxxGenruleDescription.fixupSourcePath(resolver, ruleFinder, cxxPlatform, path);
} catch (NoSuchBuildTargetException e) {
throw new RuntimeException(e);
}
};
// Include all normal exported headers that are generated by `cxx_genrule`.
parsed.putAll(headers.toNameMap(buildTarget, sourcePathResolver, headersParameterName, path -> CxxGenruleDescription.wrapsCxxGenrule(ruleFinder, path), fixup));
// Include all platform specific headers.
for (SourceList sourceList : platformHeaders.getMatchingValues(cxxPlatform.getFlavor().toString())) {
parsed.putAll(sourceList.toNameMap(buildTarget, sourcePathResolver, platformHeadersParameterName, path -> true, fixup));
}
return parsed.build();
}
Aggregations