Object ModuleGraph
-
- All Implemented Interfaces:
public class ModuleGraphRuntime 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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public final classModuleGraph.ModuleNodeOne Maven module parsed from its pom.xml.
public final classModuleGraph.PomInfoA parsed pom: the module's own artifactId, its parent artifactId, internal dep artifactIds.
public final classModuleGraph.GraphThe full graph: module-path index + artifactId → module-path index.
-
Field Summary
Fields Modifier and Type Field Description public final static ModuleGraphINSTANCE
-
Method Summary
Modifier and Type Method Description final ModuleGraph.PomInfoparsePom(String content)Parse one pom. final ModuleGraph.Graphbuild(Map<String, String> poms)Build the graph from a map of module-directory → pom.xml content. final Map<String, String>scanPoms(Path root)The standard repository scan: walk root for real module pom.xml files (relative module dir → content). final List<String>transitiveDependents(ModuleGraph.Graph graph, String modulePath)All modules transitively affected when modulePath changes: the module itself plus every module that (directly or transitively) depends on it. final List<String>drift(ModuleGraph.Graph graph, List<String> staticModules)Real modules (from a live scan) that are missing from a static snapshot like ModuleMap.MODULES — evidence the snapshot has drifted. final Stringformat(ModuleGraph.Graph graph, List<String> staticModules)Format the graph for the agent. -
-
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 asbrowser4(its artifact id).
-
transitiveDependents
final List<String> transitiveDependents(ModuleGraph.Graph graph, String modulePath)
All modules transitively affected when modulePath changes: the module itself plus every module that (directly or transitively) depends on it.
-
drift
final List<String> drift(ModuleGraph.Graph graph, List<String> staticModules)
Real modules (from a live scan) that are missing from a static snapshot like ModuleMap.MODULES — evidence the snapshot has drifted.
-
format
final String format(ModuleGraph.Graph graph, List<String> staticModules)
Format the graph for the agent.
-
-
-
-