Skip to content

Commit

Permalink
bugfix for when config agent.metadataCopy.disabledStages have 2 custo…
Browse files Browse the repository at this point in the history
…m stage elements other than main and test, it would never run correctly.
  • Loading branch information
XenoAmess authored and dnestoro committed Jan 13, 2025
1 parent bee5ead commit c2f694e
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ public class MergeAgentFilesMojo extends AbstractMergeAgentFilesMojo {

private static int numberOfExecutions = 0;

private static final List<String> DEFAULT_DIRS = Arrays.asList("main", "test");

@Override
public void execute() throws MojoExecutionException {
// we need this mojo to be executed only once
Expand All @@ -96,15 +98,14 @@ public void execute() throws MojoExecutionException {
}

List<String> disabledPhases = agentConfiguration.getMetadataCopyConfiguration().getDisabledStages();
if (disabledPhases.size() == 2) {

Set<String> dirs = new HashSet<>(DEFAULT_DIRS);
dirs.removeAll(disabledPhases);
if (dirs.isEmpty()) {
logger.info("Both phases are skipped.");
return;
}

Set<String> dirs = new HashSet(2);
dirs.addAll(Arrays.asList("main", "test"));
dirs.removeAll(disabledPhases);

for (String dir : dirs) {
String agentOutputDirectory = (target + "/native/agent-output/" + dir).replace('/', File.separatorChar);
mergeForGivenDir(agentOutputDirectory);
Expand Down

0 comments on commit c2f694e

Please sign in to comment.