in tools/ci/paimon-ci-tools/src/main/java/org/apache/paimon/tools/ci/utils/shared/ParserUtils.java [46:72]
public static <D> Map<String, D> parsePluginOutput(
Stream<String> lines,
Pattern executionLinePattern,
Function<Iterator<String>, D> blockParser) {
final Map<String, D> result = new LinkedHashMap<>();
final Iterator<String> iterator = lines.iterator();
while (iterator.hasNext()) {
Matcher moduleMatcher = executionLinePattern.matcher(iterator.next());
while (!moduleMatcher.find()) {
if (iterator.hasNext()) {
moduleMatcher = executionLinePattern.matcher(iterator.next());
} else {
return result;
}
}
final String currentModule = moduleMatcher.group("module");
if (!iterator.hasNext()) {
throw new IllegalStateException("Expected more output from the plugin.");
}
result.put(currentModule, blockParser.apply(iterator));
}
return result;
}