javadoc update

This commit is contained in:
2024-02-28 09:19:37 -05:00
parent 3752a60efd
commit 35a630c2d8
3 changed files with 33 additions and 7 deletions

View File

@@ -238,6 +238,7 @@
<goals><goal>jar</goal></goals>
<configuration>
<show>public</show>
<failOnError>false</failOnError>
</configuration>
</execution>
</executions>

View File

@@ -44,6 +44,12 @@ public class IndexingDependencyGraphTransformer implements DependencyGraphTransf
this.dindex = dindex;
}
/**
* This method is basically an intercepter for the default
* DependencyGraphTransformer. It will make the call to perform the
* default expected functions. But before that, it will crawl the
* dependencies to index them.
*/
@Override
public DependencyNode transformGraph(DependencyNode node, DependencyGraphTransformationContext context) throws RepositoryException {
this.crawl(node, new Stack<DependencyNode>());
@@ -51,6 +57,12 @@ public class IndexingDependencyGraphTransformer implements DependencyGraphTransf
return this.transfomer.transformGraph(node, context);
}
/**
* This method crawls a dependency and its dependencies, recursively.
*
* @param node A dependency.
* @param ancestors A stack of ancestral artifacts; parent on top; root on bottom; empty if root.
*/
private void crawl(DependencyNode node, Stack<DependencyNode> ancestors) {
this.index(node, Collections.unmodifiableList(ancestors));
@@ -60,6 +72,15 @@ public class IndexingDependencyGraphTransformer implements DependencyGraphTransf
ancestors.pop();
}
/**
* This method indexes a dependency.
*
* If a dependency encountered more than once, any occurrence inside a
* system module will take precedence; then a non-system module.
*
* @param node A dependency.
* @param parents A list of ancestral artifacts; parent is last; root is first; empty if root/self.
*/
public void index(DependencyNode node, List<DependencyNode> parents) {
String nodeId = this.dindex.toId(node);
DependencyType type = this.dindex.getType(nodeId);
@@ -71,6 +92,13 @@ public class IndexingDependencyGraphTransformer implements DependencyGraphTransf
this.dindex.index(node);
if (parents == null || parents.isEmpty()) {
// root element; the project itself
// even if it is a module, we aren't going to consider it one in this context
this.dindex.indexType(nodeId, DependencyType.Self);
return;
}
for (DependencyNode ancestor : parents) {
String ancestorId = this.dindex.toId(ancestor);
type = this.dindex.getType(ancestorId);
@@ -95,13 +123,6 @@ public class IndexingDependencyGraphTransformer implements DependencyGraphTransf
}
}
if (parents == null || parents.isEmpty()) {
// root element; the project itself
// even if it is a module, we aren't going to consider it one in this context
this.dindex.indexType(nodeId, DependencyType.Self);
return;
}
ModuleArtifactExtractor extractor = new ModuleArtifactExtractor(this.dac);
try {
Module module = extractor.extract(node.getArtifact());

View File

@@ -109,6 +109,10 @@ public abstract class AbstractGoal extends DisablableGoal implements DependencyA
this.executePost();
}
/**
* This method creates a Maven RepositorySystemSession that is able to load
* our DependencyIndex.
*/
private RepositorySystemSession injectSession(DependencyIndex dindex) {
DefaultRepositorySystemSession session = new DefaultRepositorySystemSession(this.session.getRepositorySession());
DependencyGraphTransformer transformer = session.getDependencyGraphTransformer();