Skip to content

Commit

Permalink
Gradle imageTask: look for builders among the dependencies of the run…
Browse files Browse the repository at this point in the history
…time Quarkus application configuration instead of all the project configurations
  • Loading branch information
aloubyansky committed Jul 15, 2024
1 parent 8f06375 commit b69e6b3
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@

import org.gradle.api.tasks.TaskAction;

import io.quarkus.gradle.dependency.ApplicationDeploymentClasspathBuilder;
import io.quarkus.runtime.LaunchMode;

public abstract class ImageTask extends QuarkusBuildTask {

static final String QUARKUS_PREFIX = "quarkus-";
Expand Down Expand Up @@ -53,7 +56,9 @@ List<Builder> availableBuilders() {
// This will only pickup direct dependencies and not transitives
// This means that extensions like quarkus-container-image-openshift via quarkus-openshift are not picked up
// So, let's relax our filters a bit so that we can pickup quarkus-openshift directly (relax the prefix requirement).
return getProject().getConfigurations().stream().flatMap(c -> c.getDependencies().stream())
return getProject().getConfigurations()
.getByName(ApplicationDeploymentClasspathBuilder.getFinalRuntimeConfigName(LaunchMode.NORMAL))
.getDependencies().stream()
.map(d -> d.getName())
.filter(n -> n.startsWith(QUARKUS_CONTAINER_IMAGE_PREFIX) || n.startsWith(QUARKUS_PREFIX))
.map(n -> n.replace(QUARKUS_CONTAINER_IMAGE_PREFIX, "").replace(QUARKUS_PREFIX, ""))
Expand Down

0 comments on commit b69e6b3

Please sign in to comment.