Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workaround for dev-ui deps bug #163

Merged
merged 1 commit into from
Feb 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading