Skip to content

Commit

Permalink
Minimum code styling
Browse files Browse the repository at this point in the history
  • Loading branch information
cesarsotovalero committed Apr 12, 2021
1 parent 8bc5f7f commit 49bc9da
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -151,21 +151,22 @@ public ProjectDependencyAnalysis analyze(MavenProject project) throws ProjectDep
* }
* </pre>
*
* @param project the maven project
* @param project the maven project
* @param artifactClassesMap previously built artifacts map
* @return all used artifacts so far
*/
private Set<Artifact> collectUsedArtifactsFromProcessors(MavenProject project, Map<Artifact,
Set<String>> artifactClassesMap) {
private Set<Artifact> collectUsedArtifactsFromProcessors(MavenProject project,
Map<Artifact, Set<String>> artifactClassesMap) {
final Xpp3Dom[] processors = Optional.ofNullable(project.getPlugin("org.bsc.maven:maven-processor-plugin"))
.map(plugin -> plugin.getExecutionsAsMap().get("process"))
.map(exec -> (Xpp3Dom) exec.getConfiguration())
.map(config -> config.getChild("processors"))
.map(Xpp3Dom::getChildren)
.orElse(new Xpp3Dom[0]);

Arrays.stream(processors).forEach(processor -> findArtifactForClassName(artifactClassesMap, processor.getValue())
.ifPresent(artifact -> artifactUsedClassesMap.putIfAbsent(artifact, new HashSet<>())));
.map(plugin -> plugin.getExecutionsAsMap().get("process"))
.map(exec -> (Xpp3Dom) exec.getConfiguration())
.map(config -> config.getChild("processors"))
.map(Xpp3Dom::getChildren)
.orElse(new Xpp3Dom[0]);
Arrays.stream(processors)
.forEach(processor -> findArtifactForClassName(artifactClassesMap, processor.getValue())
.ifPresent(artifact -> artifactUsedClassesMap.putIfAbsent(artifact, new HashSet<>()))
);
return artifactUsedClassesMap.keySet();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ void testRunCommandToGetDependencyTree() throws IOException, InterruptedExceptio
assertThat(producedTree).hasSameTextualContentAs(expectedTree);
}

@AfterAll
public static void tearDown() throws IOException {
if (producedTree.exists()) {
FileUtils.forceDelete(producedTree);
}
}
// @AfterAll
// public static void tearDown() throws IOException {
// if (producedTree.exists()) {
// FileUtils.forceDelete(producedTree);
// }
// }
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
se.kth.castor:depclean-maven-plugin:maven-plugin:2.0.2-SNAPSHOT
+- se.kth.castor:depclean-core:jar:2.0.2-SNAPSHOT:compile
| +- org.ow2.asm:asm:jar:7.1:compile
| +- org.ow2.asm:asm:jar:9.1:compile
| +- org.codehaus.plexus:plexus-component-annotations:jar:2.0.0:compile
| +- org.codehaus.plexus:plexus-utils:jar:3.3.0:compile
| +- (org.apache.maven:maven-core:jar:3.6.2:compile - omitted for conflict with 3.6.0)
Expand Down

0 comments on commit 49bc9da

Please sign in to comment.