Object ModuleGraph

  • All Implemented Interfaces:

    
    public class ModuleGraph
    
                        

    Runtime module graph for the Browser4 multi-module repository — the anti-staleness answer to the static ModuleMap snapshot.

    Instead of a hand-maintained module → dependents map (which drifts when the module topology changes), this scans the repository's REAL pom.xml files and rebuilds the graph: module path, artifactId, parent artifact, and internal <dependency> edges (groupId = ai.platon.pulsar / ai.platon).

    Pure string/regex analysis of pom content — zero dependencies. Callers walk the repo for pom.xml files and pass them in as (module dir → content).

    Usage (from the coding domain):

    val poms = <relative module dir> to <pom content> map
    val graph = ModuleGraph.build(poms)
    ModuleGraph.transitiveDependents(graph, "browser4-coding")  // [browser4-coding, browser4-agentic, ...]
    ModuleGraph.drift(graph, ModuleMap.MODULES)                // real modules the static map missed
    • Constructor Detail

    • Method Detail

      • parsePom

         final ModuleGraph.PomInfo parsePom(String content)

        Parse one pom.xml into PomInfo. The module's own artifactId is the first <artifactId> OUTSIDE the <parent> block (the parent artifact is captured separately). Returns null when no own artifactId is found.

      • build

         final ModuleGraph.Graph build(Map<String, String> poms)

        Build the graph from a map of module-directory → pom.xml content.

        Parameters:
        poms - relative module dir → pom content (keys use '/', no trailing slash)
      • scanPoms

         final Map<String, String> scanPoms(Path root)

        The standard repository scan: walk root for real module pom.xml files (relative module dir → content). Skips target/, maven-archetype template poms (archetype-resources/), docs trees (docs/, docs-dev/), and the gitignored .test-sessions/ scratch dir (test-session logs, coworker temp files) which are not reactor modules. The repo-root aggregator pom is keyed as browser4 (its artifact id).