Skip to content

Commit

Permalink
Workaround for dev-ui deps (#163)
Browse files Browse the repository at this point in the history
  • Loading branch information
ia3andy authored Feb 9, 2024
1 parent 9720595 commit 16113a1
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import java.util.stream.StreamSupport;

import org.jboss.logging.Logger;
Expand All @@ -25,6 +26,9 @@ class WebDependenciesScannerProcessor {

private static final Logger LOGGER = Logger.getLogger(WebDependenciesScannerProcessor.class);

private static final String SCOPE_COMPILE = "compile";
private static final String SCOPE_PROVIDED = "provided";

@BuildStep
WebDependenciesBuildItem collectDependencies(LaunchModeBuildItem launchMode,
CurateOutcomeBuildItem curateOutcome,
Expand All @@ -35,7 +39,14 @@ WebDependenciesBuildItem collectDependencies(LaunchModeBuildItem launchMode,
}
final var stream = StreamSupport.stream(curateOutcome.getApplicationModel()
.getDependenciesWithAnyFlag(DependencyFlags.COMPILE_ONLY, DependencyFlags.RUNTIME_CP).spliterator(), false);
List<WebDependency> webDeps = stream
// workaround for dev-ui deps which are currently not in the COMPILE_ONLY flag even if declared as such in the user project.
// They are in the DEPLOYMENT_CP flag and the scope is compile (Gradle) or provided (Maven)
// See https://github.com/quarkusio/quarkus/issues/38682
final Stream<ResolvedDependency> workaroundStream = StreamSupport
.stream(curateOutcome.getApplicationModel().getDependencies(DependencyFlags.DEPLOYMENT_CP).spliterator(), false)
.filter(d -> SCOPE_COMPILE.equals(d.getScope()) || SCOPE_PROVIDED.equals(d.getScope()));
List<WebDependency> webDeps = Stream.concat(stream, workaroundStream)
.distinct()
.filter(Dependency::isJar)
.filter(d -> WebDependencyType.anyMatch(d.toCompactCoords()))
.peek(d -> checkScope(launchMode, d, config))
Expand Down

0 comments on commit 16113a1

Please sign in to comment.