tkobayas commented on code in PR #6860:
URL: https://github.com/apache/incubator-kie/pull/6860#discussion_r3892384684
##########
script/ci/CiComputeBuildScopes.java:
##########
@@ -202,6 +220,102 @@ private static void writeLines(Path out,
Collection<String> lines) throws IOExce
Files.write(out, sorted);
}
+ private static final List<String> EXPECTED_CATEGORIES =
List.of("optaplanner", "kogito-runtimes", "kogito-apps");
+
+ static Map<String, Set<Path>> parseModuleCategories(Path rootPom, Path
cwd) throws IOException {
+ Map<String, Set<Path>> categories = new LinkedHashMap<>();
+ categories.put("drools", new LinkedHashSet<>());
+ for (String cat : EXPECTED_CATEGORIES) {
+ categories.put(cat, new LinkedHashSet<>());
+ }
+
+ String currentCategory = "drools";
+ boolean inModules = false;
+ Set<String> seenBegins = new HashSet<>();
+ Set<String> seenEnds = new HashSet<>();
+
+ Pattern beginPattern =
Pattern.compile("<!--\\s*BEGIN\\s+(\\S+)\\s+modules\\s+\\(auto\\)\\s*-->");
+ Pattern endPattern =
Pattern.compile("<!--\\s*END\\s+(\\S+)\\s+modules\\s+\\(auto\\)\\s*-->");
+ Pattern modulePattern = Pattern.compile("<module>(.+)</module>");
+
+ for (String line : Files.readAllLines(rootPom)) {
+ String trimmed = line.trim();
+
+ if (trimmed.equals("<modules>")) {
+ inModules = true;
+ continue;
+ }
+ if (trimmed.equals("</modules>")) {
+ break;
+ }
+ if (!inModules) continue;
+
+ Matcher beginMatcher = beginPattern.matcher(trimmed);
+ if (beginMatcher.matches()) {
+ currentCategory = beginMatcher.group(1);
+ if (!categories.containsKey(currentCategory)) {
+ System.err.println("ERROR: unknown module category '" +
currentCategory
+ + "' in pom.xml marker. Expected one of: " +
EXPECTED_CATEGORIES);
Review Comment:
outdated
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]