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 compileClasspath is resolved before quarkusGenerateCode task #15454

Merged
merged 1 commit into from
Mar 4, 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 @@ -12,8 +12,10 @@
import java.util.function.Consumer;

import org.gradle.api.GradleException;
import org.gradle.api.file.FileCollection;
import org.gradle.api.plugins.Convention;
import org.gradle.api.plugins.JavaPluginConvention;
import org.gradle.api.tasks.CompileClasspath;
import org.gradle.api.tasks.SourceSet;
import org.gradle.api.tasks.TaskAction;

Expand Down Expand Up @@ -41,6 +43,16 @@ public QuarkusGenerateCode() {
super("Performs Quarkus pre-build preparations, such as sources generation");
}

/**
* Create a dependency on classpath resolution. This makes sure included build are build this task runs.
*
* @return resolved compile classpath
*/
@CompileClasspath
public FileCollection getClasspath() {
return QuarkusGradleUtils.getSourceSet(getProject(), SourceSet.MAIN_SOURCE_SET_NAME).getCompileClasspath();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious, do you know what it was before this change?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, it was the same. This method declare a dependency on the compile classpath which will make sure that gradle resolve all dependency even included build (which was not always guaranteed). This has no effect on the compile classpath of the task.

}

@TaskAction
public void prepareQuarkus() {
getLogger().lifecycle("preparing quarkus application");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ protected String projectDirectoryName() {

@Override
protected String[] buildArguments() {
return new String[] { "clean", "--include-build", "../external-library", "quarkusDev" };
return new String[] { "--include-build", "../external-library", "clean", "quarkusDev" };
}

@Override
Expand Down