Class ManifestReader
java.lang.Object
network.ike.workspace.ManifestReader
Reads a
workspace.yaml file into a typed Manifest.
SnakeYAML parses into raw Maps; this class maps the untyped structure onto immutable Java records with validation.
As of #150, the manifest uses the subprojects: top-level
key. Legacy manifests with components: are rejected by
read(Path) — run mvn ws:align-publish to migrate,
or call
migrateLegacySchemaIfNeeded(Path, java.util.function.Consumer)
first as ws:align-publish does internally.
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringApply legacy-schema rewrites to yaml text.static booleanmigrateLegacySchemaIfNeeded(Path manifestPath, Consumer<String> infoLog) Idempotently migrate a workspace.yaml file from the legacycomponents:schema to the newsubprojects:schema.static ManifestRead a workspace manifest from a Reader (useful for testing).static ManifestRead a workspace manifest from the given YAML file path.
-
Method Details
-
read
Read a workspace manifest from the given YAML file path.- Parameters:
path- path to workspace.yaml- Returns:
- the parsed manifest
- Throws:
ManifestException- if the file cannot be read, has invalid structure, or uses the legacycomponents:schema
-
read
Read a workspace manifest from a Reader (useful for testing).- Parameters:
reader- YAML source- Returns:
- the parsed manifest
- Throws:
ManifestException- if the YAML has invalid structure or uses the legacycomponents:schema
-
migrateLegacySchemaIfNeeded
Idempotently migrate a workspace.yaml file from the legacycomponents:schema to the newsubprojects:schema.If the file does not contain any legacy markers this is a no-op (no file write, no log output). If any legacy markers are present the method rewrites in place:
^components:→subprojects:^component-types:block — removed entirely (terminated by the next top-level key at column 0 or EOF)^groups:block — removed entirely (same termination)- component:(depends-on dash form) →- subproject:
This is the entry point
ws:align-publishcalls before reading the manifest, so legacy workspaces auto-migrate on first align. Other callers get the hard-cut error fromread(Path).- Parameters:
manifestPath- path to workspace.yamlinfoLog- optional info-level log sink (nullable)- Returns:
trueif the file was migrated,falseif no legacy schema was present- Throws:
ManifestException- if the file cannot be read or written
-
migrate
-