Record Class AdocManifest
java.lang.Object
java.lang.Record
network.ike.plugin.adoc.AdocManifest
- Record Components:
groupId- the owning group, fromcoordinatesartifactId- the artifact, fromcoordinatespackages- the packages shipped, in manifest orderregistry- the registry path relative to the root, or null when the manifest names none
public record AdocManifest(String groupId, String artifactId, List<AdocPackage> packages, String registry)
extends Record
A library's manifest: its coordinates and the packages it ships, generated by the build
from the pom and the tree and shipped at
META-INF/ike/<group>/<artifact>/manifest.yaml
(IKE-Network/ike-issues#1341). The union goal reads it to know what a zip puts in the
union and to refuse two libraries that ship one package.
coordinates: network.ike.lab:unlv-topics
packages:
- name: network.ike.lab/aip
kind: topics
- name: network.ike.lab/unlv
kind: library
registry: META-INF/ike/network.ike.lab/unlv-topics/topic-registry.yaml
A module of the same reactor has no zip at generate-sources, so its manifest is derived
from its source tree with fromSourceTree(AdocCoordinates, Path): every directory under the root whose
name has a dot is a group, a group directory that holds files directly is one package,
and otherwise each directory under it is one. The manifest the doc plugin generates is the
one a zip ships; the derived one is for linking the member into the union.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionAdocManifest(String groupId, String artifactId, List<AdocPackage> packages, String registry) Checks the parts and copies the package list. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theartifactIdrecord component.final booleanIndicates whether some other object is "equal to" this one.static AdocManifestfromSourceTree(AdocCoordinates coordinates, Path root) Derives the manifest of a reactor member from its source tree.ga()The group and artifact as the manifest writes them,group:artifact.groupId()Returns the value of thegroupIdrecord component.final inthashCode()Returns a hash code value for this object.packageOwning(String path) The package this manifest ships that holds a path, the longest one when a group package and a domain package both match.packages()Returns the value of thepackagesrecord component.static AdocManifestParses a manifest.static AdocManifestReads a manifest file from a directory tree, such as the union.static Optional<AdocManifest> readFromZip(Path zip, AdocCoordinates coordinates) Reads a library's manifest from its zip, at the entry its coordinates name.registry()Returns the value of theregistryrecord component.final StringtoString()Returns a string representation of this record class.toYaml()Writes the manifest as YAML, deterministically, so an unchanged manifest rewrites to the same bytes.
-
Field Details
-
FILE_NAME
The manifest's file name inside the library'sMETA-INFarea.- See Also:
-
-
Constructor Details
-
AdocManifest
Checks the parts and copies the package list.- Parameters:
groupId- the groupartifactId- the artifactpackages- the packagesregistry- the registry path, or null
-
-
Method Details
-
ga
The group and artifact as the manifest writes them,group:artifact.- Returns:
- the coordinates without a version
-
parse
Parses a manifest.- Parameters:
yaml- the manifest textsource- what the text came from, for the message of a refusal- Returns:
- the manifest
- Throws:
org.apache.maven.api.plugin.MojoException- if the text has no coordinates or no package list
-
readFromZip
Reads a library's manifest from its zip, at the entry its coordinates name.- Parameters:
zip- the library'sadoczipcoordinates- the library's coordinates- Returns:
- the manifest, or empty when the zip ships none, which marks a legacy library
- Throws:
org.apache.maven.api.plugin.MojoException- if the zip cannot be read or the manifest cannot be parsed
-
read
Reads a manifest file from a directory tree, such as the union.- Parameters:
file- the manifest file- Returns:
- the manifest
- Throws:
org.apache.maven.api.plugin.MojoException- if the file cannot be read or parsed
-
fromSourceTree
Derives the manifest of a reactor member from its source tree. A directory under the root is a group when its name has a dot and does not start with one. A group directory that holds a file directly is one package, asnetwork.ike.kompendium.anfis; otherwise each directory under it is a package. A package is of kind "topics" when any.adocfile in it declares a:topic-id:, else "library". A root without any group directory, the legacytopics/layout among them, yields no packages.- Parameters:
coordinates- the member's coordinatesroot- the member's AsciiDoc source root- Returns:
- the derived manifest, with no registry path
- Throws:
org.apache.maven.api.plugin.MojoException- if the tree cannot be read
-
packageOwning
The package this manifest ships that holds a path, the longest one when a group package and a domain package both match.- Parameters:
path- a path relative to the root, with forward slashes- Returns:
- the owning package, or empty when none ships it
-
toYaml
Writes the manifest as YAML, deterministically, so an unchanged manifest rewrites to the same bytes.- Returns:
- the YAML text
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
groupId
-
artifactId
Returns the value of theartifactIdrecord component.- Returns:
- the value of the
artifactIdrecord component
-
packages
-
registry
-