Skip to content

Commit 3caa6c1

Browse files
committed
Prevent false split package warning when using mixed language projects
Closes: #48493
1 parent 7b789e3 commit 3caa6c1

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/SplitPackageProcessor.java

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import java.util.Iterator;
99
import java.util.List;
1010
import java.util.Map;
11+
import java.util.Objects;
1112
import java.util.Set;
1213
import java.util.TreeSet;
1314
import java.util.function.Predicate;
@@ -73,7 +74,22 @@ void splitPackageDetection(ApplicationArchivesBuildItem archivesBuildItem,
7374
String packageName = DotNames.packageName(classInfo.name());
7475
packageToArchiveMap.compute(packageName, (key, val) -> {
7576
Set<ApplicationArchive> returnValue = val == null ? new HashSet<>() : val;
76-
returnValue.add(archive);
77+
boolean add = true;
78+
79+
// this special case essentially ensures that no archive which is built from an indexed dependency is added twice
80+
// the primary use case for this is to avoid duplicate warnings for dependencies that use multiple languages
81+
if (archive.getResolvedDependency() != null) {
82+
if (returnValue.stream().map(ApplicationArchive::getResolvedDependency).filter(Objects::nonNull)
83+
.collect(
84+
Collectors.toSet())
85+
.contains(archive.getResolvedDependency())) {
86+
add = false;
87+
}
88+
}
89+
90+
if (add) {
91+
returnValue.add(archive);
92+
}
7793
return returnValue;
7894
});
7995
}

0 commit comments

Comments
 (0)