Class AdocUnion
java.lang.Object
network.ike.plugin.adoc.AdocUnion
One union of AsciiDoc packages per repository, written and verified from any module of
it. The union mirrors every declared library's root: a package such as
network.ike.lab/dev is copied from an external library's zip, or linked to a
reactor member's src/docs/asciidoc/network.ike.lab/dev so an edit reached through
an include changes the real source. Each library's manifest and a stamp are under
META-INF/ike/<group>/<artifact>/, which is how a later run knows what is there.
The rules, in the order they are applied:
- A zip without a manifest is a legacy library. With legacy mode on it is unpacked into the legacy per-module directory as the stock unpack did; otherwise the build refuses, naming the artifact.
- Two libraries that ship one package are refused, naming both. A library already in the union that no module declares anymore counts too, since the union is one per repository.
- An unchanged library is not rewritten: a copy is keyed by the zip's SHA-256, a link by its target.
- A stale entry whose library is not among those declared is left alone; a run writes only the libraries it was given.
Whether IntelliJ resolves includes, previews and navigates through a symbolic link in
target/generated-sources is to be confirmed by KEC on one machine; until then the
link stays the default and link=false copies a member's tree instead.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordWhat one run did, by library. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanWhetherupdate(List)unpacked a legacy library into the legacy directory.The union directory.update(List<AdocLibrary> libraries) Puts the given libraries in the union, each according to the rules above.intverifyIncludes(Path sourceDirectory, Path localRepository) Checks that every{adoc}and{topics}include under a module's own AsciiDoc source root resolves in the union.
-
Constructor Details
-
AdocUnion
public AdocUnion(Path unionDirectory, Path legacyDirectory, boolean link, boolean legacy, org.apache.maven.api.plugin.Log log) A union at a directory.- Parameters:
unionDirectory- the union,<reactor root>/target/generated-sources/adoclegacyDirectory- where a legacy library is unpacked when legacy mode is onlink- link a reactor member's packages rather than copying themlegacy- unpack a zip without a manifest rather than refusing itlog- the build log
-
-
Method Details
-
unionDirectory
-
legacyUnpacked
public boolean legacyUnpacked()Whetherupdate(List)unpacked a legacy library into the legacy directory.- Returns:
- true after a legacy unpack in this run
-
update
Puts the given libraries in the union, each according to the rules above.- Parameters:
libraries- the libraries one module declares, plus the module itself when it is a library- Returns:
- what was done
- Throws:
org.apache.maven.api.plugin.MojoException- on a legacy zip outside legacy mode, two libraries shipping one package, a manifest that names other coordinates than the dependency, or a file that cannot be written
-
verifyIncludes
Checks that every{adoc}and{topics}include under a module's own AsciiDoc source root resolves in the union. An include into the legacy directory through{topics}also resolves while a legacy library was unpacked there. An unresolved include fails the build with the library that ships the package and the exact dependency block to add, found in the union's manifests, then in the local repository; nothing is fetched.- Parameters:
sourceDirectory- the module'ssrc/docs/asciidoclocalRepository- the local repository root, searched for the suggestion- Returns:
- the number of includes that resolved
- Throws:
org.apache.maven.api.plugin.MojoException- when an include does not resolve
-