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

Make sure quarkusDev configuration is resolved before quarkusDev task runs #21877

Merged
merged 1 commit into from
Dec 2, 2021
Merged
Show file tree
Hide file tree
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 @@ -166,6 +166,10 @@ public void execute(Task test) {
project.afterEvaluate(this::afterEvaluate);
ConfigurationContainer configurations = project.getConfigurations();

// create a custom configuration for devmode
Configuration configuration = configurations.create(DEV_MODE_CONFIGURATION_NAME)
.extendsFrom(configurations.findByName(JavaPlugin.IMPLEMENTATION_CONFIGURATION_NAME));

tasks.named(JavaPlugin.COMPILE_JAVA_TASK_NAME, JavaCompile.class,
compileJava -> {
compileJava.mustRunAfter(quarkusGenerateCode);
Expand All @@ -188,9 +192,12 @@ public void execute(Task test) {
quarkusGenerateCodeDev.configure(task -> task.dependsOn(resourcesTask));
quarkusGenerateCodeTests.configure(task -> task.dependsOn(resourcesTask));

quarkusDev.configure(task -> task.dependsOn(classesTask, resourcesTask, testClassesTask, testResourcesTask,
quarkusGenerateCodeDev,
quarkusGenerateCodeTests));
quarkusDev.configure(task -> {
task.dependsOn(classesTask, resourcesTask, testClassesTask, testResourcesTask,
quarkusGenerateCodeDev,
quarkusGenerateCodeTests);
task.setQuarkusDevConfiguration(configuration);
});
quarkusRemoteDev.configure(task -> task.dependsOn(classesTask, resourcesTask));
quarkusTest.configure(task -> task.dependsOn(classesTask, resourcesTask, testClassesTask, testResourcesTask,
quarkusGenerateCode,
Expand Down Expand Up @@ -218,9 +225,6 @@ public void execute(Task test) {
.plus(mainSourceSet.getOutput())
.plus(testSourceSet.getOutput()));

// create a custom configuration for devmode
configurations.create(DEV_MODE_CONFIGURATION_NAME);

// create a custom configuration to be used for the dependencies of the testNative task
configurations.maybeCreate(NATIVE_TEST_IMPLEMENTATION_CONFIGURATION_NAME)
.extendsFrom(configurations.findByName(JavaPlugin.TEST_IMPLEMENTATION_CONFIGURATION_NAME));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.gradle.api.plugins.JavaPluginConvention;
import org.gradle.api.plugins.JavaPluginExtension;
import org.gradle.api.provider.Provider;
import org.gradle.api.tasks.CompileClasspath;
import org.gradle.api.tasks.Input;
import org.gradle.api.tasks.InputDirectory;
import org.gradle.api.tasks.Optional;
Expand All @@ -50,6 +51,7 @@ public class QuarkusDev extends QuarkusTask {

public static final String IO_QUARKUS_DEVMODE_ARGS = "io.quarkus.devmode-args";
private Set<File> filesIncludedInClasspath = new HashSet<>();
private Configuration quarkusDevConfiguration;

private File buildDir;

Expand All @@ -76,6 +78,15 @@ public QuarkusDev(String name) {
super(name);
}

@CompileClasspath
public Configuration getQuarkusDevConfiguration() {
return this.quarkusDevConfiguration;
}

public void setQuarkusDevConfiguration(Configuration quarkusDevConfiguration) {
this.quarkusDevConfiguration = quarkusDevConfiguration;
}

@InputDirectory
@Optional
public File getBuildDir() {
Expand Down