Skip to content

Commit c2f694e

Browse files
XenoAmessdnestoro
authored andcommitted
bugfix for when config agent.metadataCopy.disabledStages have 2 custom stage elements other than main and test, it would never run correctly.
1 parent bee5ead commit c2f694e

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

native-maven-plugin/src/main/java/org/graalvm/buildtools/maven/MergeAgentFilesMojo.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ public class MergeAgentFilesMojo extends AbstractMergeAgentFilesMojo {
7575

7676
private static int numberOfExecutions = 0;
7777

78+
private static final List<String> DEFAULT_DIRS = Arrays.asList("main", "test");
79+
7880
@Override
7981
public void execute() throws MojoExecutionException {
8082
// we need this mojo to be executed only once
@@ -96,15 +98,14 @@ public void execute() throws MojoExecutionException {
9698
}
9799

98100
List<String> disabledPhases = agentConfiguration.getMetadataCopyConfiguration().getDisabledStages();
99-
if (disabledPhases.size() == 2) {
101+
102+
Set<String> dirs = new HashSet<>(DEFAULT_DIRS);
103+
dirs.removeAll(disabledPhases);
104+
if (dirs.isEmpty()) {
100105
logger.info("Both phases are skipped.");
101106
return;
102107
}
103108

104-
Set<String> dirs = new HashSet(2);
105-
dirs.addAll(Arrays.asList("main", "test"));
106-
dirs.removeAll(disabledPhases);
107-
108109
for (String dir : dirs) {
109110
String agentOutputDirectory = (target + "/native/agent-output/" + dir).replace('/', File.separatorChar);
110111
mergeForGivenDir(agentOutputDirectory);

0 commit comments

Comments
 (0)